public SnakesAndLaddersMainView(IEventAggregator aggregator, TestOptions test, SnakesAndLaddersMainGameClass mainGame, SnakesAndLaddersVMData model ) { _aggregator = aggregator; _mainGame = mainGame; _model = model; _aggregator.Subscribe(this); StackLayout mainStack = new StackLayout(); ParentSingleUIContainer?restoreP = null; if (test.SaveOption == EnumTestSaveCategory.RestoreOnly) { restoreP = new ParentSingleUIContainer(nameof(SnakesAndLaddersMainViewModel.RestoreScreen)); } _privateBoard = new GameboardXF(); _privateBoard.Margin = new Thickness(5, 5, 5, 5); _privateBoard.HorizontalOptions = LayoutOptions.Start; _privateBoard.VerticalOptions = LayoutOptions.Start; mainStack.Children.Add(_privateBoard); var thisRoll = GetGamingButton("Roll Dice", nameof(SnakesAndLaddersMainViewModel.RollDiceAsync)); StackLayout otherStack = new StackLayout(); otherStack.Orientation = StackOrientation.Horizontal; _diceControl = new DiceListControlXF <SimpleDice>(); otherStack.Children.Add(thisRoll); _pieceTurn = new GamePieceXF(); if (ScreenUsed == EnumScreen.SmallPhone) { _pieceTurn.WidthRequest = 40; _pieceTurn.HeightRequest = 40; } else { _pieceTurn.WidthRequest = 90; _pieceTurn.HeightRequest = 90; } _pieceTurn.Margin = new Thickness(10, 0, 0, 0); _pieceTurn.NeedsSubscribe = false; // won't notify in this case. just let them know when new turn. otherwise, when this number changes, it will trigger for the gameboard (which is not good) _pieceTurn.Init(); otherStack.Children.Add(_pieceTurn); otherStack.Children.Add(_diceControl); mainStack.Children.Add(otherStack); SimpleLabelGridXF firstInfo = new SimpleLabelGridXF(); firstInfo.AddRow("Turn", nameof(SnakesAndLaddersMainViewModel.NormalTurn)); firstInfo.AddRow("Status", nameof(SnakesAndLaddersMainViewModel.Status)); mainStack.Children.Add(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 SnakesAndLaddersMainView(IEventAggregator aggregator, TestOptions test, SnakesAndLaddersMainGameClass mainGame, SnakesAndLaddersVMData model ) { _aggregator = aggregator; _mainGame = mainGame; _model = model; _aggregator.Subscribe(this); StackPanel mainStack = new StackPanel(); ParentSingleUIContainer?restoreP = null; if (test.SaveOption == EnumTestSaveCategory.RestoreOnly) { restoreP = new ParentSingleUIContainer() { Name = nameof(SnakesAndLaddersMainViewModel.RestoreScreen) }; } _privateBoard = new GameboardWPF(); _privateBoard.Margin = new Thickness(5, 5, 5, 5); _privateBoard.HorizontalAlignment = HorizontalAlignment.Left; _privateBoard.VerticalAlignment = VerticalAlignment.Top; mainStack.Children.Add(_privateBoard); var thisRoll = GetGamingButton("Roll Dice", nameof(SnakesAndLaddersMainViewModel.RollDiceAsync)); StackPanel otherStack = new StackPanel(); otherStack.Orientation = Orientation.Horizontal; _diceControl = new DiceListControlWPF <SimpleDice>(); otherStack.Children.Add(thisRoll); _pieceTurn = new GamePieceWPF(); _pieceTurn.Width = 80; _pieceTurn.Height = 80; // try this way. _pieceTurn.Margin = new Thickness(10, 0, 0, 0); _pieceTurn.NeedsSubscribe = false; // won't notify in this case. just let them know when new turn. otherwise, when this number changes, it will trigger for the gameboard (which is not good) _pieceTurn.Init(); otherStack.Children.Add(_pieceTurn); otherStack.Children.Add(_diceControl); mainStack.Children.Add(otherStack); SimpleLabelGrid firstInfo = new SimpleLabelGrid(); firstInfo.AddRow("Turn", nameof(SnakesAndLaddersMainViewModel.NormalTurn)); firstInfo.AddRow("Status", nameof(SnakesAndLaddersMainViewModel.Status)); mainStack.Children.Add(firstInfo.GetContent); if (restoreP != null) { mainStack.Children.Add(restoreP); //default add to grid but does not have to. } Content = mainStack; }
public SnakesAndLaddersMainGameClass(IGamePackageResolver resolver, IEventAggregator aggregator, BasicData basic, TestOptions test, SnakesAndLaddersVMData model, IMultiplayerSaveState state, IAsyncDelayer delay, CommandContainer command, StandardRollProcesses <SimpleDice, SnakesAndLaddersPlayerItem> roll, GameBoardProcesses gameBoard1, BasicGameContainer <SnakesAndLaddersPlayerItem, SnakesAndLaddersSaveInfo> gameContainer ) : base(resolver, aggregator, basic, test, model, state, delay, command, gameContainer) { _test = test; _model = model; Roll = roll; GameBoard1 = gameBoard1; Roll.AfterRollingAsync = AfterRollingAsync; //hopefully this simple. roll.CurrentPlayer = GetCurrentPlayer; GameBoard1.CurrentPlayer = GetCurrentPlayer; }
public GameBoardProcesses(IAsyncDelayer delay, EventAggregator aggregator, BasicData basicData, TestOptions test, SnakesAndLaddersVMData model ) { //_mainGame = mainGame; _delay = delay; _aggregator = aggregator; _basicData = basicData; _test = test; _model = model; _spaceList = new Dictionary <int, SpaceInfo>(); int x; for (x = 1; x <= 100; x++) { SpaceInfo thisSpace = new SpaceInfo(); thisSpace.JumpTo = x; if (x == 4) { thisSpace.JumpTo = 39; } else if (x == 30) { thisSpace.JumpTo = 12; } else if (x == 33) { thisSpace.JumpTo = 52; } else if (x == 36) { thisSpace.JumpTo = 8; } else if (x == 59) { thisSpace.JumpTo = 63; } else if (x == 70) { thisSpace.JumpTo = 50; } else if (x == 26) { thisSpace.JumpTo = 75; } else if (x == 73) { thisSpace.JumpTo = 93; } else if (x == 86) { thisSpace.JumpTo = 57; } else if (thisSpace.JumpTo == 99) { thisSpace.JumpTo = 42; } _spaceList.Add(x, thisSpace); } }