public void LoadControls(Button predictionButton, Button accusationButton, ClueBoardGameGameContainer gameContainer) { Grid thisGrid = new Grid(); AddAutoRows(thisGrid, 2); AddAutoColumns(thisGrid, 3); thisGrid.RowSpacing = 0; thisGrid.ColumnSpacing = 0; StackLayout firstRow = new StackLayout(); StackLayout secondRow = new StackLayout(); StackLayout thirdRow = new StackLayout(); AddControlToGrid(thisGrid, firstRow, 0, 0); Grid.SetRowSpan(firstRow, 2); AddControlToGrid(thisGrid, secondRow, 0, 1); AddControlToGrid(thisGrid, thirdRow, 0, 2); StackLayout finalStack = new StackLayout(); AddControlToGrid(thisGrid, finalStack, 1, 1); Grid.SetColumnSpan(finalStack, 2); finalStack.Children.Add(predictionButton); finalStack.Children.Add(accusationButton); GamePackageViewModelBinder.ManuelElements.Add(predictionButton); GamePackageViewModelBinder.ManuelElements.Add(accusationButton); var thisList = gameContainer.DetectiveList.Values.Where(items => items.Category == EnumCardType.IsRoom).ToCustomBasicList(); Button thisBut; var thisLabel = GetLabel(EnumCardType.IsRoom); firstRow.Children.Add(thisLabel); thisList.ForEach(thisItem => { thisBut = GetButton(thisItem); firstRow.Children.Add(thisBut); }); thisList = gameContainer.DetectiveList.Values.Where(items => items.Category == EnumCardType.IsCharacter).ToCustomBasicList(); thisLabel = GetLabel(EnumCardType.IsCharacter); secondRow.Children.Add(thisLabel); thisList.ForEach(thisItem => { thisBut = GetButton(thisItem); secondRow.Children.Add(thisBut); }); thisList = gameContainer.DetectiveList.Values.Where(items => items.Category == EnumCardType.IsWeapon).ToCustomBasicList(); thisLabel = GetLabel(EnumCardType.IsWeapon); thirdRow.Children.Add(thisLabel); thisList.ForEach(thisItem => { thisBut = GetButton(thisItem); thirdRow.Children.Add(thisBut); }); Content = thisGrid; }
public ClueBoardGameMainGameClass(IGamePackageResolver resolver, IEventAggregator aggregator, BasicData basic, TestOptions test, ClueBoardGameVMData model, IMultiplayerSaveState state, IAsyncDelayer delay, CommandContainer command, ClueBoardGameGameContainer container, GameBoardProcesses gameBoard, StandardRollProcesses <SimpleDice, ClueBoardGamePlayerItem> roller ) : base(resolver, aggregator, basic, test, model, state, delay, command, container, roller) { _model = model; _command = command; _gameBoard = gameBoard; CanPrepTurnOnSaved = false; _gameContainer = container; }
public void LoadControls(ClueBoardGameGameContainer gameContainer) { StackPanel firstStack = new StackPanel(); firstStack.Orientation = Orientation.Horizontal; StackPanel firstRow = new StackPanel(); StackPanel secondRow = new StackPanel(); StackPanel thirdRow = new StackPanel(); firstStack.Children.Add(firstRow); firstStack.Children.Add(secondRow); firstStack.Children.Add(thirdRow); var thisList = gameContainer.DetectiveList.Values.Where(items => items.Category == EnumCardType.IsRoom).ToCustomBasicList(); Button thisBut; var thisLabel = GetLabel(EnumCardType.IsRoom); firstRow.Children.Add(thisLabel); thisList.ForEach(thisItem => { thisBut = GetButton(thisItem); firstRow.Children.Add(thisBut); }); thisList = gameContainer.DetectiveList.Values.Where(items => items.Category == EnumCardType.IsCharacter).ToCustomBasicList(); thisLabel = GetLabel(EnumCardType.IsCharacter); secondRow.Children.Add(thisLabel); thisList.ForEach(thisItem => { thisBut = GetButton(thisItem); secondRow.Children.Add(thisBut); }); thisList = gameContainer.DetectiveList.Values.Where(items => items.Category == EnumCardType.IsWeapon).ToCustomBasicList(); thisLabel = GetLabel(EnumCardType.IsWeapon); thirdRow.Children.Add(thisLabel); thisList.ForEach(thisItem => { thisBut = GetButton(thisItem); thirdRow.Children.Add(thisBut); }); Content = firstStack; }
public void LoadControls(ClueBoardGameGameContainer gameContainer) { StackPanel firstStack = new StackPanel(); firstStack.Orientation = Orientation.Horizontal; StackPanel firstRow = new StackPanel(); StackPanel secondRow = new StackPanel(); StackPanel thirdRow = new StackPanel(); firstStack.Children.Add(firstRow); firstStack.Children.Add(secondRow); firstStack.Children.Add(thirdRow); var thisList = gameContainer.DetectiveList.Values.Where(items => items.Category == EnumCardType.IsRoom).ToCustomBasicList(); Button thisBut; thisList.ForEach(thisItem => { thisBut = GetButton(thisItem); firstRow.Children.Add(thisBut); }); thisList = gameContainer.DetectiveList.Values.Where(items => items.Category == EnumCardType.IsCharacter).ToCustomBasicList(); thisList.ForEach(thisItem => { thisBut = GetButton(thisItem); secondRow.Children.Add(thisBut); }); thisList = gameContainer.DetectiveList.Values.Where(items => items.Category == EnumCardType.IsWeapon).ToCustomBasicList(); if (thisList.Count != 6) { throw new BasicBlankException("There has to be 6 weapons when loading controls"); } thisList.ForEach(thisItem => { thisBut = GetButton(thisItem); thirdRow.Children.Add(thisBut); }); Content = firstStack; }
public ClueBoardGameMainViewModel(CommandContainer commandContainer, ClueBoardGameMainGameClass mainGame, ClueBoardGameVMData model, BasicData basicData, TestOptions test, IGamePackageResolver resolver, IStandardRollProcesses roller, ClueBoardGameGameContainer gameContainer, GameBoardProcesses gameBoard ) : base(commandContainer, mainGame, model, basicData, test, resolver, roller) { _mainGame = mainGame; _model = model; _basicData = basicData; _gameContainer = gameContainer; _gameBoard = gameBoard; _gameContainer.SpaceClickedAsync = MoveSpaceAsync; _gameContainer.RoomClickedAsync = MoveRoomAsync; _model.Pile.SendEnableProcesses(this, () => false); _model.HandList.ObjectClickedAsync += HandList_ObjectClickedAsync; _model.HandList.SendEnableProcesses(this, () => _mainGame.SaveRoot.GameStatus == EnumClueStatusList.FindClues); }
public GameBoardGraphicsCP(ClueBoardGameGameContainer gameContainer) : base(gameContainer.Resolver) { _gameContainer = gameContainer; InitializeRooms(); InitializeSquares(); }
public ClueBoardGameMainView(IEventAggregator aggregator, TestOptions test, ClueBoardGameVMData model, GameBoardGraphicsCP graphicsCP, IGamePackageRegister register, ClueBoardGameMainGameClass mainGame, ClueBoardGameGameContainer gameContainer ) { _mainGame = mainGame; _gameContainer = gameContainer; _aggregator = aggregator; _model = model; _aggregator.Subscribe(this); register.RegisterControl(_board.ThisElement, ""); graphicsCP.LinkBoard(); _piece = new PawnPiecesXF <EnumColorChoice>(); _piece.HeightRequest = 80; _piece.WidthRequest = 80; _piece.Init(); _pile = new BasePileXF <CardInfo, CardCP, CardXF>(); _hand = new BaseHandXF <CardInfo, CardCP, CardXF>(); _detective = new DetectiveNotebookXF(); _prediction = new PredictionAccusationXF(); StackLayout mainStack = new StackLayout(); ParentSingleUIContainer?restoreP = null; if (test.SaveOption == EnumTestSaveCategory.RestoreOnly) { restoreP = new ParentSingleUIContainer(nameof(ClueBoardGameMainViewModel.RestoreScreen)); } _predictionButton = GetSmallerButton("Predict", nameof(ClueBoardGameMainViewModel.MakePredictionAsync)); _accusationButton = GetSmallerButton("Accusation", nameof(ClueBoardGameMainViewModel.MakeAccusationAsync)); StackLayout firstStack = new StackLayout(); firstStack.Orientation = StackOrientation.Horizontal; firstStack.Children.Add(_board); firstStack.Children.Add(_piece); mainStack.Children.Add(firstStack); Grid tempGrid = new Grid(); AddLeftOverColumn(tempGrid, 50); AddLeftOverColumn(tempGrid, 50); AddAutoColumns(tempGrid, 1); mainStack.Children.Add(tempGrid); AddControlToGrid(tempGrid, _prediction, 0, 0); _board.HorizontalOptions = LayoutOptions.Start; _board.VerticalOptions = LayoutOptions.Start; Label label = new Label(); label.FontSize = 30; label.TextColor = Color.White; label.FontAttributes = FontAttributes.Bold; label.SetBinding(Label.TextProperty, new Binding(nameof(ClueBoardGameMainViewModel.LeftToMove))); StackLayout tempStack = new StackLayout(); var thisRoll = GetSmallerButton("Roll Dice", nameof(ClueBoardGameMainViewModel.RollDiceAsync)); _diceControl = new DiceListControlXF <SimpleDice>(); var endButton = GetSmallerButton("End Turn", nameof(ClueBoardGameMainViewModel.EndTurnAsync)); endButton.HorizontalOptions = LayoutOptions.Start; tempStack.Children.Add(label); tempStack.Children.Add(thisRoll); tempStack.Children.Add(endButton); tempStack.Children.Add(_pile); tempStack.Children.Add(_diceControl); AddControlToGrid(tempGrid, _detective, 0, 1); AddControlToGrid(tempGrid, tempStack, 0, 2); SimpleLabelGridXF firstInfo = new SimpleLabelGridXF(); firstInfo.AddRow("Turn", nameof(ClueBoardGameMainViewModel.NormalTurn)); firstInfo.AddRow("Instructions", nameof(ClueBoardGameMainViewModel.Instructions)); _details = firstInfo.GetContent; 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 = mainStack; }
public void LoadControls(BaseHandXF <CardInfo, CardCP, CardXF> hand, Grid details, ClueBoardGameGameContainer gameContainer) { Grid thisGrid = new Grid(); AddAutoRows(thisGrid, 3); AddAutoColumns(thisGrid, 2); thisGrid.RowSpacing = 0; thisGrid.ColumnSpacing = 0; StackLayout firstRow = new StackLayout(); StackLayout secondRow = new StackLayout(); StackLayout thirdRow = new StackLayout(); AddControlToGrid(thisGrid, firstRow, 0, 0); Grid.SetRowSpan(firstRow, 2); AddControlToGrid(thisGrid, secondRow, 0, 1); AddControlToGrid(thisGrid, thirdRow, 0, 2); StackLayout finalStack = new StackLayout(); finalStack.Children.Add(hand); finalStack.Children.Add(details); AddControlToGrid(thisGrid, finalStack, 1, 1); Grid.SetColumnSpan(finalStack, 2); var thisList = gameContainer.DetectiveList.Values.Where(items => items.Category == EnumCardType.IsRoom).ToCustomBasicList(); Button thisBut; thisList.ForEach(thisItem => { thisBut = GetButton(thisItem); firstRow.Children.Add(thisBut); }); thisList = gameContainer.DetectiveList.Values.Where(items => items.Category == EnumCardType.IsCharacter).ToCustomBasicList(); thisList.ForEach(thisItem => { thisBut = GetButton(thisItem); secondRow.Children.Add(thisBut); }); thisList = gameContainer.DetectiveList.Values.Where(items => items.Category == EnumCardType.IsWeapon).ToCustomBasicList(); if (thisList.Count != 6) { throw new BasicBlankException("There has to be 6 weapons when loading controls"); } thisList.ForEach(thisItem => { thisBut = GetButton(thisItem); thirdRow.Children.Add(thisBut); }); Content = thisGrid; }
public ClueBoardGameMainView(IEventAggregator aggregator, TestOptions test, ClueBoardGameVMData model, GameBoardGraphicsCP graphicsCP, IGamePackageRegister register, ClueBoardGameMainGameClass mainGame, ClueBoardGameGameContainer gameContainer ) { _mainGame = mainGame; _gameContainer = gameContainer; _aggregator = aggregator; _model = model; _aggregator.Subscribe(this); register.RegisterControl(_board.ThisElement, ""); graphicsCP.LinkBoard(); _piece = new PawnPiecesWPF <EnumColorChoice>(); _piece.Height = 60; _piece.Width = 60; _piece.Init(); _pile = new BasePileWPF <CardInfo, CardCP, CardWPF>(); _hand = new BaseHandWPF <CardInfo, CardCP, CardWPF>(); _detective = new DetectiveNotebookWPF(); _prediction = new PredictionAccusationWPF(); StackPanel mainStack = new StackPanel(); StackPanel finalStack = new StackPanel() { Orientation = Orientation.Horizontal }; ParentSingleUIContainer?restoreP = null; if (test.SaveOption == EnumTestSaveCategory.RestoreOnly) { restoreP = new ParentSingleUIContainer() { Name = nameof(ClueBoardGameMainViewModel.RestoreScreen) }; } var thisRoll = GetGamingButton("Roll Dice", nameof(ClueBoardGameMainViewModel.RollDiceAsync)); var preButton = GetGamingButton("Predict", nameof(ClueBoardGameMainViewModel.MakePredictionAsync)); var accusationButton = GetGamingButton("Accusation", nameof(ClueBoardGameMainViewModel.MakeAccusationAsync)); StackPanel otherStack = new StackPanel(); otherStack.Orientation = Orientation.Horizontal; _diceControl = new DiceListControlWPF <SimpleDice>(); var endButton = GetGamingButton("End Turn", nameof(ClueBoardGameMainViewModel.EndTurnAsync)); endButton.HorizontalAlignment = HorizontalAlignment.Left; SimpleLabelGrid firstInfo = new SimpleLabelGrid(); firstInfo.AddRow("Turn", nameof(ClueBoardGameMainViewModel.NormalTurn)); firstInfo.AddRow("Status", nameof(ClueBoardGameMainViewModel.Status)); StackPanel firstRowStack = new StackPanel(); firstRowStack.Children.Add(_board); otherStack.Children.Add(_piece); otherStack.Children.Add(firstInfo.GetContent); firstRowStack.Children.Add(otherStack); finalStack.Children.Add(firstRowStack); StackPanel secondRowStack = new StackPanel(); finalStack.Children.Add(secondRowStack); StackPanel thirdRowStack = new StackPanel(); finalStack.Children.Add(thirdRowStack); otherStack = new StackPanel(); otherStack.Orientation = Orientation.Horizontal; otherStack.Children.Add(_hand); otherStack.Children.Add(_pile); secondRowStack.Children.Add(otherStack); _prediction.Margin = new Thickness(0, 0, 0, 30); secondRowStack.Children.Add(_prediction); secondRowStack.Children.Add(_detective); AddVerticalLabelGroup("Instructions", nameof(ClueBoardGameMainViewModel.Instructions), thirdRowStack); otherStack = new StackPanel(); otherStack.Orientation = Orientation.Horizontal; otherStack.Children.Add(_diceControl); TextBlock label = new TextBlock(); label.FontSize = 100; label.Foreground = Brushes.White; label.FontWeight = FontWeights.Bold; label.SetBinding(TextBlock.TextProperty, new Binding(nameof(ClueBoardGameMainViewModel.LeftToMove))); otherStack.Children.Add(label); thirdRowStack.Children.Add(otherStack); thirdRowStack.Children.Add(thisRoll); thirdRowStack.Children.Add(preButton); thirdRowStack.Children.Add(accusationButton); thirdRowStack.Children.Add(endButton); var nextInfo = new SimpleLabelGrid(); nextInfo.AddRow("Room", nameof(ClueBoardGameMainViewModel.CurrentRoomName)); nextInfo.AddRow("Character", nameof(ClueBoardGameMainViewModel.CurrentCharacterName)); nextInfo.AddRow("Weapon", nameof(ClueBoardGameMainViewModel.CurrentWeaponName)); thirdRowStack.Children.Add(nextInfo.GetContent); mainStack.Children.Add(finalStack); 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 = mainStack; }
public GameBoardProcesses(ClueBoardGameGameContainer gameContainer, GameBoardGraphicsCP imageBoard) { _gameContainer = gameContainer; _imageBoard = imageBoard; }