private void CheckEnabled(GUIBase obj, GUIBase[] toCheck) { if (obj.IsActive) { obj.Disable(); return; } for (int i = 0; i < toCheck.Length; i++) { if (toCheck[i].IsActive) { toCheck[i].EnableNext(obj); return; } } obj.Enable(); }
//private void OnGUI() //{ // if(Style.CustomStyles != null) // { // UnityEngine.GUI.skin.customStyles = Style.CustomStyles; // } //} public static bool Disable(GUIBase gui) { if (!gui.IsActive) { return(false); } if (Instance == null) { onAwakeRms += delegate() { Disable(gui); }; return(false); } lock (activeGUIs) { bool wasLast = activeGUIs .OrderBy(g => g.Layer) .LastOrDefault() == gui; int oldCount = activeGUIs.Length; activeGUIs = activeGUIs .Where(x => x != gui) .ToArray(); bool wasRemoved = oldCount != activeGUIs.Length; if (wasRemoved) { gui.Disable(); } if (activeGUIs.Length == 0) { activeGUIs = new GUIBase[0]; return(wasRemoved); } if (!wasLast) { UpdateDepths(); } return(wasRemoved); } }