Пример #1
0
        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
 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
 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;
 }