protected override async Task ClickProcessAsync(SKPoint thisPoint)
        {
            if (CanClickOnPlayer() == false)
            {
                return;// i think the dice should roll automatically.
            }
            if (CountdownVMData.CanChooseNumber == null)
            {
                throw new BasicBlankException("Nobody is handling whether it can choose number.  Rethink");
            }
            if (_gameContainer.MakeMoveAsync == null)
            {
                throw new BasicBlankException("Nobody is handling make move.  Rethink");
            }
            foreach (var thisNumber in _thisList)
            {
                var thisRect = thisNumber.GetMainRect();
                if (MiscHelpers.DidClickRectangle(thisRect, thisPoint) == true)
                {
                    if (CountdownVMData.CanChooseNumber(thisNumber.Number !) == false)
                    {
                        return;// no need for messagebox, just do nothing
                    }
                    await _gameContainer.ProcessCustomCommandAsync(_gameContainer.MakeMoveAsync, thisNumber.Number !);

                    return;
                }
            }
        }
        } = SKColors.Black;                                      // can adjust as needed as well
        public bool DidClickButton(SKPoint thisPoint)
        {
            if (CanExecute != null && CanExecute() == false)
            {
                return(false);
            }

            var thisRect = GetRectangle();

            return(MiscHelpers.DidClickRectangle(thisRect, thisPoint));
        }
