public ActionResult EndTurn() { MonopolyApp = TempData["monopoly"] as MonopolyApp; TempData.Keep("monopoly"); var actionMessage = MonopolyApp.IncreaseTurnCounter(); return(RedirectToAction("Game", new { actionMessage, isThrowDie = true })); }
public MonopolyView(MonopolyApp gameApp) { _gameApp = gameApp; this.Resize += new EventHandler(update_Resize); _presenter = new MonopolyPresenter(this, _gameApp); this.RollButton.Click += new EventHandler(RollButton_Click); this.EndTurnButton.Click += new EventHandler(EndTurnButton_Click); ShowMonopolyData(); }
public ActionResult ThrowDie() { MonopolyApp = TempData["monopoly"] as MonopolyApp; if (MonopolyApp == null) { return(RedirectToAction("Index")); } TempData.Keep("monopoly"); var actionMessage = MonopolyApp.Game(); return(RedirectToAction("Game", new { actionMessage, isThrowDie = false })); }
public ActionResult Index() { if (TempData.Peek("monopoly") == null) { baseDirectory = new DirectoryInfo(HostingEnvironment.ApplicationPhysicalPath).Parent; var path = baseDirectory.FullName + "\\Monopoly"; MonopolyApp = new MonopolyApp(path); MonopolyApp.Init(); TempData["monopoly"] = MonopolyApp; TempData.Keep("monopoly"); } else { MonopolyApp = TempData["monopoly"] as MonopolyApp; } const string actionMessage = "Roll the dice to start the game"; return(RedirectToAction("Game", new { actionMessage, isThrowDie = true })); }
public ActionResult Game(string actionMessage, bool isThrowDie) { MonopolyApp = TempData["monopoly"] as MonopolyApp; if (MonopolyApp == null) { return(RedirectToAction("Index")); } TempData.Keep("monopoly"); var gameViewModel = new GameViewModel() { CurrentPlayer = MonopolyApp.GetCurrentPlayer(), Locations = MonopolyApp.board.locations.Values.ToList(), Players = MonopolyApp.Players, DieValue = MonopolyApp.board.CurrentDieValue, ActionMessage = actionMessage, IsThrowDie = isThrowDie }; return(View(gameViewModel)); }