public GameObject GetSingleUI(UIType uiType)
 {
     if (_UIDict.ContainsKey(uiType) == false || _UIDict[uiType] == null)
     {
         GameObject go = GameObject.Instantiate(Resources.Load<GameObject>(uiType.Path)) as GameObject;
         go.transform.SetParent(_canvas, false);
         go.name = uiType.Name;
         _UIDict.AddOrReplace(uiType, go);
         return go;
     }
     return _UIDict[uiType];
 }
        public void DestroySingleUI(UIType uiType)
        {
            if (!_UIDict.ContainsKey(uiType))
            {
                return;
            }

            if (_UIDict[uiType] == null)
            {
                _UIDict.Remove(uiType);
                return;
            }

            GameObject.Destroy(_UIDict[uiType]);
            _UIDict.Remove(uiType);
        }
Exemple #3
0
 public GameObject GetSingleUI(UIType uiType)
 {
     if (_UIDict.ContainsKey(uiType) == false || _UIDict[uiType] == null)
     {
         //GameObject go = GameObject.Instantiate(Resources.Load<GameObject>(uiType.Path)) as GameObject;
         AssetBundle bundle = AssetManager.GetInstance().GetAsset(uiType.Path);
         GameObject  go     = GameObject.Instantiate(bundle.LoadAsset(uiType.Name)) as GameObject;
         if (_canvas == null)
         {
             _canvas = GameObject.Find("Canvas").transform;
         }
         go.transform.SetParent(_canvas, false);
         go.name = uiType.Name;
         _UIDict.AddOrReplace(uiType, go);
         return(go);
     }
     return(_UIDict[uiType]);
 }
Exemple #4
0
        public void DestroySingleUI(UIType uiType)
        {
            if (!_UIDict.ContainsKey(uiType))
            {
                return;
            }

            if (_UIDict[uiType] == null)
            {
                _UIDict.Remove(uiType);
                _UIResDict.Remove(uiType);
                return;
            }

            GameObject.Destroy(_UIDict[uiType]);
            SEUResource.UnLoadResource(_UIResDict[uiType]);

            _UIDict.Remove(uiType);
            _UIResDict.Remove(uiType);
        }
Exemple #5
0
 public BaseContext(UIType viewType)
 {
     ViewType = viewType;
 }
 public BaseContext(UIType viewType)
 {
     ViewType = viewType;
 }