Exemplo n.º 1
0
        // ----------------------------------------------------------------------------------------------------------------
        // Add the players score, and saves it into the current storage.
        protected void SaveButtonClick(Object sender, EventArgs args)
        {
            try
            {
                string content = Intent.GetStringExtra(GlobalApp.getPlayersScoreVariable());

                if (GlobalApp.isNewPlayer())
                {
                    if (String.Compare(enterNameTxt.Text, DEFAULTENTERNAMEHERE) == 0)
                    {
                        GlobalApp.setName(DEFAULTNAME);
                        content = DEFAULTNAME + content;
                    }
                    else
                    {
                        GlobalApp.setName(enterNameTxt.Text);
                        content = enterNameTxt.Text + content;
                    }
                }
                else
                {
                    if (String.Compare(enterNameTxt.Text, DEFAULTENTERNAMEHERE) == 0)
                    {
                        GlobalApp.setName(DEFAULTNAME);
                        content = DEFAULTNAME + content;
                    }
                    else
                    {
                        GlobalApp.setName(enterNameTxt.Text);
                        content = enterNameTxt.Text + content;
                    }
                }

                // Now we can add the new score into the local leaderboard.
                // Method: addNewScore will also determine if the score can be added into the Online leaderboard.
                LeaderBoardInterface.addNewScore(content);
            }
            catch
            {
                GlobalApp.Alert(this, 0);
            }
            finally
            {
                GlobalApp.BeginActivity(this, typeof(GameMenuActivity), GlobalApp.getVariableChoiceName(), Intent.GetIntExtra(GlobalApp.getVariableChoiceName(), 0));
            }
        }