public void UnregisterWindow(WindowReference element, GameObject obj) { if (windowLookUp.ContainsKey(element) && windowLookUp[element] == obj) { windowLookUp.Remove(element); } }
public bool ToggleUiElement(WindowReference element) { if (element == WindowReference.PauseMenu && currentActive != WindowReference.PauseMenu && currentActive != WindowReference.None && currentActive != WindowReference.Dialogue) { return(HideUiElement(currentActive)); } return(IsUiElementShown(element) ? HideUiElement(element) : ShowUiElement(element)); }
public void RegisterWindow(WindowReference element, GameObject obj) { if (windowLookUp.ContainsKey(element)) { windowLookUp[element] = obj; } else { windowLookUp.Add(element, obj); } }
public bool ShowUiElement(WindowReference element) { if (currentActive != WindowReference.None) { return(false); } if (!TryGetWindow(element, out GameObject windowObj)) { return(false); } windowObj.SetActive(true); currentActive = element; if (windowObj.TryGetComponent(out IUiWindow uiWindow)) { uiWindow.Show(); } return(true); }
public bool HideUiElement(WindowReference element) { if (currentActive == WindowReference.None || currentActive != element) { return(false); } if (!TryGetWindow(element, out GameObject windowObj)) { return(false); } if (windowObj.TryGetComponent(out IUiWindow uiWindow)) { uiWindow.Hide(); } windowObj.SetActive(false); currentActive = WindowReference.None; return(true); }
private void Awake() { Instance = this; SceneManager.Instance.OnEndSceneChange += _ => currentActive = WindowReference.None; }
private bool TryGetWindow(WindowReference element, out GameObject obj) => windowLookUp.TryGetValue(element, out obj);
private bool IsUiElementShown(WindowReference element) => TryGetWindow(element, out GameObject obj) && obj.activeSelf;