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(); }
public async Task ChoseStockAsync(int deck) //i think that deck ended up being better after all. { if (_gameContainer.CanSendMessage()) { await _gameContainer.Network !.SendAllAsync("chosestock", deck); } var thisStock = CardsModule.GetStockCard(deck); await _gameContainer.ShowCardAsync(thisStock); _gameContainer.SingleInfo !.Hand.Add(thisStock); if (_gameContainer.SingleInfo.FirstStock == 0) { _gameContainer.SingleInfo.FirstStock = thisStock.Value; } else if (_gameContainer.SingleInfo.SecondStock == 0) { _gameContainer.SingleInfo.SecondStock = thisStock.Value; } else { throw new BasicBlankException("Can only have 2 stocks at the most"); } if (_gameContainer.SaveRoot !.EndAfterStock) { _gameContainer.GameStatus = EnumWhatStatus.NeedToEndTurn; }
public async Task StockReturnedAsync(int deck) { if (_gameContainer.CanSendMessage()) { await _gameContainer.Network !.SendAllAsync("stockreturned", deck); } var thisStock = CardsModule.GetStockCard(deck); await _gameContainer.ShowCardAsync(thisStock); _gameContainer.SingleInfo !.Hand.RemoveObjectByDeck(thisStock.Deck); if (thisStock.Value == _gameContainer.SingleInfo.FirstStock) { _gameContainer.SingleInfo.FirstStock = _gameContainer.SingleInfo.SecondStock; _gameContainer.SingleInfo.FirstStock = 0; } else if (thisStock.Value == _gameContainer.SingleInfo.SecondStock) { _gameContainer.SingleInfo.SecondStock = 0; } else { throw new BasicBlankException("Cannot update the stock"); } _gameContainer.GameStatus = EnumWhatStatus.NeedToEndTurn; await _gameContainer.ContinueTurnAsync !.Invoke(); }
public static DeckRegularDict <CareerInfo> GetCareerList(this LifeBoardGamePlayerItem thisPlayer) { var tempList = thisPlayer.Hand.Where(items => items.Deck <= 9).Select(items => items.Deck).ToCustomBasicList(); DeckRegularDict <CareerInfo> output = new DeckRegularDict <CareerInfo>(); foreach (var thisItem in tempList) { output.Add(CardsModule.GetCareerCard(thisItem)); } return(output); }
public override Task FinishGetSavedAsync() { LoadControls(); BoardGameSaved(); //i think. SaveRoot.LoadMod(_model); if (PlayerList.DidChooseColors() && SaveRoot.GameStatus != EnumWhatStatus.NeedChooseGender) { //if choosing gender, rethink. _gameBoard.LoadSavedGame(); PlayerList !.ForEach(thisPlayer => { var thisList = thisPlayer.Hand.ToRegularDeckDict(); thisPlayer.Hand.Clear(); thisList.ForEach(tempCard => { if (tempCard.Deck <= 9) { thisPlayer.Hand.Add(CardsModule.GetCareerCard(tempCard.Deck)); } else if (tempCard.Deck <= 18) { thisPlayer.Hand.Add(CardsModule.GetHouseCard(tempCard.Deck)); } else if (tempCard.Deck <= 27) { thisPlayer.Hand.Add(CardsModule.GetSalaryCard(tempCard.Deck)); } else if (tempCard.Deck <= 36) { thisPlayer.Hand.Add(CardsModule.GetStockCard(tempCard.Deck)); } else { throw new BasicBlankException("Must be between 1 and 36"); } }); }); if (SaveRoot.ChangePosition > 0) { _gameContainer.SpinnerPosition = SaveRoot.ChangePosition; _gameContainer.SpinnerRepaint(); } if (SaveRoot.GameStatus == EnumWhatStatus.NeedToEndTurn) { SingleInfo = PlayerList.GetWhoPlayer(); if (SingleInfo.Position > 0 && SingleInfo.LastMove == EnumFinal.None) { _model.GameDetails = _boardProcesses.GetSpaceDetails(SingleInfo.Position); } } } //anything else needed is here. return(Task.CompletedTask); }
public static DeckRegularDict <SalaryInfo> GetSalaryList(this CustomBasicList <int> tempList, PlayerCollection <LifeBoardGamePlayerItem> playerList) { DeckRegularDict <SalaryInfo> newList = new DeckRegularDict <SalaryInfo>(); foreach (var thisItem in tempList) { if (thisItem.SomeoneHasCard(playerList) == false) { newList.Add(CardsModule.GetSalaryCard(thisItem)); newList.Last().IsUnknown = true; } } return(newList); }
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(); }
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(); }
public static DeckRegularDict <HouseInfo> GetHouseList(this CustomBasicList <int> tempList, PlayerCollection <LifeBoardGamePlayerItem> playerList) { DeckRegularDict <HouseInfo> newList = new DeckRegularDict <HouseInfo>(); foreach (var thisItem in tempList) { if (thisItem.SomeoneHasCard(playerList) == false) { newList.Add(CardsModule.GetHouseCard(thisItem)); if (newList.Count == 2) { return(newList); } } } throw new BasicBlankException("Has to find 2 cards to choose from for house"); }
//protected override async Task ShowHumanCanPlayAsync() //{ // await base.ShowHumanCanPlayAsync(); // if (BasicData.IsXamarinForms && (SaveRoot.GameStatus == EnumWhatStatus.NeedTradeSalary || SaveRoot.GameStatus == EnumWhatStatus.NeedStealTile)) // { // await UIPlatform.ShowMessageAsync("Trying to show human can continue"); // if (_gameContainer.SubmitPlayerCommand == null) // { // //UIPlatform.ShowError("Nobody set up the submit player command. Rethink"); // return; // } // _gameContainer.SubmitPlayerCommand.ReportCanExecuteChange(); //try this way. // //await Task.Delay(200); //try delay to fix second bug. // //await UIPlatform.ShowMessageAsync("Choose Player Or End Turn"); // //_gameContainer.Command.ManualReport(); // } //} async Task IMiscDataNM.MiscDataReceived(string status, string content) { switch (status) //can't do switch because we don't know what the cases are ahead of time. { //put in cases here. case "spin": SpinnerPositionData spin = await js.DeserializeObjectAsync <SpinnerPositionData>(content); await _spinnerProcesses.StartSpinningAsync(spin); return; case "gender": EnumGender gender = await js.DeserializeObjectAsync <EnumGender>(content); if (_gameContainer.SelectGenderAsync == null) { throw new BasicBlankException("Nobody is handling the selecting gender. Rethink"); } await _gameContainer.SelectGenderAsync.Invoke(gender); return; case "firstoption": EnumStart firsts = await js.DeserializeObjectAsync <EnumStart>(content); await _boardProcesses.OpeningOptionAsync(firsts); return; case "chosecareer": await _careerProcesses.ChoseCareerAsync(int.Parse(content)); return; case "purchasecarinsurance": await _boardProcesses.PurchaseCarInsuranceAsync(); return; case "purchasedstock": await _boardProcesses.PurchaseStockAsync(); return; case "tradedlifeforsalary": await _boardProcesses.Trade4TilesAsync(); //i think return; case "tradedsalary": await _tradeSalaryProcesses.TradedSalaryAsync(content); return; case "stole": await _stolenTileProcesses.TilesStolenAsync(content); return; case "purchasedhouseinsurance": await _boardProcesses.PurchaseHouseInsuranceAsync(); return; case "attendednightschool": await _boardProcesses.AttendNightSchoolAsync(); return; case "choseretirement": EnumFinal finals = await js.DeserializeObjectAsync <EnumFinal>(content); await _boardProcesses.RetirementAsync(finals); return; case "chosestock": await _chooseStockProcesses.ChoseStockAsync(int.Parse(content)); return; case "chosesalary": await _basicSalaryProcesses.ChoseSalaryAsync(int.Parse(content)); return; case "stockreturned": await _returnStockProcesses.StockReturnedAsync(int.Parse(content)); return; case "chosehouse": await _houseProcesses.ChoseHouseAsync(int.Parse(content)); return; case "willsellhouse": await _boardProcesses.SellHouseAsync(); return; case "twins": CustomBasicList <EnumGender> gList = await js.DeserializeObjectAsync <CustomBasicList <EnumGender> >(content); await _twinProcesses.GetTwinsAsync(gList); return; case "houselist": CustomBasicList <int> tempList = await js.DeserializeObjectAsync <CustomBasicList <int> >(content); SaveRoot !.HouseList.Clear(); tempList.ForEach(thisIndex => SaveRoot.HouseList.Add(CardsModule.GetHouseCard(thisIndex))); await ContinueTurnAsync(); return; default: throw new BasicBlankException($"Nothing for status {status} with the message of {content}"); } }