示例#1
0
 /// <summary>
 /// EXECUTES WHEN WE LOAD THE INSTRUCTIONS PIVOT FOR THE FIRST TIME
 /// (ALSO EXECUTES WHEN COMING BACK TO THE MAINPIVOT, FOR EXAMPLE COMING BACK FROM
 /// THE OPTIONS PAGE).
 /// </summary>
 void LoadInstructions(object sender, EventArgs e)
 {
     // SETUP ADVERTISEMENT:
     if (Globals.bDisplayAds)
     {
         Advertising.GetAdForGrid(LayoutRoot, 2, 0, 0);
     }
 }
示例#2
0
        /// <summary>
        /// EXECUTES AFTER THE PAGE IS LOADED:
        /// </summary>
        private void LoadGame(object sender, EventArgs e)
        {
            // DISABLE THE RECTANGLES IMMEDIATELY:
            DisableRectangles();

            // LOAD UP GAME COLORS:
            efGameColor.Value = Globals.Data.GameColor;
            efUserColor.Value = Globals.Data.UserColor;

            // SETUP ADVERTISEMENT:
            if (Globals.bDisplayAds)
            {
                Advertising.GetAdForGrid(LayoutRoot, 4, 0, 4);
            }

            if (Globals.Data.GameMode == Enumerations.GameMode.Easy)
            {
                // FOR EASY MODE, ONLY USE 4 RECTANGLE:
                Globals.numberOfRectangles = 4;

                if (Globals.bGameIsPaused)
                {
                    RemoveHardRectanglesWithoutAnimation();
                }
                else
                {
                    AnimateRemovalOfHardRectangles();
                }
            }
            else
            {
                // FOR HARD MODE, USE 8 RECTANGLES:
                Globals.numberOfRectangles = 8;
            }

            if (Globals.bGameIsPaused)
            {
                // GAME IS PAUSED, SO NOW WE HAVE TO DISPLAY THE PAUSE CANVAS:
                // SAVE THE CURRENT SEQUENCE COUNTER:
                Globals.nSequenceCounter = (int)PhoneApplicationService.Current.State["MemorySquared_SequenceCounter"];
                ShowPauseGrid();
            }
            else
            {
                // RESET COUNTDOWN:
                nGameCountdown = 3;

                // start the 5 second timer which will begin the game:
                gameStartTimer          = new DispatcherTimer();
                gameStartTimer.Tick    += StartGame;
                gameStartTimer.Interval = new TimeSpan(0, 0, 1);
                gameStartTimer.Start();

                lblCountdown.Visibility = System.Windows.Visibility.Visible;
            }
        }
示例#3
0
        void LoadAbout(Object sender, EventArgs e)
        {
            // SETUP ADVERTISEMENT:
            if (Globals.bDisplayAds)
            {
                Advertising.GetAdForGrid(LayoutRoot, 2, 0, 0);
            }

            // GET VERSION:
            lblVersionNumber.Text = AppResources.Version + ": " + Globals.VersionNumber().ToString();
        }
示例#4
0
        void LoadIncorrect(object sender, EventArgs e)
        {
            // SETUP ADVERTISEMENT:
            if (Globals.bDisplayAds)
            {
                Advertising.GetAdForGrid(LayoutRoot, 2, 0, 0);
            }

            int nNewScore = 0, nOldScore = 0;

            // GET THEIR CURRENT SCORE FROM THIS ROUND:
            if (PhoneApplicationService.Current.State.ContainsKey("MemorySquared_NewScore"))
            {
                nNewScore = int.Parse(PhoneApplicationService.Current.State["MemorySquared_NewScore"].ToString());
            }

            // GET THEIR CURRENTLY SAVED HIGH SCORE:
            if (PhoneApplicationService.Current.State.ContainsKey("MemorySquared_OldScore"))
            {
                nOldScore = int.Parse(PhoneApplicationService.Current.State["MemorySquared_OldScore"].ToString());
            }

            // NEW HIGH SCORE?
            if (nNewScore > nOldScore)
            {
                // SHOW THE USER "NEW HIGH SCORE!":
                lblNewHighScore.Visibility = Visibility.Visible;

                // SAVE:
                Globals.Data.SaveGameData();
            }

            // If the new score is greater than the tenth (or last) score on the
            // leaderboard, and also greater than 0, we'll let them add this score to the leaderboard:
            if (nNewScore > 0 && LeaderboardHelper.CanAddToLeaderboard(Globals.Data, nNewScore) == true)
            {
                btnAddScore.Visibility = Visibility.Visible;
            }

            // SHOW THEM THE RESULTS:
            lblYourScore.Text         = AppResources.YourScore + ": " + nNewScore.ToString();
            lblPreviousHighScore.Text = AppResources.PreviousHighScore + ": " + nOldScore.ToString();
        }
