private readonly RackoGameContainer _gameContainer; //if not needed, delete. public RackoMainViewModel(CommandContainer commandContainer, RackoMainGameClass mainGame, RackoVMData viewModel, BasicData basicData, TestOptions test, IGamePackageResolver resolver, RackoGameContainer gameContainer ) : base(commandContainer, mainGame, viewModel, basicData, test, resolver) { _mainGame = mainGame; _model = viewModel; _gameContainer = gameContainer; _model.Deck1.NeverAutoDisable = true; }
private int _previousUse; //for computer ai. public RackoMainGameClass(IGamePackageResolver mainContainer, IEventAggregator aggregator, BasicData basicData, TestOptions test, RackoVMData currentMod, IMultiplayerSaveState state, IAsyncDelayer delay, ICardInfo <RackoCardInformation> cardInfo, CommandContainer command, RackoGameContainer gameContainer, RackoDelegates delegates) : base(mainContainer, aggregator, basicData, test, currentMod, state, delay, cardInfo, command, gameContainer) { _model = currentMod; _command = command; _gameContainer = gameContainer; delegates.PlayerCount = (() => SaveRoot.PlayerList.Count); }
private void PopulateControls(RackoGameContainer gameContainer) { _thisStack !.Children.Clear(); int starts = gameContainer.PlayerList.Count() + 2; int diffs = starts; var tempList = _cardList !.ToRegularDeckDict(); tempList.Reverse(); int x; CustomBasicList <int> otherList = new CustomBasicList <int>(); for (x = 1; x <= 10; x++) { otherList.Add(starts); starts += diffs; } otherList.Reverse(); foreach (var thisCard in tempList) { Grid thisGrid = new Grid(); thisGrid.DataContext = thisCard; // i think GridHelper.AddPixelColumn(thisGrid, 100); GridHelper.AddAutoColumns(thisGrid, 1); var thisLabel = SharedUIFunctions.GetDefaultLabel(); thisLabel.HorizontalAlignment = HorizontalAlignment.Center; thisLabel.VerticalAlignment = VerticalAlignment.Center; thisLabel.Text = otherList[tempList.IndexOf(thisCard)].ToString(); thisLabel.FontSize = 40; thisLabel.Margin = new Thickness(0, 3, 0, 0); GridHelper.AddControlToGrid(thisGrid, thisLabel, 0, 0); CardGraphicsWPF graphics = new CardGraphicsWPF(); graphics.SendSize("", thisCard); //hopefully this simple. GridHelper.AddControlToGrid(thisGrid, graphics, 0, 1); RowClickerWPF custom = new RowClickerWPF(); custom.Command = _thisCommand !; custom.CommandParameter = thisCard; //custom.Name = nameof(RackoMainViewModel.PlayOnPileAsync); //custom.Command = mainGame.ThisMod!.PlayOnPileCommand; GridHelper.AddControlToGrid(thisGrid, custom, 0, 0); Grid.SetColumnSpan(custom, 2); // so it spans the entire control. _thisStack.Children.Add(thisGrid); } }
private void PopulateControls(RackoGameContainer mainGame) { _thisStack !.Children.Clear(); int starts = mainGame.PlayerList.Count() + 2; int diffs = starts; var tempList = _cardList !.ToRegularDeckDict(); tempList.Reverse(); int x; CustomBasicList <int> otherList = new CustomBasicList <int>(); for (x = 1; x <= 10; x++) { otherList.Add(starts); starts += diffs; } otherList.Reverse(); foreach (var thisCard in tempList) { Grid thisGrid = new Grid(); thisGrid.BindingContext = thisCard; // i think GridHelper.AddPixelColumn(thisGrid, 100); GridHelper.AddAutoColumns(thisGrid, 1); var thisLabel = GetDefaultLabel(); thisLabel.HorizontalOptions = LayoutOptions.Center; thisLabel.VerticalOptions = LayoutOptions.Center; thisLabel.Text = otherList[tempList.IndexOf(thisCard)].ToString(); thisLabel.FontSize = 40; thisLabel.Margin = new Thickness(0, 3, 0, 0); GridHelper.AddControlToGrid(thisGrid, thisLabel, 0, 0); CardGraphicsXF ThisGraphics = new CardGraphicsXF(); ThisGraphics.SendSize("", thisCard); //hopefully this simple. GridHelper.AddControlToGrid(thisGrid, ThisGraphics, 0, 1); RowClickerXF custom = new RowClickerXF(); custom.Command = _thisCommand !; custom.CommandParameter = thisCard; GridHelper.AddControlToGrid(thisGrid, custom, 0, 0); Grid.SetColumnSpan(custom, 2); // so it spans the entire control. _thisStack.Children.Add(thisGrid); } }
public void Init(RackoMainViewModel viewModel, RackoVMData model, RackoGameContainer gameContainer) { gameContainer.SingleInfo = gameContainer !.PlayerList !.GetSelf(); _cardList = gameContainer.SingleInfo.MainHandList; _thisCommand = viewModel.GetBasicGameCommand(nameof(RackoMainViewModel.PlayOnPileAsync)); Grid mainGrid = new Grid(); _thisStack = new StackLayout(); Text = "Your Card List"; var thisRect = ThisFrame.GetControlArea(); _thisStack.Margin = new Thickness(thisRect.Left + 3, thisRect.Top + 10, 3, 3); if (gameContainer.SingleInfo.MainHandList.Count != 10) { throw new BasicBlankException("Must have 10 cards before i can init. Rethink now."); } _thisCommand !.CanExecuteChanged += ThisCommand_CanExecuteChanged; _cardList.CollectionChanged += CardList_CollectionChanged; PopulateControls(gameContainer); mainGrid.Children.Add(ThisDraw); mainGrid.Children.Add(_thisStack); Content = mainGrid; }
private readonly RackoUI _handWPF; //use this instead. public RackoMainView(IEventAggregator aggregator, TestOptions test, RackoVMData model, RackoGameContainer gameContainer ) { _aggregator = aggregator; _model = model; _gameContainer = gameContainer; _aggregator.Subscribe(this); _deckGPile = new BaseDeckWPF <RackoCardInformation, RackoGraphicsCP, CardGraphicsWPF>(); _discardGPile = new BasePileWPF <RackoCardInformation, RackoGraphicsCP, CardGraphicsWPF>(); _score = new ScoreBoardWPF(); _currentWPF = new BasePileWPF <RackoCardInformation, RackoGraphicsCP, CardGraphicsWPF>(); _handWPF = new RackoUI(); StackPanel mainStack = new StackPanel(); ParentSingleUIContainer?restoreP = null; if (test.SaveOption == EnumTestSaveCategory.RestoreOnly) { restoreP = new ParentSingleUIContainer() { Name = nameof(RackoMainViewModel.RestoreScreen) }; } Grid finalGrid = new Grid(); AddAutoRows(finalGrid, 1); AddAutoColumns(finalGrid, 2); mainStack.Children.Add(_deckGPile); mainStack.Children.Add(_discardGPile); // can reposition or not even have as well. mainStack.Children.Add(_currentWPF); var thisBut = GetGamingButton("Discard Current Card", nameof(RackoMainViewModel.DiscardCurrentAsync)); mainStack.Children.Add(thisBut); SimpleLabelGrid firstInfo = new SimpleLabelGrid(); firstInfo.AddRow("Turn", nameof(RackoMainViewModel.NormalTurn)); firstInfo.AddRow("Status", nameof(RackoMainViewModel.Status)); mainStack.Children.Add(firstInfo.GetContent); thisBut = GetGamingButton("Racko", nameof(RackoMainViewModel.RackoAsync)); mainStack.Children.Add(thisBut); AddControlToGrid(finalGrid, mainStack, 0, 0); _score.AddColumn("Score Round", true, nameof(RackoPlayerItem.ScoreRound)); _score.AddColumn("Score Game", true, nameof(RackoPlayerItem.TotalScore)); int x; for (x = 1; x <= 10; x++) { _score.AddColumn("Section" + x, false, "Value" + x, nameof(RackoPlayerItem.CanShowValues));// 2 bindings. } mainStack.Children.Add(_score); _handWPF = new RackoUI(); AddControlToGrid(finalGrid, _handWPF, 0, 1); // first column _deckGPile.Margin = new Thickness(5, 5, 5, 5); _discardGPile.Margin = new Thickness(5, 5, 5, 5); if (restoreP != null) { mainStack.Children.Add(restoreP); //default add to grid but does not have to. } Content = finalGrid; }
private readonly RackoUI _handWPF; //use this instead. public RackoMainView(IEventAggregator aggregator, TestOptions test, RackoVMData model, RackoGameContainer gameContainer ) { _aggregator = aggregator; _model = model; _aggregator.Subscribe(this); _gameContainer = gameContainer; _deckGPile = new BaseDeckXF <RackoCardInformation, RackoGraphicsCP, CardGraphicsXF>(); _discardGPile = new BasePileXF <RackoCardInformation, RackoGraphicsCP, CardGraphicsXF>(); _score = new ScoreBoardXF(); _currentWPF = new BasePileXF <RackoCardInformation, RackoGraphicsCP, CardGraphicsXF>(); _handWPF = new RackoUI(); ParentSingleUIContainer?restoreP = null; if (test.SaveOption == EnumTestSaveCategory.RestoreOnly) { restoreP = new ParentSingleUIContainer(nameof(RackoMainViewModel.RestoreScreen)); } Grid finalGrid = new Grid(); AddAutoRows(finalGrid, 2); AddLeftOverColumn(finalGrid, 1); AddAutoColumns(finalGrid, 1); _score.AddColumn("Score Round", true, nameof(RackoPlayerItem.ScoreRound)); _score.AddColumn("Score Game", true, nameof(RackoPlayerItem.TotalScore)); int x; for (x = 1; x <= 10; x++) { _score.AddColumn("Section" + x, false, "Value" + x, nameof(RackoPlayerItem.CanShowValues));// 2 bindings. } SimpleLabelGridXF firstInfo = new SimpleLabelGridXF(); firstInfo.AddRow("Turn", nameof(RackoMainViewModel.NormalTurn)); firstInfo.AddRow("Status", nameof(RackoMainViewModel.Status)); var stack = new StackLayout(); stack.Children.Add(_deckGPile); stack.Children.Add(_discardGPile); // can reposition or not even have as well. stack.Children.Add(_currentWPF); var thisBut = GetSmallerButton("Discard Current Card", nameof(RackoMainViewModel.DiscardCurrentAsync)); stack.Children.Add(thisBut); stack.Children.Add(firstInfo.GetContent); thisBut = GetSmallerButton("Racko", nameof(RackoMainViewModel.RackoAsync)); stack.Children.Add(thisBut); AddControlToGrid(finalGrid, stack, 0, 0); AddControlToGrid(finalGrid, _handWPF, 0, 1); // first column AddControlToGrid(finalGrid, _score, 1, 0); Grid.SetColumnSpan(_score, 2); _deckGPile.Margin = new Thickness(5, 5, 5, 5); _discardGPile.Margin = new Thickness(5, 5, 5, 5); if (restoreP != null) { stack.Children.Add(restoreP); //default add to grid but does not have to. } GamePackageViewModelBinder.ManuelElements.Clear(); //often times i have to add manually. RackoSaveInfo save = cons !.Resolve <RackoSaveInfo>(); //usually needs this part for multiplayer games. _score !.LoadLists(save.PlayerList); _discardGPile !.Init(_model.Pile1 !, ""); // may have to be here (well see) _discardGPile.StartListeningDiscardPile(); // its the main one. _deckGPile !.Init(_model.Deck1 !, ""); // try here. may have to do something else as well (?) _deckGPile.StartListeningMainDeck(); _currentWPF !.Init(_model.OtherPile !, ""); _currentWPF.StartAnimationListener("otherpile"); Content = finalGrid; }