示例#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);
        }
示例#2
0
 public void Remove(Screen component)
 {
     Components.Remove(component);
     componentsToUpdate.Remove(component);
     component.ComponentManager = null;
 }
示例#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);
 }
示例#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");
            }
        }