public T Get(string resName, Transform trans = null)
        {
            // Get resource path by resource name or default resource name
            var resPath = _resGetter.GetResPath(resName);

            if (resPath == null)
            {
                Watchdog.LogWarning("Get", resName + " not found");
                resPath = _resGetter.GetResPath(_defaultResName);
            }

            if (resPath == null)
            {
                return(default(T));
            }

            if (!_resDic.ContainsKey(resPath))
            {
                _resDic.Add(resPath, Resources.Load <T>(resPath));
            }

            var loaded = _resDic[resPath];

            if (_isGameObjectContainer)
            {
                return(_pool.Get(loaded as GameObject, trans) as T);
            }

            return(loaded);
        }
Exemple #2
0
            public bool Realize()
            {
                if (IsRealized)
                {
                    return(false);
                }

                // Create content
                CurContent = Pool.Get(ListViewItem.gameObject, Parent);
                CurContent.transform.localPosition = LocalPosition;

                Update();

                IsRealized = true;

                return(true);
            }