Beispiel #1
0
        /// <summary>
        /// Activates the loading screen.
        /// </summary>
        public static void Load(Screen componentManager, Screen loadingScreen, params Screen[] screensToLoad)
        {
            // Tell all the current screens to transition off.
            foreach (var screen in componentManager.Components)
                screen.ExitScreen();

            // Create and activate the loading screen.
            Loader loader = new Loader(componentManager,loadingScreen,screensToLoad);
            componentManager.AddScreen(loader);
        }
Beispiel #2
0
 public void Remove(Screen component)
 {
     Components.Remove(component);
     componentsToUpdate.Remove(component);
     component.ComponentManager = null;
 }
Beispiel #3
0
 /// <summary>
 /// The constructor is private: loading screens should
 /// be activated via the static Load method instead.
 /// </summary>
 private Loader(Screen screenManager, Screen loadingScreen, Screen[] screensToLoad)
 {
     this.loadingScreen = loadingScreen;
     this.screensToLoad = screensToLoad;
     Transition.OnTime = TimeSpan.FromSeconds(0.5);
 }
Beispiel #4
0
        public void AddScreen(Screen component)
        {
            if (component.ComponentManager == null)
            {
                component.ComponentManager = this;
                component.IsExiting = false;
                component.Initialize();

                Components.Add(component);
            }
            else
            {
                //exception here?
                //throw new Exception("Component is already being managed by another component");
            }
        }