Пример #1
0
    public void HideUI(UI_MEMBER_LIST uiName)
    {
        GameObject targetUI = null;

        if (_scenePopups.ContainsKey(uiName))
        {
            targetUI = _scenePopups[uiName];
        }
        else if (_scenePanels.ContainsKey(uiName))
        {
            targetUI = _scenePanels[uiName];
        }
        else if (_commonPopups.ContainsKey(uiName))
        {
            targetUI = _commonPopups[uiName];
        }
        else if (_commonPanels.ContainsKey(uiName))
        {
            targetUI = _commonPanels[uiName];
        }

        if (targetUI != null)
        {
            targetUI.SetActive(false);
        }
        else
        {
            Debug.LogErrorFormat("Not Found UI -> {0}", uiName.ToString());
        }
    }
Пример #2
0
    GameObject LoadUI(UI_MEMBER_LIST uiName)
    {
        string asset_name      = uiName.ToString();
        string asset_full_path = "";

#if UNITY_EDITOR
        if (ui_path_name.TryGetValue(asset_name, out asset_full_path) == false)
        {
            Debug.LogErrorFormat("Can not Find UI Asset : {0}", asset_name);
        }
#endif
        GameObject prefab = AT.AssetManager.AssetManager.Instance.LoadAsset <GameObject>(AT.AssetManager.AssetManager.PREFAB_UI, asset_name, asset_full_path);
        if (prefab == null)
        {
            return(null);
        }

        GameObject go = null;
        if (UI_MEMBER_LIST.SCENE_POPUP < uiName && uiName < UI_MEMBER_LIST.MAX_SCENE_POPUP)
        {
            go = NGUITools.AddChild(_trScenePopup.gameObject, prefab);
            _scenePopups[uiName] = go;
        }

        else if (UI_MEMBER_LIST.SCENE_PANEL < uiName && uiName < UI_MEMBER_LIST.MAX_SCENE_PANEL)
        {
            go = NGUITools.AddChild(_trScenePanel.gameObject, prefab);
            _scenePanels[uiName] = go;
        }

        go.SetActive(false);
        return(go);
    }
Пример #3
0
 public void DestoryUI(UI_MEMBER_LIST uiName)
 {
     if (_scenePanels.ContainsKey(uiName) && _scenePanels[uiName] != null)
     {
         Destroy(_scenePanels[uiName]);
         _scenePanels[uiName] = null;
     }
 }
Пример #4
0
    public static ReservePopup Create(UI_MEMBER_LIST uiName, string callMethodName = "", object param = null)
    {
        ReservePopup reserve = new ReservePopup
        {
            _popupName      = uiName,
            _callMethodName = callMethodName,
            _param          = param
        };

        return(reserve);
    }
Пример #5
0
    public T GetUI <T> (UI_MEMBER_LIST uiName) where T : UIBase
    {
        GameObject go = GetUI(uiName);

        if (go != null)
        {
            return(go.GetComponent <T>());
        }

        Debug.LogErrorFormat("UIManager.GetUI<{1}> in {0}", uiName, typeof(T).Name);
        return(null);
    }
Пример #6
0
    public GameObject GetUI(UI_MEMBER_LIST uiName)
    {
        if (_commonPanels.ContainsKey(uiName))
        {
            return(_commonPanels[uiName]);
        }

        if (_commonPopups.ContainsKey(uiName))
        {
            return(_commonPopups[uiName]);
        }

        if (UI_MEMBER_LIST.SCENE_PANEL < uiName && uiName < UI_MEMBER_LIST.MAX_SCENE_PANEL)
        {
            if (_scenePanels.ContainsKey(uiName))
            {
                if (_scenePanels[uiName] == null)
                {
                    return(LoadUI(uiName));
                }
                else
                {
                    return(_scenePanels[uiName]);
                }
            }
        }

        if (UI_MEMBER_LIST.SCENE_POPUP < uiName && uiName < UI_MEMBER_LIST.MAX_SCENE_POPUP)
        {
            if (_scenePopups.ContainsKey(uiName))
            {
                if (_scenePopups[uiName] == null)
                {
                    return(LoadUI(uiName));
                }
                else
                {
                    return(_scenePopups[uiName]);
                }
            }
        }

        return(null);
    }
Пример #7
0
    public bool IsActive(UI_MEMBER_LIST uiName)
    {
        if (_scenePanels.ContainsKey(uiName))
        {
            if (_scenePanels[uiName] != null)
            {
                return(_scenePanels[uiName].activeSelf);
            }
        }
        else if (_scenePopups.ContainsKey(uiName))
        {
            if (_scenePopups[uiName] != null)
            {
                return(_scenePopups[uiName].activeSelf);
            }
        }

        return(false);
    }
Пример #8
0
    public GameObject ShowUI(UI_MEMBER_LIST uiName, bool hideOthers = false)
    {
        GameObject go = GetUI(uiName);

        if (go != null)
        {
            if (go.GetComponent <UIBase>() != null)
            {
                go.GetComponent <UIBase>().Show();
            }
            else
            {
                go.SetActive(true);
            }
            return(go);
        }

        return(null);
    }