public PlayBoardViewModel(PlayBoardViewModel other) : base(other) { _unrevealedCard1 = other.HasUnrevealedCard1 ? new CardViewModel(other.UnrevealedCard1) : new CardViewModel(); _unrevealedCard2 = other.HasUnrevealedCard2 ? new CardViewModel(other.UnrevealedCard2) : new CardViewModel(); _dimensions = other.HasDimensions ? new BoardDimensionsViewModel(other.Dimensions) : new BoardDimensionsViewModel(); _inGameCardsSynced = new SyncedViewModelList <Card, CardViewModel>(new List <Card>(other.InGameCards.Models()), m => new CardViewModel(m)); Init(); }
public GameControllerViewModel(GameController model) : base(model) { _playerHandler = new PlayerHandlerViewModel(model.PlayerHandler); _board = new PlayBoardViewModel(model.Board); _decks = new SyncedViewModelList <DeckDescription, DeckDescriptionViewModel>(model.Decks, m => new DeckDescriptionViewModel(m)); _deck = (from deck in Decks where deck.Equals(model.Deck) select deck).FirstOrDefault(); Init(); }
public GameControllerViewModel() : base(new GameController()) { _playerHandler = new PlayerHandlerViewModel(); _board = new PlayBoardViewModel(); _decks = new SyncedViewModelList <DeckDescription, DeckDescriptionViewModel>(new List <DeckDescription>(), model => new DeckDescriptionViewModel(model)); _deck = new DeckDescriptionViewModel(); Init(); }
void SetColumns(PlayBoardViewModel parent, ushort currentRowNr) { this.InGameCardsColumn = new ObservableCollection <CardViewModel>(); for (ushort column = 0; column < parent.Dimensions.Width; column++) { var inGameCard = (from card in parent.InGameCards where card.HasInGamePosition where card.InGamePosition.YPos == currentRowNr where card.InGamePosition.XPos == column select card).FirstOrDefault(); if (inGameCard == null) { inGameCard = new EmptyCardViewModel(new PositionViewModel(new Position(column, currentRowNr))); } InGameCardsColumn.Add(inGameCard); } }
public CardRowViewModel(PlayBoardViewModel parent, ushort currentRowNo) { SetColumns(parent, currentRowNo); RowNo = currentRowNo; }