コード例 #1
0
        //this is going to be the hardest.  because this one is responsible for making sure the proper screens load.

        public LifeBoardGameMainViewModel(CommandContainer commandContainer,
                                          LifeBoardGameMainGameClass mainGame,
                                          LifeBoardGameVMData model,
                                          BasicData basicData,
                                          TestOptions test,
                                          IGamePackageResolver resolver,
                                          LifeBoardGameGameContainer gameContainer
                                          )
            : base(commandContainer, mainGame, model, basicData, test, resolver)
        {
            _mainGame = mainGame;
            if (_mainGame.SaveRoot.GameStatus == EnumWhatStatus.NeedChooseGender)
            {
                throw new BasicBlankException("Cannot load main view model because you need to choose gender.  Rethink");
            }
            if (_mainGame.PlayerList.Any(x => x.Gender == EnumGender.None))
            {
                throw new BasicBlankException("Cannot load the main screen if sombody did not choose gender.  Rethink");
            }
            //_basicData = basicData;
            _resolver = resolver;
            gameContainer.HideCardAsync = HideCardAsync;
            gameContainer.CardVisible   = (() => ShowCardScreen != null);
            if (LifeBoardGameGameContainer.StartCollegeCareer && basicData.GamePackageMode == EnumGamePackageMode.Production)
            {
                throw new BasicBlankException("You cannot start college career because its in production");
            }
        }
コード例 #2
0
        async Task IHandleAsync <StartEventModel> .HandleAsync(StartEventModel message)
        {
            //load main screen.
            if (GenderScreen == null)
            {
                throw new BasicBlankException("Should have loaded gender first before starting this way.");
            }
            await CloseSpecificChildAsync(GenderScreen);

            GenderScreen = null;
            LifeBoardGameMainGameClass game = MainContainer.Resolve <LifeBoardGameMainGameClass>();

            game.SaveRoot.GameStatus = EnumWhatStatus.NeedChooseFirstOption; //belongs here.
            await StartNewGameAsync();

            await game.AfterChoosingGenderAsync();
        }