コード例 #1
0
ファイル: ScreenManager.cs プロジェクト: Rolemancer/XNATest
 private ScreenManager()
 {
     Dimesions = new Vector2(640, 480);
     currentScreen = new SplashScreen();
     xmlGameScreenManager.ThisType = currentScreen.ThisType;
     currentScreen = xmlGameScreenManager.Load("Load/SplashScreen.xml");
 }
コード例 #2
0
        /// <summary>
        /// The constructor is private: loading screens should
        /// be activated via the static Load method instead.
        /// </summary>
        private LoadingScreen(ScreenManager screenManager, bool loadingIsSlow,
            GameScreen[] screensToLoad)
        {
            this.loadingIsSlow = loadingIsSlow;
            this.screensToLoad = screensToLoad;

            TransitionOnTime = TimeSpan.FromSeconds(0.5);
        }
コード例 #3
0
ファイル: ScreenManager.cs プロジェクト: Rolemancer/XNATest
 public void ChangeScreens(string screenName)
 {
     newScreen = (GameScreen)Activator.CreateInstance(Type.GetType("SimpleGame." + screenName));
     image.IsActive = true;
     image.fadeEffect.Increase = true;
     image.Alpha = 0.0f;
     IsTransitioning = true;
 }
コード例 #4
0
ファイル: ScreenManager.cs プロジェクト: Rolemancer/XNATest
 void Transition(GameTime gameTime)
 {
     if (IsTransitioning)
     {
         image.Update(gameTime);
         if (image.Alpha == 1.0f)
         {
             currentScreen.UnloadContent();
             currentScreen = newScreen;
             xmlGameScreenManager.ThisType = currentScreen.ThisType;
             if (File.Exists(currentScreen.XmlPath))
             {
                 currentScreen = xmlGameScreenManager.Load(currentScreen.XmlPath);
             }
             currentScreen.LoadContent();
         }
         else if (image.Alpha == 0.0f)
         {
             image.IsActive = false;
             IsTransitioning = false;
         }
     }
 }
コード例 #5
0
        /// <summary>
        /// Adds a new screen to the screen manager.
        /// </summary>
        public void AddScreen(GameScreen screen, PlayerIndex? controllingPlayer)
        {
            screen.ControllingPlayer = controllingPlayer;
            screen.ScreenManager = this;
            screen.IsExiting = false;

            // If we have a graphics device, tell the screen to load content.
            if (isInitialized) {
                screen.LoadContent();
            }

            screens.Add(screen);
        }
コード例 #6
0
        /// <summary>
        /// Removes a screen from the screen manager. You should normally
        /// use GameScreen.ExitScreen instead of calling this directly, so
        /// the screen can gradually transition off rather than just being
        /// instantly removed.
        /// </summary>
        public void RemoveScreen(GameScreen screen)
        {
            // If we have a graphics device, tell the screen to unload content.
            if (isInitialized) {
                screen.UnloadContent();
            }

            screens.Remove(screen);
            screensToUpdate.Remove(screen);
        }