Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
 private void openCommonUi(UiBase ui, Action completeCb)
 {
     commonUis.AddLast(ui);
     ui.transform.SetParent(fullScreenRoot);
     ui.transform.SetAsLastSibling();
     ui.Open(onCommonUiClose, completeCb);
 }
Exemplo n.º 3
0
        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);
        }
Exemplo n.º 4
0
 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();
     }
 }
Exemplo n.º 5
0
        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();
        }
Exemplo n.º 6
0
        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);
        }
Exemplo n.º 7
0
        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));
        }
Exemplo n.º 8
0
        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;
            }
            }
        }
Exemplo n.º 9
0
 private void closePopUpWindow(UiBase ui, Action completeCb)
 {
     ui.Close(completeCb);
 }
Exemplo n.º 10
0
 private void onCommonUiClose(UiBase ui)
 {
     popUpWindows.Remove(ui);
 }
Exemplo n.º 11
0
 private void closeCommonUi(UiBase ui, Action completeCb)
 {
     ui.Close(completeCb);
 }