Esempio n. 3
0
 public int SpaceClicked(float x, float y)
 {
     foreach (var thisItem in _spaceList.Values)
     {
         bool rets;
         rets = MiscHelpers.DidClickRectangle(thisItem.Bounds, (int)x, (int)y);
         if (rets == true)
         {
             return(_spaceList.GetKey(thisItem));
         }
     }
     return(0);
 }
        private readonly bool _isTest = false; //for testing,  i can click anywhere.
        protected override async Task ClickProcessAsync(SKPoint thisPoint)
        {
            if (_isTest)
            {
                throw new BasicBlankException("Rethink test now.");
            }
            if (_gameContainer.Command.IsExecuting)
            {
                return;
            }
            if (MiscHelpers.DidClickRectangle(_diceRect, thisPoint))
            {
                if (_gameContainer.CanRollDice == null)
                {
                    throw new BasicBlankException("Nobody is handling can roll dice.  Rethink");
                }
                if (_gameContainer.RollDiceAsync == null)
                {
                    throw new BasicBlankException("Nobody is rolling the dice.  Rethink");
                }
                if (_gameContainer.CanRollDice.Invoke() == false)
                {
                    return;
                }
                await _gameContainer.ProcessCustomCommandAsync(_gameContainer.RollDiceAsync);
            }

            if (_gameContainer.SaveRoot.DiceNumber == 0)
            {
                return; //hopefully this simple here too (?)
            }


            //if (_isTest == false)
            //{
            //    if (_thisMod!.SpaceCommand!.CanExecute(0) == false)
            //        return; //can't consider because it can't execute anyways.
            //}
            foreach (var thisSpace in _spaceList.Values)
            {
                SKRect tempRect;
                if (_gameContainer.BasicData !.IsXamarinForms == false || _isTest)
                {
                    tempRect = thisSpace;
                }
Esempio n. 5
0
        protected override async Task ClickProcessAsync(SKPoint thisPoint)
        {
            if (_command.IsExecuting)
            {
                return;
            }
            var list = _dataModel.SpaceList !.Values.Take(6).ToCustomBasicList();

            foreach (var number in list)
            {
                if (MiscHelpers.DidClickRectangle(number.Bounds, thisPoint) == true)
                {
                    await _clickModel.MakeMoveAsync(_dataModel.SpaceList.GetKey(number));

                    return;
                }
            }
        }
Esempio n. 6
0
        public int TrainClicked(SKPoint point)
        {
            if (_command.IsExecuting)
            {
                return(0);
            }

            TrainStationGraphicsCP.PrivateTrain thisPrivate;
            if (Satisfy > 0)
            {
                var tempTrain = TrainList[Satisfy];
                thisPrivate = _imageBoard !.PrivateList[tempTrain.Index];
                var tempList = _imageBoard.GetClickableRectangle(thisPrivate);
                foreach (var thisRect in tempList)
                {
                    if (MiscHelpers.DidClickRectangle(thisRect, point))
                    {
                        return(Satisfy);
                    }
                }
                return(0);
            }
            int x = 0;

            foreach (var thisTrain in TrainList.Values)
            {
                x++;
                thisPrivate = _imageBoard !.PrivateList[thisTrain.Index];
                if (thisTrain.TrainUp == true || x == Self)
                {
                    var tempList = _imageBoard.GetClickableRectangle(thisPrivate);
                    foreach (var thisRect in tempList)
                    {
                        if (MiscHelpers.DidClickRectangle(thisRect, point))
                        {
                            return(x);
                        }
                    }
                }
            }
            return(0);
        }
Esempio n. 7
0
        protected override async Task ClickProcessAsync(SKPoint thisPoint)
        {
            if (_gameContainer.Command.IsExecuting)
            {
                return;
            }
            if (_gameContainer.MakeMoveAsync == null)
            {
                throw new BasicBlankException("Nobody is handling make move.  Rethink");
            }
            var thisList = _gameContainer.SpaceList !.Values.Where(items => items.IsEnabled == true && items.Player == 0).ToCustomBasicList();

            foreach (var thisNumber in thisList)
            {
                if (MiscHelpers.DidClickRectangle(thisNumber.Bounds, thisPoint) == true)
                {
                    await _gameContainer.ProcessCustomCommandAsync(_gameContainer.MakeMoveAsync, _gameContainer.SpaceList.GetKey(thisNumber));

                    return;
                }
            }
        }
Esempio n. 8
0
        protected override async Task ClickProcessAsync(SKPoint thisPoint)
        {
            if (_gameContainer.Command.IsExecuting)
            {
                return;
            }

            if (_gameContainer.MakeMoveAsync == null)
            {
                throw new BasicBlankException("MakeMoveAsync not populated.  Rethink");
            }

            foreach (var thisDot in _gameContainer.DotList !.Values)
            {
                if (MiscHelpers.DidClickRectangle(thisDot.Bounds, thisPoint))
                {
                    await _gameContainer.MakeMoveAsync(_gameContainer.DotList.GetKey(thisDot));

                    return;
                }
            }
        }
Esempio n. 9
0
        protected override async Task ClickProcessAsync(SKPoint thisPoint)
        {
            if (_gameContainer.Command.IsExecuting)
            {
                return;
            }
            if (_gameContainer.SaveRoot.DidDraw == false)
            {
                if (MiscHelpers.DidClickRectangle(_rect_Deck, thisPoint))
                {
                    if (_gameContainer.DrawClickAsync == null)
                    {
                        throw new BasicBlankException("Nobody is handling the draw click.  Rethink");
                    }
                    await _gameContainer.ProcessCustomCommandAsync(_gameContainer.DrawClickAsync);

                    return;
                }
            }
            if (_gameContainer.SaveRoot.DidDraw == false)
            {
                return;
            }
            var thisRect = _homeSpaces[(int)_gameContainer.SingleInfo !.Color];
        protected override async Task ClickProcessAsync(SKPoint thisPoint)
        {
            if (_gameContainer.Command.IsExecuting)
            {
                return;
            }
            if (_gameContainer.GameStatus == EnumWhatStatus.NeedChooseFirstOption)
            {
                var firstOption  = GetCareerRectangle();
                var secondOption = GetCollegeRectangle();
                if (MiscHelpers.DidClickRectangle(firstOption, thisPoint))
                {
                    _gameContainer.Command.StartExecuting();
                    await _options.OpeningOptionAsync(EnumStart.Career);

                    return;
                }
                if (MiscHelpers.DidClickRectangle(secondOption, thisPoint))
                {
                    _gameContainer.Command.StartExecuting();
                    await _options.OpeningOptionAsync(EnumStart.College);

                    return;
                }
                return;
            }
            if (_gameContainer.GameStatus == EnumWhatStatus.NeedChooseRetirement)
            {
                var country = GetCountrySideRect();
                var million = GetMillionRect();
                if (MiscHelpers.DidClickRectangle(country, thisPoint))
                {
                    _gameContainer.Command.StartExecuting();
                    await _options.RetirementAsync(EnumFinal.CountrySideAcres);

                    return;
                }
                if (MiscHelpers.DidClickRectangle(million, thisPoint))
                {
                    _gameContainer.Command.StartExecuting();
                    await _options.RetirementAsync(EnumFinal.MillionaireEstates);

                    return;
                }
                return;
            }
            if (_gameContainer.GameStatus == EnumWhatStatus.NeedToChooseSpace)
            {
                int firstOption  = _spacePos.FirstPossiblePosition;
                int secondOption = _spacePos.SecondPossiblePosition;
                if (firstOption == 0 || secondOption == 0)
                {
                    throw new BasicBlankException("Must truly have 2 options.  Otherwise, can't do it.");
                }
                var firstRect  = GetSpaceRect(firstOption);
                var secondRect = GetSpaceRect(secondOption);
                if (MiscHelpers.DidClickRectangle(firstRect, thisPoint))
                {
                    _options.SpaceDescription(firstOption);
                    return;
                }
                if (MiscHelpers.DidClickRectangle(secondRect, thisPoint))
                {
                    _options.SpaceDescription(secondOption);
                    return;
                }
            }

            foreach (var thisPiece in _gameContainer !.ExtraSpace !.PieceList)
            {
                ButtonCP?thisBut = thisPiece as ButtonCP;
                if (thisBut !.DidClickButton(thisPoint))
                {
                    if (thisBut.ExecuteAsync == null)
                    {
                        throw new BasicBlankException($"No execute async was done for button with text of {thisBut.Text}.  Rethink.");
                    }
                    _gameContainer.Command.StartExecuting();
                    await thisBut.ExecuteAsync();

                    return;
                }
            }
        }