コード例 #1
0
ファイル: GameState.cs プロジェクト: michaellperry/Reversi
        public GameState(Player player)
        {
            _player = player;
            if (_player != null)
            {
                _myColor = _player.Index == 0 ? PieceColor.Black : PieceColor.White;
            }

            _depGameBoard = new Dependent(UpdateGameBoard);
        }
コード例 #2
0
        public RemoteGameState(Player player, MainNavigationModel mainNavigation)
        {
            _player = player;
            _mainNavigation = mainNavigation;
            if (_player != null)
            {
                _myColor = _player.Index == 0 ? PieceColor.Black : PieceColor.White;
            }

            _depGameBoardRaw = new Dependent(UpdateGameBoardRaw);
            _depGameBoard = new Dependent(UpdateGameBoard);
            _depPreviewBoard = new Dependent(UpdatePreviewBoard);
        }
コード例 #3
0
 public ChatViewModel(Player selectedPlayer, ChatNavigationModel navigation)
 {
     _selectedPlayer = selectedPlayer;
     _navigation = navigation;
 }
コード例 #4
0
 public GameViewModel(Player player)
 {
     _player = player;
     _gameState = new GameState(player);
 }
コード例 #5
0
 public GameSummaryViewModel(Player player, MainNavigationModel mainNavigation)
 {
     _player = player;
     _mainNavigation = mainNavigation;
     _gameState = new RemoteGameState(player, _mainNavigation);
 }
コード例 #6
0
            public CorrespondenceFact CreateFact(FactMemento memento)
            {
                Player newFact = new Player(memento);

                // Create a memory stream from the memento data.
                using (MemoryStream data = new MemoryStream(memento.Data))
                {
                    using (BinaryReader output = new BinaryReader(data))
                    {
                        newFact._index = (int)_fieldSerializerByType[typeof(int)].ReadData(output);
                    }
                }

                return newFact;
            }
コード例 #7
0
ファイル: GameTest.cs プロジェクト: michaellperry/Reversi
 private static void Resign(Player player)
 {
     player.Game.DeclareWinner(player.Game.Players.FirstOrDefault(p => p != player), true);
 }
コード例 #8
0
 // Results
 // Business constructor
 public Outcome(
     Game game
     ,Player winner
     ,int resigned
     )
 {
     InitializeResults();
     _game = new PredecessorObj<Game>(this, RoleGame, game);
     _winner = new PredecessorOpt<Player>(this, RoleWinner, winner);
     _resigned = resigned;
 }
コード例 #9
0
 // Fields
 // Results
 // Business constructor
 public OutcomeAcknowledge(
     Player player
     ,Outcome outcome
     )
 {
     InitializeResults();
     _player = new PredecessorObj<Player>(this, RolePlayer, player);
     _outcome = new PredecessorObj<Outcome>(this, RoleOutcome, outcome);
 }
コード例 #10
0
 // Results
 // Business constructor
 public Message(
     Player sender
     ,string body
     ,int index
     )
 {
     InitializeResults();
     _sender = new PredecessorObj<Player>(this, RoleSender, sender);
     _body = body;
     _index = index;
 }
コード例 #11
0
 // Results
 // Business constructor
 public Move(
     Player player
     ,int index
     ,int square
     )
 {
     InitializeResults();
     _player = new PredecessorObj<Player>(this, RolePlayer, player);
     _index = index;
     _square = square;
 }
コード例 #12
0
 // Fields
 // Results
 // Business constructor
 public GameRequestCompletion(
     GameRequest gameRequest
     ,Player player
     )
 {
     InitializeResults();
     _gameRequest = new PredecessorObj<GameRequest>(this, RoleGameRequest, gameRequest);
     _player = new PredecessorObj<Player>(this, RolePlayer, player);
 }
コード例 #13
0
 public ChatViewModel(Player selectedPlayer, MainNavigationModel mainNavigation)
 {
     _selectedPlayer = selectedPlayer;
     _mainNavigation = mainNavigation;
 }
コード例 #14
0
ファイル: Game.cs プロジェクト: michaellperry/Reversi
 public void DeclareWinner(Player winner, bool resigned)
 {
     Community.AddFact(new Outcome(this, winner, resigned ? 1 : 0));
 }
コード例 #15
0
 public MessageViewModel(Message message, Player player)
 {
     _player = player;
     _message = message;
 }
コード例 #16
0
 public RemoteGameViewModel(Player player, MainNavigationModel mainNavigation)
     : base(mainNavigation)
 {
     _player = player;
 }