private readonly OpetongGameContainer _gameContainer; //if we don't need it, take it out. public OpetongMainGameClass(IGamePackageResolver mainContainer, IEventAggregator aggregator, BasicData basicData, TestOptions test, OpetongVMData currentMod, IMultiplayerSaveState state, IAsyncDelayer delay, ICardInfo <RegularRummyCard> cardInfo, CommandContainer command, OpetongGameContainer gameContainer) : base(mainContainer, aggregator, basicData, test, currentMod, state, delay, cardInfo, command, gameContainer) { _model = currentMod; _command = command; _gameContainer = gameContainer; _gameContainer.DrawFromPoolAsync = DrawFromPoolAsync; }
public OpetongMainViewModel(CommandContainer commandContainer, OpetongMainGameClass mainGame, OpetongVMData viewModel, BasicData basicData, TestOptions test, IGamePackageResolver resolver ) : base(commandContainer, mainGame, viewModel, basicData, test, resolver) { _mainGame = mainGame; _model = viewModel; var player = _mainGame.PlayerList.GetSelf(); _mainGame.Aggregator.Subscribe(player); //maybe for tempsets, has to be here now. _model.Deck1.NeverAutoDisable = true; _model.TempSets.Init(this); _model.TempSets.ClearBoard(); //try this too. _model.MainSets.SendEnableProcesses(this, () => false); _model.PlayerHand1.AutoSelect = HandObservable <RegularRummyCard> .EnumAutoType.SelectAsMany; _model.TempSets.SetClickedAsync += TempSets_SetClickedAsync; }
public OpetongMainView(IEventAggregator aggregator, TestOptions test, OpetongVMData model ) { _aggregator = aggregator; _model = model; _aggregator.Subscribe(this); _deckGPile = new BaseDeckWPF <RegularRummyCard, ts, DeckOfCardsWPF <RegularRummyCard> >(); _score = new ScoreBoardWPF(); _playerHandWPF = new BaseHandWPF <RegularRummyCard, ts, DeckOfCardsWPF <RegularRummyCard> >(); _tempG = new TempRummySetsWPF <EnumSuitList, EnumColorList, RegularRummyCard, ts, DeckOfCardsWPF <RegularRummyCard> >(); _mainG = new MainRummySetsWPF <EnumSuitList, EnumColorList, RegularRummyCard, ts, DeckOfCardsWPF <RegularRummyCard>, RummySet, SavedSet>(); _poolG = new CardBoardWPF <RegularRummyCard, ts, DeckOfCardsWPF <RegularRummyCard> >(); StackPanel mainStack = new StackPanel(); ParentSingleUIContainer?restoreP = null; if (test.SaveOption == EnumTestSaveCategory.RestoreOnly) { restoreP = new ParentSingleUIContainer() { Name = nameof(OpetongMainViewModel.RestoreScreen) }; } StackPanel otherStack = new StackPanel(); otherStack.Orientation = Orientation.Horizontal; otherStack.Children.Add(_deckGPile); otherStack.Children.Add(_poolG); _poolG.HorizontalAlignment = HorizontalAlignment.Left; _poolG.VerticalAlignment = VerticalAlignment.Top; _tempG.Height = 350; otherStack.Children.Add(_tempG); var button = GetGamingButton("Lay Down Single Set", nameof(OpetongMainViewModel.PlaySetAsync)); otherStack.Children.Add(button); mainStack.Children.Add(otherStack); _score.AddColumn("Cards Left", true, nameof(OpetongPlayerItem.ObjectCount)); //very common. _score.AddColumn("Sets Played", true, nameof(OpetongPlayerItem.SetsPlayed)); _score.AddColumn("Score", true, nameof(OpetongPlayerItem.TotalScore)); SimpleLabelGrid firstInfo = new SimpleLabelGrid(); firstInfo.AddRow("Turn", nameof(OpetongMainViewModel.NormalTurn)); firstInfo.AddRow("Status", nameof(OpetongMainViewModel.Status)); firstInfo.AddRow("Instructions", nameof(OpetongMainViewModel.Instructions)); StackPanel finalStack = new StackPanel(); finalStack.Children.Add(_score); finalStack.Children.Add(firstInfo.GetContent); otherStack.Children.Add(finalStack); mainStack.Children.Add(_playerHandWPF); mainStack.Children.Add(_mainG); _deckGPile.Margin = new Thickness(5, 5, 5, 5); if (restoreP != null) { mainStack.Children.Add(restoreP); //default add to grid but does not have to. } Content = mainStack; }
public OpetongMainView(IEventAggregator aggregator, TestOptions test, OpetongVMData model ) { _aggregator = aggregator; _model = model; _aggregator.Subscribe(this); _deckGPile = new BaseDeckXF <RegularRummyCard, ts, DeckOfCardsXF <RegularRummyCard> >(); _score = new ScoreBoardXF(); _playerHandWPF = new BaseHandXF <RegularRummyCard, ts, DeckOfCardsXF <RegularRummyCard> >(); _tempG = new TempRummySetsXF <EnumSuitList, EnumColorList, RegularRummyCard, ts, DeckOfCardsXF <RegularRummyCard> >(); _mainG = new MainRummySetsXF <EnumSuitList, EnumColorList, RegularRummyCard, ts, DeckOfCardsXF <RegularRummyCard>, RummySet, SavedSet>(); _poolG = new CardBoardXF <RegularRummyCard, ts, DeckOfCardsXF <RegularRummyCard> >(); StackLayout mainStack = new StackLayout(); ParentSingleUIContainer?restoreP = null; if (test.SaveOption == EnumTestSaveCategory.RestoreOnly) { restoreP = new ParentSingleUIContainer(nameof(OpetongMainViewModel.RestoreScreen)); } StackLayout otherStack = new StackLayout(); otherStack.Orientation = StackOrientation.Horizontal; otherStack.Children.Add(_deckGPile); Grid finalGrid = new Grid(); AddLeftOverRow(finalGrid, 50); AddAutoRows(finalGrid, 1); AddLeftOverRow(finalGrid, 50); otherStack.Children.Add(_deckGPile); otherStack.Children.Add(_poolG); otherStack.Children.Add(_tempG); Button button = GetGamingButton($"Lay Down{Constants.vbCrLf}Single Set", nameof(OpetongMainViewModel.PlaySetAsync)); otherStack.Children.Add(button); StackLayout tempStack = new StackLayout(); mainStack.Children.Add(otherStack); _score.AddColumn("Cards Left", true, nameof(OpetongPlayerItem.ObjectCount)); //very common. _score.AddColumn("Sets Played", true, nameof(OpetongPlayerItem.SetsPlayed)); _score.AddColumn("Score", true, nameof(OpetongPlayerItem.TotalScore)); SimpleLabelGridXF firstInfo = new SimpleLabelGridXF(); firstInfo.AddRow("Turn", nameof(OpetongMainViewModel.NormalTurn)); firstInfo.AddRow("Status", nameof(OpetongMainViewModel.Status)); firstInfo.AddRow("Instructions", nameof(OpetongMainViewModel.Instructions)); tempStack.Children.Add(_score); tempStack.Children.Add(firstInfo.GetContent); otherStack.Children.Add(tempStack); AddControlToGrid(finalGrid, otherStack, 0, 0); AddControlToGrid(finalGrid, _playerHandWPF, 1, 0); AddControlToGrid(finalGrid, _mainG, 2, 0); _deckGPile.Margin = new Thickness(5, 5, 5, 5); if (restoreP != null) { //todo: figure out where to place the restore ui if there is a restore option. mainStack.Children.Add(restoreP); //default add to grid but does not have to. } Content = finalGrid; }