Esempio n. 1
0
        /// <summary>
        /// Opens a screen of the provided type with the specified name on the specified layer
        /// </summary>
        /// <param name="ScreenType">The C# Type of the screen to instantiate</param>
        /// <param name="ScreenName">The node name that will be given to the screen</param>
        /// <param name="ScreenLayer">The layer to open this screen on</param>
        /// <returns>The intance of the screen or null if it fails</returns>
        public MDScreen OpenScreen(Type ScreenType, string ScreenName, MDScreenLayer ScreenLayer)
        {
            MDScreen NewScreen = MDStatics.CreateTypeInstance <MDScreen>(ScreenType);

            AddScreenToStack(NewScreen, ScreenLayer);

            return(NewScreen);
        }
Esempio n. 2
0
 private void OnOnScreenDebugClosed(MDScreen Screen)
 {
     if (OnScreenDebug == Screen)
     {
         OnScreenDebug.OnScreenClosed -= OnOnScreenDebugClosed;
         OnScreenDebug = null;
     }
 }
Esempio n. 3
0
 private void OnConsoleClosed(MDScreen Screen)
 {
     if (Screen == Console)
     {
         Console.OnScreenClosed -= OnConsoleClosed;
         Console = null;
     }
 }
Esempio n. 4
0
        /// <summary>
        /// Remove the provided screen from the stack
        /// </summary>
        /// <param name="Screen">The screen instance to remove from this layer</param>
        public void RemoveScreen(MDScreen Screen)
        {
            if (Screen != null && ScreenStack.Contains(Screen))
            {
                Screen.OnScreenClosed -= RemoveScreen;

                UpdateScreenVisibilities();
            }
        }
Esempio n. 5
0
        /// <summary>
        /// Opens a screen of the provided type with the specified name on the specified layer
        /// </summary>
        /// <param name="ScreenScene">The Screen's PackedScene to open</param>
        /// <param name="ScreenName">The node name that will be given to the screen</param>
        /// <param name="ScreenLayer">The layer to open this screen on</param>
        /// <returns>The intance of the screen or null if it fails</returns>
        public MDScreen OpenScreen(PackedScene ScreenScene, string ScreenName, MDScreenLayer ScreenLayer)
        {
            MDScreen NewScreen = ScreenScene.Instance() as MDScreen;

            if (NewScreen != null)
            {
                NewScreen.Name = ScreenName;
                AddScreenToStack(NewScreen, ScreenLayer);
            }

            return(NewScreen);
        }
Esempio n. 6
0
        /// <summary>
        /// Add a screen to the top of the stack
        /// </summary>
        /// <param name="Screen">The screen instance to add to this layer</param>
        public void AddScreen(MDScreen Screen)
        {
            if (Screen != null)
            {
                // If it's in the stack, remove it, otherwise we need to bind its event
                if (ScreenStack.Remove(Screen) == false)
                {
                    Screen.OnScreenClosed += RemoveScreen;
                }

                ScreenStack.Add(Screen);
                AddChild(Screen);

                UpdateScreenVisibilities();
            }
        }
Esempio n. 7
0
        private void AddScreenToStack(MDScreen Screen, MDScreenLayer ScreenLayer)
        {
            MDLayerStack LayerStack = GetLayerStack(ScreenLayer);

            LayerStack.AddScreen(Screen);
        }