Пример #1
0
 public void TestStartLoadingMultipleTimes()
 {
     using (
         LoadingScreenState <TestGameState> loadingScreen =
             new LoadingScreenState <TestGameState>(this.stateManager, this.testState)
         ) {
         loadingScreen.Initialize();
         loadingScreen.StartLoading();
         loadingScreen.StartLoading();
         loadingScreen.StartLoading();
     }
 }
Пример #2
0
 public void TestStartLoadingSynchronously()
 {
     using (
         LoadingScreenState <TestGameState> loadingScreen =
             new LoadingScreenState <TestGameState>(this.stateManager, this.testState)
         ) {
         loadingScreen.Initialize();
         loadingScreen.StartLoading();
     }
 }
Пример #3
0
        public void TestGameStateSwitching()
        {
            using (
                LoadingScreenState <TestGameState> loadingScreen =
                    new LoadingScreenState <TestGameState>(this.stateManager, this.testState)
                ) {
                loadingScreen.Initialize();

                this.stateManager.Push(loadingScreen);
                Assert.AreSame(loadingScreen, this.stateManager.ActiveState);

                // Synchronous mode - loading finishes right here
                loadingScreen.StartLoading();

                // The loading screen may decide to do the switch in Update() or Draw() to
                // avoid thread synchronization issues.
                loadingScreen.Update(new GameTime());
                loadingScreen.Draw(new GameTime());

                // By now, the loading screen should have established the game state it was
                // loading as the new active state
                Assert.AreSame(this.testState, this.stateManager.ActiveState);
            }
        }