コード例 #1
0
ファイル: MemoryGame.cs プロジェクト: phicuong08/memorymatch
        /// <summary>
        /// Initializes a new instance of the <see cref="MemoryGame" /> class.
        /// </summary>
        /// <param name="scoreCalculation">Score calculation provider.</param>
        /// <param name="highscoreProvider">The high score provider.</param>
        public MemoryGame(IScoreCalculation scoreCalculation, IHighscoreProvider highscoreProvider)
        {
            this.scoreCalculation  = scoreCalculation;
            this.highscoreProvider = highscoreProvider;

            StartNewGame();
        }
コード例 #2
0
 public void Stop()
 {
     if (this.gameStarted)
     {
         this.gameStarted             = false;
         CompositionTarget.Rendering -= this.RenderingHandler;
         if (this.IsGameOver())
         {
             IHighscoreProvider highscoreProvider = ApplicationContext.Instance.HighscoreProvider;
             highscoreProvider.AddHighscoreEntry(this.Player);
             highscoreProvider.Persist();
         }
     }
 }
コード例 #3
0
        private void Awake()
        {
            MemoryGame.Current.IsBusy = true;

            numberOfPlayers = MemoryGame.Current.Players;
            bool isSinglePlayer = numberOfPlayers == 1;

            SinglePlayerContainer.SetActive(isSinglePlayer);
            TwoPlayerContainer.SetActive(!isSinglePlayer);

            string gameMode = MemoryGame.Current.GetGameModeString();

            IHighscoreProvider highscoreProvider = MiscFactory.GetHighscoreProvider();

            Highscore = highscoreProvider.GetHighScore(gameMode);
            //Highscore = 777;
        }