Exemple #1
0
 // ----------------------------------------------------------------------------------------------------------------
 // Event handler
 private void OnTimedEvent(object sender, System.Timers.ElapsedEventArgs e)
 {
     delay--;
     if (delay == 0)
     {
         timer.Dispose();
         GlobalApp.BeginActivity(this, typeof(MainActivity), "", 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));
            }
        }
Exemple #3
0
 // ----------------------------------------------------------------------------------------------------------------
 // Event handler: Determines which item was selected in the list of games
 // and moves to GameMenuActivity.
 private void listViewItemClick(Object sender, AdapterView.ItemClickEventArgs args)
 {
     GlobalApp.BeginActivity(this, typeof(GameMenuActivity), GlobalApp.getVariableChoiceName(), args.Position);
 }
Exemple #4
0
 // ----------------------------------------------------------------------------------------------------------------
 // Returns to the Game Menu Activity of the application.
 protected void ButtonClickSelect(Object sender, EventArgs args)
 {
     GlobalApp.BeginActivity(this, typeof(GameMenuActivity), GlobalApp.getVariableChoiceName(), gameChoice);
 }
Exemple #5
0
 // ----------------------------------------------------------------------------------------------------------------
 // Event Handler: Will direct the player to the Main menu.
 public override void OnBackPressed()
 {
     GlobalApp.BeginActivity(this, typeof(GameMenuActivity), GlobalApp.getVariableChoiceName(), gameChoice);
 }
 // ----------------------------------------------------------------------------------------------------------------
 protected void MenuButtonClick(Object sender, EventArgs args)
 {
     GlobalApp.BeginActivity(this, typeof(GameMenuActivity), GlobalApp.getVariableChoiceName(), Intent.GetIntExtra(GlobalApp.getVariableChoiceName(), 0));
 }
 // ----------------------------------------------------------------------------------------------------------------
 // Event Handler: Will direct the user to the Leaderboard.
 protected void ButtonClickLeaderboard(Object sender, EventArgs ev)
 {
     GlobalApp.BeginActivity(this, typeof(LeaderBoardActivity), GlobalApp.getVariableChoiceName(), gameChoice);
 }
 // ----------------------------------------------------------------------------------------------------------------
 // Event Handler: Will direct the player to the Main menu.
 public override void OnBackPressed()
 {
     // Begin the Main Activity
     GlobalApp.BeginActivity(this, typeof(MainActivity), "", 0);
 }
 // ----------------------------------------------------------------------------------------------------------------
 // Returns to the Main Activity of the application.
 protected void ButtonClickSelect(Object sender, EventArgs args)
 {
     // Begin the Main Activity
     GlobalApp.BeginActivity(this, typeof(MainActivity), "", 0);
 }
 // ---------------------------------------------------------------------------------------------------------------
 // Begins the game selected from the Main menu.
 protected void ButtonClickStart(Object sender, EventArgs args)
 {
     // Begin the game Activity specifed by type
     GlobalApp.BeginActivity(this, game.gType, GlobalApp.getVariableDifficultyName(), difficulty, GlobalApp.getVariableChoiceName(), Intent.GetIntExtra(GlobalApp.getVariableChoiceName(), 0));
 }