Beispiel #1
0
        public ActionResult EndTurn()
        {
            MonopolyApp = TempData["monopoly"] as MonopolyApp;
            TempData.Keep("monopoly");
            var actionMessage = MonopolyApp.IncreaseTurnCounter();

            return(RedirectToAction("Game", new { actionMessage, isThrowDie = true }));
        }
Beispiel #2
0
 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();
 }
Beispiel #3
0
        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 }));
        }
Beispiel #4
0
        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 }));
        }
Beispiel #5
0
        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));
        }