コード例 #1
0
        public void GameComplete_IsTrue_ShouldBeTrueWhenGameComplete()
        {
            var gamecomplete = new GameComplete();

            gamecomplete.gameStatus(true);
            Assert.True(gamecomplete.gameWon);
        }
コード例 #2
0
        /// <summary>
        /// Initializes the dictionary object.
        /// </summary>
        /// <returns>Commands dictionary.</returns>
        private static Dictionary <string, IGameCommand> InitializeList()
        {
            Dictionary <string, IGameCommand> list = new Dictionary <string, IGameCommand>();

            IGameCommand loginCommand = new Login();

            list.Add(loginCommand.Name, loginCommand);

            IGameCommand getPlayerCommand = new GetPlayersList();

            list.Add(getPlayerCommand.Name, getPlayerCommand);

            IGameCommand selectPlayerCommand = new SelectPlayer();

            list.Add(selectPlayerCommand.Name, selectPlayerCommand);

            IGameCommand uiLoadCompleteCommand = new UILoadComplete();

            list.Add(uiLoadCompleteCommand.Name, uiLoadCompleteCommand);

            IGameCommand updateScoreCommand = new UpdateScore();

            list.Add(updateScoreCommand.Name, updateScoreCommand);

            IGameCommand gameCompleteCommand = new GameComplete();

            list.Add(gameCompleteCommand.Name, gameCompleteCommand);

            IGameCommand sendJigSawCoordinates = new SendJigSawCoordinates();

            list.Add(sendJigSawCoordinates.Name, sendJigSawCoordinates);

            IGameCommand selectTile = new SelectTile();

            list.Add(selectTile.Name, selectTile);

            IGameCommand disableTile = new DisableTile();

            list.Add(disableTile.Name, disableTile);

            IGameCommand assignTile = new AssignTile();

            list.Add(assignTile.Name, assignTile);

            IGameCommand resetTile = new ResetTile();

            list.Add(resetTile.Name, resetTile);

            return(list);
        }
コード例 #3
0
        private void PublishGameComplete()
        {
            LogInfo("Game has ended, the winnig player is " +
                    (Winner == null ? "no one, game ended in a draw" : Winner.Name));
            LogInfo("Leader Board");
            for (int i = 0; i < LeaderBoard.Count; i++)
            {
                LogInfo(i + ": " + LeaderBoard[i]);
            }

            foreach (var player in _players)
            {
                player.GameEnded(_gameMap);
            }

            _gameComplete = true;
            GameComplete?.Invoke(_gameMap, LeaderBoard);
        }
コード例 #4
0
        /// <summary>
        /// Initializes the dictionary object.
        /// </summary>
        /// <returns>Commands dictionary.</returns>
        private static Dictionary <string, IGameCommand> InitializeList()
        {
            Dictionary <string, IGameCommand> list = new Dictionary <string, IGameCommand>();

            IGameCommand loginCommand = new Login();

            list.Add(loginCommand.Name, loginCommand);

            IGameCommand getBuddyPlayersCommand = new GetBuddyPlayers();

            list.Add(getBuddyPlayersCommand.Name, getBuddyPlayersCommand);

            IGameCommand selectBuddyCommand = new SelectBuddy();

            list.Add(selectBuddyCommand.Name, selectBuddyCommand);

            IGameCommand uiLoadCompleteCommand = new UILoadComplete();

            list.Add(uiLoadCompleteCommand.Name, uiLoadCompleteCommand);

            IGameCommand sendDotPointCommand = new SendDotPoint();

            list.Add(sendDotPointCommand.Name, sendDotPointCommand);

            IGameCommand sendMousePointCommand = new SendMousePoint();

            list.Add(sendMousePointCommand.Name, sendMousePointCommand);

            IGameCommand updateScoreCommand = new UpdateScore();

            list.Add(updateScoreCommand.Name, updateScoreCommand);

            IGameCommand gameCompleteCommand = new GameComplete();

            list.Add(gameCompleteCommand.Name, gameCompleteCommand);

            return(list);
        }
コード例 #5
0
        public void GameComplete_IsFalse_ShouldBeFalseWhenGameStarts()
        {
            var gamecomplete = new GameComplete();

            Assert.False(gamecomplete.gameWon);
        }
コード例 #6
0
 private void InternalGameComplete(object sender, GameCompleteEventArgs e)
 {
     GameComplete?.Invoke(this, e);
 }
コード例 #7
0
 private void RaiseGameComplete()
 {
     GameComplete?.Invoke(this, new GameCompleteEventArgs {
         ElapsedTime = CurrentPresenter.ElapsedTime
     });
 }