public GameState(Player player) { _player = player; if (_player != null) { _myColor = _player.Index == 0 ? PieceColor.Black : PieceColor.White; } _depGameBoard = new Dependent(UpdateGameBoard); }
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); }
public ChatViewModel(Player selectedPlayer, ChatNavigationModel navigation) { _selectedPlayer = selectedPlayer; _navigation = navigation; }
public GameViewModel(Player player) { _player = player; _gameState = new GameState(player); }
public GameSummaryViewModel(Player player, MainNavigationModel mainNavigation) { _player = player; _mainNavigation = mainNavigation; _gameState = new RemoteGameState(player, _mainNavigation); }
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; }
private static void Resign(Player player) { player.Game.DeclareWinner(player.Game.Players.FirstOrDefault(p => p != player), true); }
// 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; }
// 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); }
// Results // Business constructor public Message( Player sender ,string body ,int index ) { InitializeResults(); _sender = new PredecessorObj<Player>(this, RoleSender, sender); _body = body; _index = index; }
// Results // Business constructor public Move( Player player ,int index ,int square ) { InitializeResults(); _player = new PredecessorObj<Player>(this, RolePlayer, player); _index = index; _square = square; }
// 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); }
public ChatViewModel(Player selectedPlayer, MainNavigationModel mainNavigation) { _selectedPlayer = selectedPlayer; _mainNavigation = mainNavigation; }
public void DeclareWinner(Player winner, bool resigned) { Community.AddFact(new Outcome(this, winner, resigned ? 1 : 0)); }
public MessageViewModel(Message message, Player player) { _player = player; _message = message; }
public RemoteGameViewModel(Player player, MainNavigationModel mainNavigation) : base(mainNavigation) { _player = player; }