示例#5
0
        /// <summary>
        /// LOADS UP EVERYTHING ONTO THE OPTIONS CANVAS
        /// </summary>
        void LoadOptions(object sender, EventArgs e)
        {
            // SETUP ADVERTISEMENT:
            if (Globals.bDisplayAds)
            {
                Advertising.GetAdForGrid(LayoutRoot, 2, 0, 0);
            }

            rectGameColor.Fill = new SolidColorBrush(Globals.Data.GameColor);
            rectUserColor.Fill = new SolidColorBrush(Globals.Data.UserColor);

            tsSequencePrompt.IsChecked = Globals.Data.YourTurnHelper;
            tsLightTheme.IsChecked     = Globals.Data.Theme == Enumerations.Theme.Light ? true : false;

            //// GET THE SELECTED VALUE:
            //lpGameColor.SelectedIndex = Globals.Data.GameColor;
            //lpGameColor.SelectionChanged += UpdateSelectedColor;
            //lpGameColor.SetValue(Canvas.ZIndexProperty, 9999);

            //// GET THE SELECTED GAME COLOR VALUE:
            //lpUserColor.SelectedIndex = Globals.Data.UserColor;
            //lpUserColor.SelectionChanged += UpdateSelectedColor;
            //lpUserColor.SetValue(Canvas.ZIndexProperty, 9998);

            //// GET THE SELECTED VALUE:
            //cbYourTurn.IsChecked = Globals.Data.YourTurnHelper;
            //cbYourTurn.Checked += YourTurnCheckBox_Checked;
            //cbYourTurn.Unchecked += YourTurnCheckBox_Checked;

            ////// WHICH THEME DOES THE USER HAVE SAVED?
            //if (Globals.Data.Theme == Enumerations.Theme.Light)
            //   lpTheme.SelectedIndex = 0;
            //else // DISPLAY DARK IF NO THEME CHOSEN:
            //    lpTheme.SelectedIndex = 1;

            //lpTheme.SelectionChanged += UpdateTheme;

            //// DO WE NEED TO DISPLAY ADS?
            //if (Globals.bDisplayAds == true) btnRemoveAds.Visibility = Visibility.Visible;
        }
示例#6
0
        /// <summary>
        /// EXECUTES WHEN WE LOAD THE MENU PAGE
        /// </summary>
        void LoadMenuPage(object sender, EventArgs e)
        {
            // CHECK FOR PREVIOUS EXCEPTION:
            ErrorReporting.CheckForPreviousException();

            // SETUP ADVERTISEMENT:
            if (Globals.bDisplayAds)
            {
                Advertising.GetAdForGrid(LayoutRoot, 2, 0, 0);
            }

            // DISPLAY CURRENT HIGH SCORES:
            lblHighScoreEasy.Text = AppResources.HighScoreEasy + ": " + Globals.Data.HighScoreEasy;
            lblHighScoreHard.Text = AppResources.HighScoreHard + ": " + Globals.Data.HighScoreHard;

            if (Globals.bGameIsPaused == true)
            {
                btnGame.Content = AppResources.ResumeGame;
            }
            else
            {
                btnGame.Content = AppResources.StartGame;
            }
        }