Exemple #1
0
        void OnTopScreenChanged(Screen oldScreen, Screen newScreen)
        {
            if (newScreen is CardTableViewModel vm)
            {
                ActiveCardSpace = vm;
            }
            else
            {
                ActiveCardSpace = null;
            }

            TopScreenChanged?.Invoke(this, new ScreenChangedEventArgs(oldScreen, newScreen));
        }
 static HomeController()
 {
     HomeController._rng = new Random();
     _currentGame        = new Game()
     {
         StandardDeckType = START_DECK_TYPE,
         HandSize         = START_HAND_SIZE,
         StartDeck        = new Deck(START_DECK_TYPE),
         ShuffledDeck     = new Deck(START_DECK_TYPE)
     };
     HomeController.Shuffle();
     _cardTable = new CardTableViewModel("", HomeController._currentGame.StartDeck);
 }
        public ActionResult CreateGame(Game game)
        {
            ViewData["PlayerCreated"]    = PlayerCreated;
            ViewData["GameCreated"]      = GameCreated;
            ViewData["PlayerJoinedGame"] = PlayerJoinedGame;
            if (ModelState.IsValid)
            {
                _currentGame = game;
                HomeController._currentGame.StartDeck    = new Deck(_currentGame.StandardDeckType);
                HomeController._currentGame.ShuffledDeck = new Deck(_currentGame.StandardDeckType);
                HomeController.Shuffle();
                _cardTable                   = new CardTableViewModel("", HomeController._currentGame.StartDeck);
                GameCreated                  = true;
                ViewData["GameCreated"]      = GameCreated;
                PlayerJoinedGame             = false;
                ViewData["PlayerJoinedGame"] = PlayerJoinedGame;
                //game.TaskId = StartGame(game);
            }

            return(View());
        }