コード例 #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);
        }
コード例 #2
0
 private void openCommonUi(UiBase ui, Action completeCb)
 {
     commonUis.AddLast(ui);
     ui.transform.SetParent(fullScreenRoot);
     ui.transform.SetAsLastSibling();
     ui.Open(onCommonUiClose, completeCb);
 }
コード例 #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);
        }
コード例 #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();
     }
 }
コード例 #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();
        }
コード例 #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);
        }
コード例 #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));
        }
コード例 #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;
            }
            }
        }
コード例 #9
0
 private void closePopUpWindow(UiBase ui, Action completeCb)
 {
     ui.Close(completeCb);
 }
コード例 #10
0
 private void onCommonUiClose(UiBase ui)
 {
     popUpWindows.Remove(ui);
 }
コード例 #11
0
 private void closeCommonUi(UiBase ui, Action completeCb)
 {
     ui.Close(completeCb);
 }