public static void CheckState(Game g) { switch (g.State) { case GameState.BeginStep: RunBeginStepJob(g); break; case GameState.Auction: RunAuctionJob(g); break; case GameState.Trade: RunTradeJob(g); break; case GameState.CantPay: case GameState.NeedPay: CheckPayState(g); break; } if (g.State == GameState.EndStep) { if (g.Curr.IsBot) BotBrain.BotActionWhenFinishStep(g); g.FinishRound(); } }
public static string Go(Game g, string act, string userName) { string res = ""; if (act == "ok") g.FinishStep(); if (g.Curr.CaughtByPolice) { if (act == "policekey") { g.Curr.FreePoliceKey--; g.Curr.Police = 0; g.ToBeginRound(); } else PlayerAction.PayToPolice(g); } if (g.State == GameState.CanBuy || g.State == GameState.CantPay) { if (act == "auc") { g.ToAuction(); res = GameRender.RenderAuction(g, userName); } else { PlayerAction.Buy(g); } } if (g.State == GameState.Auction) { if (act == "auc_y") { PlayerAction.MakeAuctionYes(g, userName); } else if (act == "auc_no") { PlayerAction.MakeAuctionNo(g, userName); } //LogicBot.CheckAuctionJob(g); } if (g.State == GameState.NeedPay) PlayerAction.Pay(g); if (g.State == GameState.CantPay) { PlayerAction.Pay(g); if (g.Curr.IsBot) { g.Tlogp("LeaveGame", "вы банкрот и покидаете игру", "you are bankrupt"); GameManager.LeaveGame(g, g.Curr.Name); } else { res = g.Text("go.CannotPay", "у вас нет денег, попробуйте заложить или продать <br />", "you dont have money,try mortage <br />"); res += "<br />" + GameRender.UIParts("ButtonPay"); } //PlayerAction.Pay(g); } if (g.State == GameState.Trade) { PlayerAction.MakeTrade(g, userName, act == "tr_y"); } if (g.State == GameState.MoveToCell) { if (g.Curr.Pos == 30) PlayerStep.MoveFrom30(g); else PlayerStep.MoveAfterRandom(g); } if (g.State == GameState.EndStep) { g.FinishRound(); } return res; }