Exemple #1
0
    public T ShowPopupUI <T>(Defines.SceneType sceneType, bool isSavePopup = false) where T : UI_Popup
    {
        string sceneName = System.Enum.GetName(typeof(Defines.SceneType), sceneType);
        string name      = typeof(T).Name;

        GameObject go;

        if (m_popupUI.ContainsKey(name) == true)
        {
            go = m_popupUI[name].gameObject;
            go.SetActive(true);
        }
        else
        {
            go = Managers.Resources.Instantiate($"UI/{sceneName}/Popup/{name}");
        }

        T popup = go.GetComponent <T>();

        m_popupStack.Push(popup);

        go.transform.SetParent(m_uiHolder);

        if (isSavePopup == true && m_popupUI.ContainsKey(name) == false)
        {
            m_popupUI.Add(name, popup);
        }

        return(popup);
    }
    public void LoadScene(Defines.SceneType sceneType)
    {
        CurrentScene.Clear();
        m_nextSceneName = System.Enum.GetName(typeof(Defines.SceneType), sceneType);
        if (!m_nextSceneName.Contains("Scene"))
        {
            m_nextSceneName = $"{m_nextSceneName}Scene";
        }

        SceneManager.LoadScene(System.Enum.GetName(typeof(Defines.SceneType), Defines.SceneType.LoadingScene));
    }
Exemple #3
0
    public virtual void LoadDontDestroyUI()
    {
        Defines.SceneType type = Defines.SceneType.GameScene;

        Managers.UI.DontDestroyUI <GameSceneUI>(type);
        Managers.UI.DontDestroyUI <UI_Status>(type);
        Managers.UI.DontDestroyUI <UI_CharacterProfile>(type).gameObject.SetActive(false);
        Managers.UI.DontDestroyUI <Inventory_Treasure>(type);
        Managers.UI.DontDestroyUI <UI_Inventory>(type).gameObject.SetActive(false);
        Managers.UI.DisactivatePopupUI();

        Managers.Quest.InstantiateQuestUI();
    }
Exemple #4
0
    public T ShowSceneUI <T>(Defines.SceneType sceneType) where T : UI_Scene
    {
        if (m_sceneUI == null)
        {
            m_sceneUI = new Dictionary <string, UI_Scene>();
        }

        string scenePath = $"{m_defaultSceneUIPath[(int)sceneType]}/{typeof(T).Name}";

        GameObject go    = Managers.Resources.Instantiate(scenePath);
        T          scene = go.GetComponent <T>();

        m_sceneUI.Add(typeof(T).Name, scene);

        go.transform.SetParent(m_uiHolder);
        return(scene);
    }