/// <summary>
 /// Initializes a new instance of the <see cref="IScreen"/> class.
 /// </summary>
 /// <param name="gui">The GUI Component, if null you cant use GUI in this screen.</param>        
 public IScreen(IGui gui = null)
 {
     this.gui = gui;
     IsLoaded = false;
     CleanUpWhenRemoved = true;
     CleanupAbles = new List<ICleanupAble>();
 }
Exemple #2
0
 public Options(IGui gui)
     : base(gui)
 {
 }
Exemple #3
0
 public Menu(IGui gui)
     : base(gui)
 {
 }
 public I2DScene(IGui gui = null) : base(gui) { }
        /// <summary>
        /// Cleans up resources that dont are exclusive of the screen        
        /// </summary>
        protected virtual void CleanUp(EngineStuff engine)
        {
            if (CleanUpWhenRemoved)
            {
#if WINDOWS
                foreach (var item in KeyBinds.Values)
                {
                    item.BindAction = BindAction.REMOVE;
                    CommandProcessor.getCommandProcessor().SendCommandAssyncronous(item);
                }
                foreach (var item in MouseBinds.Values)
                {
                    item.BindAction = BindAction.REMOVE;
                    CommandProcessor.getCommandProcessor().SendCommandAssyncronous(item);
                }
#elif WINDOWS_PHONE
            foreach (var item in GestureBinds.Values)
            {
                item.BindAction = BindAction.REMOVE;
                CommandProcessor.getCommandProcessor().SendCommandAssyncronous(item);
            }
            
#endif

                IScreenUpdateable[] updts = updateables.ToArray();

                for (int i = 0; i < updts.Length; i++)
                {
                    updts[i].iCleanUp();
                }

                if (gui != null)
                {
                    gui.iDispose();
                    gui = null;
                }

                foreach (var item in CleanupAbles)
                {
                    item.CleanUp(graphicFactory);
                }
                CleanupAbles.Clear();
#if DEBUG
            GC.Collect();
            GC.WaitForPendingFinalizers();
#endif
            }
        }