Example #1
0
        async Task IHandleAsync <NewRoundEventModel> .HandleAsync(NewRoundEventModel message)
        {
            ClearSubscriptions();
            await CloseMainAsync("The main screen should have been not null when choosing new round.  Rethink");
            await CloseRoundAsync();
            await NewGameOrRoundRequestedAsync();

            //await LoadGameScreenAsync();
            IRequestNewGameRound gameRound = MainContainer.Resolve <IRequestNewGameRound>();
            await gameRound.RequestNewRoundAsync();

            //hint:  either another message or somebody else would send the same message for the client.
        }
Example #2
0
        /// <summary>
        /// this is when somebody chooses new game.
        /// </summary>
        /// <param name="message"></param>
        /// <returns></returns>
        async Task IHandleAsync <NewGameEventModel> .HandleAsync(NewGameEventModel message)
        {
            await PrepNewGameAsync();

            if (_test.AlwaysNewGame)
            {
                CommandContainer.ClearLists(); //try this too.
                await _save.DeleteGameAsync(); //i think.

                ReplaceGame();                 //try this too.
                //other things are needed here too.
            }

            if (NewGameScreen == null)
            {
                throw new BasicBlankException("New game was not even active.  Therefore, I should not have received message for requesting new game");
            }

            await CloseMainAsync("Should have shown main game when showing new game.");

            //i think i should load it again anyways (?) and set the old to nothing.  so a fresh one will be created.
            //maybe we don't need the update code but we still need the load processes.
            //since we have code for closing, hopefully i am not forced to figure out how to delete controls (?)
            await _save.DeleteGameAsync(); //i think.

            await CloseSpecificChildAsync(NewGameScreen);

            NewGameScreen = null;//forgot to set to null.
            await NewGameOrRoundRequestedAsync();

            if (_mainGame == null)
            {
                throw new BasicBlankException("Failed to replace game when requesting new game.  Rethink");
            }
            //can't load here because it thinks you have the old file (wrong).

            //await LoadGameScreenAsync(); //i think in this case, should load here.

            IRequestNewGameRound gameRound = MainContainer.Resolve <IRequestNewGameRound>();
            await gameRound.RequestNewGameAsync();
        }