Does Score Ninja have to be released to save scores?
So I have Score Ninja up and running on my app. It appears to be coded correctly. When I play through the game and get a score the box pops up and prompts me to input my name and such and then it goes to the other small screen that shows the list. After I input and submit and then exit the 2nd little box and I got to the high scores it does not display any highscores. Then when I play another round I get high score again and the other score is not on the list. Was wondering if anyone has used this and knows much about it. Does it not display and keep track of high scores until the app is released? Or maybe I coded something in wrong and it's not saving it or something. Here is where it is in my code in case you want to see.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TIT开发者_如何学PythonLE);
setContentView(new GameView(this));
// scoreNinjaAdapter = new ScoreNinjaAdapter( // context, "appid", "key");
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data){
super.onActivityResult(requestCode, resultCode, data);
scoreNinjaAdapter.onActivityResult(requestCode, resultCode, data);
}
void onGameOver(){
//
}Thats the PlayGame class that leads to the surface view. I have tried it with the stuff that is commented above in the code and out. I also had stuff in the onGameOver() but it didnt make any difference either. Here is the code in the surface view that contains it.
@Override
protected void onDraw(Canvas canvas) {
else if (gameState == GAME_OVER){
gameOverTime =(double)(System.currentTimeMillis()-startTime)/100000;
finalScore = score;
canvas.drawRect(0, 0, canvas.getWidth(), canvas.getHeight(), clearPaint);
if(gOverType == 1){
canvas.drawBitmap(bmpBloodOver, null, dst, null);
canvas.drawText("GAME OVER!", canvas.getWidth()/8, canvas.getHeight()/3, whitePaint);
canvas.drawText("KILLS: " + kills, canvas.getWidth()/8, canvas.getHeight()/3+70, whitePaint);
canvas.drawText("SCORE: " + finalScore, canvas.getWidth()/8, canvas.getHeight()/3+140, whitePaint);
}
if (scoreNinja < 1){
ScoreNinjaAdapter scores = new ScoreNinjaAdapter(getContext() , "appid", "key" );
scores.show(finalScore, null, Integer.toString(finalScore));
scoreNinja++;
}
GameLoopThread.running=false;
}
I cut pieces out that had nothing to do with it. The if around the scoreninja score is there to keep the ondraw from redisplaying the boxes over and over. If anyone knows anything about it or any ideas help would be appreciated. Thanks
Here is the Score Ninja site btw http://scoreninja.appspot.com/#HowTo
If scoreninja is an online leader board, make sure you have networking enabled for your app.
If you can't get ScoreNinja working, check out Swarm's Leaderboards, which provide a very similar (simple, free) solution, without requiring the user to download a separate app to have it work :)
精彩评论