예제 #1
0
    public void ChangeUIMode(UIMode newUIMode, bool disableCanvas)
    {
        if (GameMaster.sceneClearing)
        {
            return;
        }
        if (currentMode != newUIMode)
        {
            switch (currentMode)
            {
            case UIMode.Standart:
                if (disableCanvas)
                {
                    mainCanvasController?.gameObject.SetActive(false);
                }
                GameMaster.realMaster.environmentMaster?.DisableDecorations();
                DisableSpecialCanvas();
                break;

            case UIMode.ExploringMinigame: if (disableCanvas)
                {
                    exploringMinigameController?.gameObject.SetActive(false);
                }
                break;

            case UIMode.GlobalMap:
                if (disableCanvas)
                {
                    globalMapCanvasController.gameObject.SetActive(false);
                }
                break;

            case UIMode.Editor:
            {
                if (disableCanvas)
                {
                    Destroy(editorCanvasController.gameObject);
                    editorCanvasController = null;
                }
                break;
            }

            case UIMode.Endgame:
            {
                if (endPanelController != null)
                {
                    Destroy(endPanelController.gameObject);
                }
                break;
            }
            }
            bool haveOwnCamera = false;
            switch (newUIMode)
            {
            case UIMode.ExploringMinigame:
                haveOwnCamera = true;
                var mo = GetExploringMinigameController();
                if (!mo.gameObject.activeSelf)
                {
                    mo.gameObject.SetActive(true);
                }
                break;

            case UIMode.GlobalMap:
                haveOwnCamera = true;
                var go = GetGlobalMapCanvasController();
                go.RedrawMap();
                if (!go.gameObject.activeSelf)
                {
                    go.gameObject.SetActive(true);
                }
                break;

            case UIMode.KnowledgeTab:
                haveOwnCamera = true;
                var kt = GetKnowledgeTabUI();
                if (!kt.gameObject.activeSelf)
                {
                    kt.gameObject.SetActive(true);
                }
                kt.Redraw();
                break;

            case UIMode.Endgame:
                AnnouncementCanvasController.DeactivateLogWindow();
                endPanelController.transform.SetAsLastSibling();
                break;

            case UIMode.Standart:
                var mcc = GetMainCanvasController();
                if (!mcc.gameObject.activeSelf)
                {
                    mcc.gameObject.SetActive(true);
                }
                GameMaster.realMaster.environmentMaster?.EnableDecorations();
                ReactivateSpecialCanvas();
                break;

            case UIMode.Editor:
                var eui = GetEditorCanvasController();
                break;
            }
            FollowingCamera.main.gameObject.SetActive(!haveOwnCamera);
            previousMode = currentMode;
            currentMode  = newUIMode;
        }
    }