Ejemplo n.º 1
0
        // ----------------------------------------------------------------------------------------------------------------
        // Will determine if the players score, and time can be added to either local, or online.
        // @param timeStr will be either in the form of HH:MM:SS or MM:SS
        private void checkForNewPositionToLocalAndOnline(string scoreStr, string timeStr, string difStr)
        {
            bool ifNewHighScore = LeaderBoardInterface.newHighTimeScore(scoreStr, timeStr, difStr);

            if (ifNewHighScore)
            {
                highScoreTxtView.Text = "New High Score!";
            }
            saveBtn.Enabled      = ifNewHighScore;
            enterNameTxt.Enabled = ifNewHighScore;
        }
Ejemplo n.º 2
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));
            }
        }
Ejemplo n.º 3
0
 // ----------------------------------------------------------------------------------------------------------------
 // Initializes the data for the Leaderboard Local, and Online.
 // @param isOnline, must be either true, or false.
 private void initializeLeaderboardData(bool isOnline)
 {
     try
     {
         if (isOnline)
         {
             setBackgroundColorByClick(Color.DarkGray, Color.Gray, isOnline);
             if (LeaderBoardInterface.hasInternetConnection())
             {
                 // Delete the current Adpater
                 LeaderBoardListView.Adapter = null;
                 // And store a new one.
                 LeaderBoardListView.Adapter = new LeaderBoardRowAdapter(this, isOnline);
             }
             else
             {
                 // Delete the current Adpater
                 LeaderBoardListView.Adapter = null;
                 // And store a new one.
                 LeaderBoardListView.Adapter = new LeaderBoardRowAdapter(this);
             }
         }
         else
         {
             setBackgroundColorByClick(Color.DarkGray, Color.Gray, isOnline);
             // Delete the current Adpater
             LeaderBoardListView.Adapter = null;
             // And store a new one.
             LeaderBoardListView.Adapter = new LeaderBoardRowAdapter(this, isOnline);
         }
     }
     catch
     {
         GlobalApp.Alert(this, 0);
     }
 }
Ejemplo n.º 4
0
 // ----------------------------------------------------------------------------------------------------------------
 // Populates the Leader board with data of scores that are either from the local, or online text files.
 private void PopulateLeaderBoardData(bool isOnline)
 {
     data = LeaderBoardInterface.PopulateLeaderBoardData(isOnline);
 }