// :: Private methods :: private void Awake() { if (deactivateAllButCurrent) { foreach (var menu in interfaceLevels) { menu.gameObject.SetActive(false); menu.Manager = this; //menu.OnClose(); } } //currentlyOpen = interfaceLevels[current];// currentlyOpen.OnOpen(); }
// Opens a menu and close current one public void OpenMenu(InterfaceLevel menuLevel) { if (menuLevel == currentlyOpen) { return; } CloseMenu(currentlyOpen); // - menuLevel.OnOpen(); menuLevel.transform.SetAsLastSibling(); // So it is above all UIs interfacesStack.Push(currentlyOpen); // - currentlyOpen = menuLevel; }
public InterfaceLevel OpenMenu(InterfaceLevel menuLevel, bool closeCurrent) { if (menuLevel == currentlyOpen) { return(currentlyOpen); } if (closeCurrent) { CloseMenu(currentlyOpen); } menuLevel.OnOpen(); menuLevel.transform.SetAsLastSibling(); // So it is above all UIs currentlyOpen = menuLevel; interfacesStack.Push(currentlyOpen); return(currentlyOpen); }