public async Task MakeMoveAsync(SpaceInfoCP space) { if (_graphics == null) { throw new BasicBlankException("Graphics was never created. Rethink"); } SingleInfo = SaveRoot !.PlayerList.GetWhoPlayer(); space.Status = SingleInfo.Piece; WinInfo thisWin = SaveRoot.GameBoard.GetWin(); _graphics !.ThisWin = thisWin; if (BasicData !.MultiPlayer == true && SingleInfo.PlayerCategory == EnumPlayerCategory.Self) { await Network !.SendMoveAsync(space); } if (thisWin.WinList.Count > 0) { RepaintBoard(); await ShowWinAsync(); return; } RepaintBoard(); if (thisWin.IsDraw == true) { await ShowTieAsync(); return; } await EndTurnAsync(); }
public override async Task MakeMoveAsync(int column) { if (BasicData !.MultiPlayer == true && SingleInfo !.PlayerCategory == EnumPlayerCategory.Self) { await Network !.SendMoveAsync(column); } Vector topSpace = SaveRoot !.GameBoard[1, column].Vector; SpaceInfoCP tempSpace = new SpaceInfoCP(); tempSpace.Color = SingleInfo !.Color.ToString().ToColor(); tempSpace.Player = WhoTurn; tempSpace.Vector = new Vector(1, column); Vector BottomSpace = SaveRoot.GameBoard.GetBottomSpace(column); await Aggregator.AnimateMovePiecesAsync(topSpace, BottomSpace, tempSpace, true); SaveRoot.GameBoard[BottomSpace].Color = tempSpace.Color; SaveRoot.GameBoard[BottomSpace].Player = WhoTurn; RepaintBoard(); WinInfo thisWin = SaveRoot.GameBoard.GetWin(); if (thisWin.IsDraw == true) { await ShowTieAsync(); return; } if (thisWin.WinList.Count > 0) { RepaintBoard(); await ShowWinAsync(); return; } await EndTurnAsync(); }
async Task IMoveNM.MoveReceivedAsync(string data) { SpaceInfoCP tempMove = await js.DeserializeObjectAsync <SpaceInfoCP>(data); SpaceInfoCP realMove = SaveRoot !.GameBoard[tempMove.Vector]; //i think await MakeMoveAsync(realMove); }
public void SelectSpace(SpaceInfoCP space) { space.AlreadyMarked = true; BingoPlayerItem selfPlayer = _mainGame.PlayerList !.GetSelf(); var thisBingo = selfPlayer.BingoList[space.Vector.Row - 1, space.Vector.Column]; thisBingo.DidGet = true; //hopefully this simple. }
public SpaceXF(SpaceInfoCP space) { ThisDraw.PaintSurface += DrawPaint; _gameBoard1 = Resolve <TicTacToeGraphicsCP>(); this.SetName(nameof(TicTacToeMainViewModel.MakeMoveAsync)); CommandParameter = space; GamePackageViewModelBinder.ManuelElements.Add(this); //hopefully this simple. EventAggregator thisE = Resolve <EventAggregator>(); BindingContext = space; WidthRequest = _gameBoard1.SpaceSize; HeightRequest = _gameBoard1.SpaceSize; thisE.Subscribe(this, EnumRepaintCategories.FromSkiasharpboard.ToString()); }
public async Task MakeMoveAsync(SpaceInfoCP space) { if (_mainGame.SaveRoot.GameBoard.CanMakeMove(space) == false) { await UIPlatform.ShowMessageAsync("Illegal Move"); return; } if (_mainGame.BasicData.MultiPlayer) { await _mainGame.Network !.SendMoveAsync(space); } await _mainGame.MakeMoveAsync(space); }
public SpaceWPF(SpaceInfoCP space) { _thisDraw = new SKElement(); _thisDraw.PaintSurface += DrawPaint; Name = nameof(TicTacToeMainViewModel.MakeMoveAsync); CommandParameter = space; //_thisMod = Resolve<TicTacToeViewModel>(); _gameBoard1 = Resolve <TicTacToeGraphicsCP>(); EventAggregator thisE = Resolve <EventAggregator>(); DataContext = space; Width = _gameBoard1.SpaceSize; Height = _gameBoard1.SpaceSize; thisE.Subscribe(this, EnumRepaintCategories.FromSkiasharpboard.ToString()); GamePackageViewModelBinder.ManuelElements.Add(this); //hopefully this simple. //MouseUp += SpaceWPF_MouseUp; Content = _thisDraw; }
public bool CanSelectSpace(SpaceInfoCP space) { if (space.IsEnabled == false) { return(false); } if (space.AlreadyMarked == true) { return(false); } if (space.Text == "Free") { return(true); } if (space.Text == _mainGame.CurrentInfo !.WhatValue.ToString()) { return(true); } if (_test.AllowAnyMove == true) { return(true); //to quickly test bingos } return(false); }
public async Task MakeMoveAsync(SpaceInfoCP space) { await _mainGame.MakeMoveAsync(space); }
public bool CanMakeMove(SpaceInfoCP space) { return(space.Status == EnumSpaceType.Blank); }
public async Task ColumnAsync(SpaceInfoCP space) { await _mainGame.MakeMoveAsync(space.Vector.Column); }
public bool CanColumn(SpaceInfoCP space) => !_mainGame.SaveRoot.GameBoard.IsFilled(space.Vector.Column);
public void DrawSpace(SKCanvas thisCanvas, SpaceInfoCP thisSpace, float width, float height) { thisCanvas.Clear(); // i think it should clear out not matter what. var thisRect = SKRect.Create(0, 0, width, height); thisCanvas.DrawRect(thisRect, _whitePaint); thisCanvas.DrawRect(thisRect, _blackPen); if (ThisWin.WinList.Count > 0) { var firstSquare = _spaceList[ThisWin.WinList[0].Vector]; var secondSquare = _spaceList[ThisWin.WinList[1].Vector]; var thirdSquare = _spaceList[ThisWin.WinList[2].Vector]; if (thisSpace.Equals(firstSquare) == true || thisSpace.Equals(secondSquare) == true || thisSpace.Equals(thirdSquare) == true) { float firstX = 0; float secondX = 0; float firstY = 0; float secondY = 0; switch (ThisWin.Category) { case EnumWinCategory.LeftRight: { firstY = height / 2; secondY = height / 2; firstX = 0; secondX = width; break; } case EnumWinCategory.TopDown: { firstY = 0; secondY = height; firstX = width / 2; secondX = width / 2; break; } case EnumWinCategory.TopLeft: { firstY = 0; firstX = 0; secondY = height; secondX = width; break; } case EnumWinCategory.TopRight: { firstX = width; secondX = 0; secondY = height; break; } } thisCanvas.DrawLine(firstX, firstY, secondX, secondY, _winPen); } } if (thisSpace.Status == EnumSpaceType.O) { thisCanvas.DrawOval(thisRect, _bluePen); //circle. } else if (thisSpace.Status == EnumSpaceType.X) { thisCanvas.DrawLine(5, 5, width - 5, height - 5, _bluePen); thisCanvas.DrawLine(width - 5, 5, 5, height - 5, _bluePen); } }