/// <summary> /// /// </summary> /// <param name="element">the unique parts</param> /// <returns>this is supposed to be the content you set.</returns> internal static StackLayout GetFinalStack(View element, FluxxVMData model, ActionContainer actionContainer, KeeperContainer keeperContainer) { StackLayout mainStack = new StackLayout(); Grid tempGrid = new Grid(); tempGrid.Margin = new Thickness(3, 3, 3, 5); AddLeftOverColumn(tempGrid, 50); AddLeftOverColumn(tempGrid, 50); AddAutoColumns(tempGrid, 1); var currentCard = new ShowCardUI(model, actionContainer, keeperContainer, EnumShowCategory.MainAction); currentCard.WidthRequest = 700; AddControlToGrid(tempGrid, currentCard, 0, 0); var actionCard = new ShowCardUI(model, actionContainer, keeperContainer, EnumShowCategory.CurrentAction); AddControlToGrid(tempGrid, actionCard, 0, 1); actionCard.WidthRequest = 700; // since it does not seem to autosize. GoalHandXF goal1 = new GoalHandXF(); goal1.LoadList(actionContainer.PrivateGoals !, ""); AddControlToGrid(tempGrid, goal1, 0, 2); mainStack.Children.Add(tempGrid); tempGrid = new Grid(); AddLeftOverColumn(tempGrid, 50); AddLeftOverColumn(tempGrid, 50); var yourCards = new FluxxHandXF(); yourCards.LoadList(actionContainer.YourCards !, ""); AddControlToGrid(tempGrid, yourCards, 0, 0); var yourKeepers = new KeeperHandXF(); yourKeepers.MinimumWidthRequest = 400; yourKeepers.LoadList(actionContainer.YourKeepers !, ""); AddControlToGrid(tempGrid, yourKeepers, 0, 1); tempGrid.Margin = new Thickness(3, 3, 3, 5); mainStack.Children.Add(tempGrid); mainStack.Children.Add(element); return(mainStack); }
public KeeperBaseView(FluxxGameContainer gameContainer, KeeperContainer keeperContainer, ActionContainer actionContainer, FluxxVMData model ) { _grid = new Grid(); GameContainer = gameContainer; KeeperContainer = keeperContainer; ActionContainer = actionContainer; _model = model; if (gameContainer.PlayerList.Count() <= 3) { AddAutoRows(_grid, 3); } else { AddAutoRows(_grid, 4); } if (gameContainer.PlayerList.Count() == 2 || gameContainer.PlayerList.Count() == 4) { AddLeftOverColumn(_grid, 50); AddLeftOverColumn(_grid, 50); } else { AddLeftOverColumn(_grid, 33); AddLeftOverColumn(_grid, 33); AddLeftOverColumn(_grid, 33); } var list = gameContainer.PlayerList !.GetAllPlayersStartingWithSelf(); var card = new ShowCardUI(_model, actionContainer, keeperContainer, EnumShowCategory.KeeperScreen); card.WidthRequest = 1000; AddControlToGrid(_grid, card, 0, 0); Grid.SetColumnSpan(card, 3); card.HorizontalOptions = LayoutOptions.Start; card.VerticalOptions = LayoutOptions.Start; //hopefully it works when overrided version runs the methods for button and process. Button button; if (KeeperCategory == EnumKeeperCategory.Show) { button = GetGamingButton("Close Keeper Screen", nameof(KeeperShowViewModel.CloseKeeperAsync)); AddControlToGrid(_grid, button, _grid.RowDefinitions.Count - 1, 0); } else if (KeeperCategory == EnumKeeperCategory.Process) { button = GetGamingButton(keeperContainer.ButtonText, CommandText); AddControlToGrid(_grid, button, _grid.RowDefinitions.Count - 1, 0); } else { throw new BasicBlankException("Keeper category not supported. Rethink"); } Grid.SetColumnSpan(button, 3); int x = 0; int row = 0; int column = 0; foreach (var player in list) { x += 1; if (x == 1 && player.PlayerCategory != EnumPlayerCategory.Self) { throw new Exception("Failed to do self first"); } KeeperHandXF hand = new KeeperHandXF(); var keeper = keeperContainer.GetKeeperHand(player); hand.LoadList(keeper, ""); if (x == 1) { row = 1; column = 0; } else if (x == 2) { row = 1; column = 1; } else if (x == 3 && gameContainer.PlayerList.Count() == 4) { row = 2; column = 0; } else if (x == 3) { row = 1; column = 2; } else if (x == 4 && gameContainer.PlayerList.Count() == 4) { row = 2; column = 1; } else if (x == 4) { row = 2; column = 0; } else if (x == 5) { row = 2; column = 1; } else if (x == 6) { row = 2; column = 2; } hand.MinimumWidthRequest = 300; AddControlToGrid(_grid, hand, row, column); } Content = _grid; }