public UiBase CreateUi(UiBase uiPrefab) { UiBase ui; switch (uiPrefab.OpenType) { case UiOpenType.UOT_FULL_SCREEN: case UiOpenType.UOT_COMMON: { ui = UnityEngine.Object.Instantiate(uiPrefab, fullScreenRoot); break; } case UiOpenType.UOT_POP_UP: { ui = UnityEngine.Object.Instantiate(uiPrefab, popUpWindowRoot); break; } default: { return(null); } } return(ui); }
private void openCommonUi(UiBase ui, Action completeCb) { commonUis.AddLast(ui); ui.transform.SetParent(fullScreenRoot); ui.transform.SetAsLastSibling(); ui.Open(onCommonUiClose, completeCb); }
private void closeFullScreenCanvas(UiBase ui, Action completeCb) { if (!fullScreenCavases.Contains(ui)) { debug.PrintSystem.LogWarning($"[MainCanvasRoot] UI is not open. UI: {ui.name}"); completeCb?.Invoke(); return; } ui.Close(completeCb); }
private void onPopUpWindowClose(UiBase ui) { popUpWindows.Remove(ui); if (popUpWindows.Count == 0) { frontMask.SetFrontMask(0f); popUpWindowRoot.gameObject.SetActive(false); } else { popUpWindows.Last.Value.transform.SetAsLastSibling(); } }
private void onFullScreenCanvasClose(UiBase ui) { bool isOpenLast = (ui == fullScreenCavases.Last.Value); fullScreenCavases.Remove(ui); if (fullScreenCavases.Count == 0 || !isOpenLast) { return; } fullScreenCavases.Last.Value.transform.SetAsFirstSibling(); fullScreenCavases.Last.Value.Show(); }
private void openPopUpWindow(UiBase ui, Action completeCb) { if (popUpWindows.Contains(ui)) { completeCb?.Invoke(); return; } frontMask.SetFrontMask(DefaultFrontMaskAlpha, true); // TODO: Read setting in windows. frontMask.transform.SetAsLastSibling(); ui.transform.SetParent(popUpWindowRoot); ui.transform.SetAsLastSibling(); ui.Open(onPopUpWindowClose, completeCb); popUpWindows.AddLast(ui); popUpWindowRoot.gameObject.SetActive(true); }
private void openFullScreenCanvas(UiBase ui, Action completeCb) { if (fullScreenCavases.Contains(ui)) { debug.PrintSystem.LogWarning($"[MainCanvasRoot] UI has already open. UI: {ui.name}"); completeCb?.Invoke(); return; } if (fullScreenCavases.Count == 0 || fullScreenCavases.Last.Value.State == UiState.US_HIDE) { fullScreenCavases.AddLast(ui); ui.transform.SetParent(fullScreenRoot); ui.transform.SetAsFirstSibling(); ui.Open(onFullScreenCanvasClose, completeCb); return; } fullScreenCavases.Last.Value.Hide(() => openFullScreenCanvas(ui, completeCb)); }
public void OpenUi(UiBase ui, Action completeCb) { switch (ui.OpenType) { case UiOpenType.UOT_FULL_SCREEN: { openFullScreenCanvas(ui, completeCb); break; } case UiOpenType.UOT_POP_UP: { openPopUpWindow(ui, completeCb); break; } case UiOpenType.UOT_COMMON: { openCommonUi(ui, completeCb); break; } } }
private void closePopUpWindow(UiBase ui, Action completeCb) { ui.Close(completeCb); }
private void onCommonUiClose(UiBase ui) { popUpWindows.Remove(ui); }
private void closeCommonUi(UiBase ui, Action completeCb) { ui.Close(completeCb); }