コード例 #1
0
        public async Task ChoseSalaryAsync(int salary)
        {
            if (_gameContainer.CanSendMessage())
            {
                await _gameContainer.Network !.SendAllAsync("chosesalary", salary);
            }
            if (_gameContainer.GameStatus == EnumWhatStatus.NeedTradeSalary)
            {
                throw new BasicBlankException("I think if the salary is being traded; must use TradedSalary method instead");
            }
            else if (_gameContainer.GameStatus == EnumWhatStatus.NeedChooseSalary)
            {
                var thisSalary = CardsModule.GetSalaryCard(salary);
                await _gameContainer.ShowCardAsync(thisSalary);

                _gameContainer.SingleInfo !.Hand.Add(thisSalary);
                _gameContainer.SingleInfo.Salary = thisSalary.PayCheck;
                PopulatePlayerProcesses.FillInfo(_gameContainer.SingleInfo);
            }
            else
            {
                throw new BasicBlankException("Not sure what to do about this game status.  Rethink");
            }
            if (_gameContainer.SaveRoot.EndAfterSalary)
            {
                _gameContainer.GameStatus = EnumWhatStatus.NeedToEndTurn;
            }
            else
            {
                _gameContainer.GameStatus = EnumWhatStatus.NeedToSpin;
            }
            await _gameContainer.ContinueTurnAsync !.Invoke();
        }
コード例 #2
0
        private async Task SoldHouseAsync(int numberRolled)
        {
            var     thisHouse   = _gameContainer.SingleInfo !.GetHouseCard();
            decimal moneyEarned = thisHouse.SellingPrices[numberRolled];

            _gameContainer.SingleInfo !.HouseIsInsured = false;
            _model.GameDetails = $"House sold for {moneyEarned.ToCurrency(0)}";
            _gameContainer.CollectMoney(_gameContainer.WhoTurn, moneyEarned);
            if (_gameContainer.Test.NoAnimations == false)
            {
                await _gameContainer.Delay.DelaySeconds(1);
            }
            _gameContainer.SingleInfo.Hand.RemoveSpecificItem(thisHouse);
            PopulatePlayerProcesses.FillInfo(_gameContainer.SingleInfo);
            //hopefully does it automatically (?)
            //ThisMod.ChosenPile!.Visible = false;
            if (_gameContainer.GameStatus == EnumWhatStatus.NeedFindSellPrice)
            {
                _gameContainer.GameStatus = EnumWhatStatus.NeedChooseHouse;
            }
            else
            {
                _gameContainer.GameStatus = EnumWhatStatus.NeedChooseRetirement;
            }
        }
コード例 #3
0
        public async Task ChoseHouseAsync(int deck)
        {
            if (_gameContainer.CanSendMessage())
            {
                await _gameContainer.Network !.SendAllAsync("chosehouse", deck);
            }
            HouseInfo thisHouse = CardsModule.GetHouseCard(deck);
            await _gameContainer.ShowCardAsync(thisHouse);

            _gameContainer.SingleInfo !.Hand.Add(thisHouse);
            _gameContainer.SaveRoot !.HouseList.Clear();
            PopulatePlayerProcesses.FillInfo(_gameContainer.SingleInfo); //i think here too.
            _gameContainer.TakeOutExpense(thisHouse.HousePrice);
            _gameContainer.GameStatus = EnumWhatStatus.NeedToSpin;
            await _gameContainer.ContinueTurnAsync !.Invoke();
        }
コード例 #4
0
        public async Task ChoseCareerAsync(int deck)
        {
            if (_gameContainer.CanSendMessage())
            {
                await _gameContainer.Network !.SendAllAsync("chosecareer", deck);
            }
            if (_gameContainer.WasNight)
            {
                RemoveCareer(deck);
            }
            var thisCareer = CardsModule.GetCareerCard(deck);

            _gameContainer.SingleInfo !.Hand.Add(thisCareer);
            await _gameContainer.ShowCardAsync(thisCareer);

            string career1 = PopulatePlayerProcesses.CareerChosen(_gameContainer.SingleInfo, out string career2);

            if (career1 != "Teacher" && _gameContainer.SaveRoot.WasNight == false)
            {
                RemoveCareer(deck);
            }
            PopulatePlayerProcesses.FillInfo(_gameContainer.SingleInfo);
            if (PrivateCanGetSalary(career1, career2))
            {
                _gameContainer.SaveRoot.EndAfterSalary = _gameContainer.GameStatus == EnumWhatStatus.NeedNewCareer || _gameContainer.SaveRoot.WasNight;
                var thisSalary = _gameContainer.SingleInfo.GetSalaryCard();
                _gameContainer.SingleInfo.Hand.RemoveSpecificItem(thisSalary);
                _gameContainer.GameStatus = EnumWhatStatus.NeedChooseSalary;
                await _gameContainer.ContinueTurnAsync !.Invoke();
                return;
            }
            if (_gameContainer.SaveRoot.WasNight)
            {
                _gameContainer.SaveRoot.EndAfterSalary = true;
            }
            else if (_gameContainer.TeacherChooseSecondCareer)
            {
                _gameContainer.GameStatus         = EnumWhatStatus.NeedNewCareer;
                _gameContainer.SaveRoot.MaxChosen = 1;
            }
            else
            {
                _gameContainer.GameStatus = EnumWhatStatus.NeedToSpin;
            }
            _gameContainer.RepaintBoard();
            await _gameContainer.ContinueTurnAsync !.Invoke();
        }