/// <summary> /// Sets a GUI to be active by its name. /// </summary> /// <param name="name"> /// The name of the GUI to become active. /// </param> public static void SetGUI(String name) { if (GUIInstances.ContainsKey(name)) { GUI newGUI = GUIInstances[name]; if (newGUI == CurrentGUI) return; if (SelectedButton != null) SelectedButton.IsDown = false; SelectedButton = null; ActiveGUIName = name; if (CurrentGUI == null) { CurrentGUI = newGUI; CurrentGUI.OnWake(); } else if (CurrentGUI != newGUI) { CurrentGUI.OnSleep(); CurrentGUI = newGUI; CurrentGUI.OnWake(); } } else if (name == null) { ActiveGUIName = "<NONE>"; CurrentGUI = null; } }
/// <summary> /// Adds a new GUI to the manager. /// </summary> /// <param name="gui"> /// The GUI instance to store. /// </param> /// <param name="name"> /// The name of the GUI. /// </param> public static void AddGUI(GUI gui, String name) { GUIInstances[name] = gui; }