コード例 #1
0
        public IRes GetRes(string ownerBundleName, string assetName, bool createNew = false)
        {
            IRes res;

            if (mResDictionary.TryGetValue((ownerBundleName + assetName).ToLower(), out res))
            {
                return(res);
            }

            if (!createNew)
            {
                return(null);
            }

            res = ResFactory.Create(assetName, ownerBundleName);

            if (res != null)
            {
                mResDictionary.Add((ownerBundleName + assetName).ToLower(), res);
                if (!mResList.Contains(res))
                {
                    mResList.Add(res);
                }
            }
            return(res);
        }
コード例 #2
0
        public IRes GetRes(string assetName, bool createNew = false)
        {
            IRes res = null;

            if (mResDictionary.TryGetValue(assetName, out res))
            {
                return(res);
            }

            if (!createNew)
            {
                Log.I("createNew:{0}", createNew);
                return(null);
            }

            res = ResFactory.Create(assetName);

            if (res != null)
            {
                mResDictionary.Add(assetName, res);
                mResList.Add(res);
                if (!mResList.Contains(res))
                {
                    mResList.Add(res);
                }
            }
            return(res);
        }
コード例 #3
0
        public IRes GetRes(ResSearchRule resSearchRule, bool createNew = false)
        {
            IRes res = null;

            if (mResDictionary.TryGetValue(resSearchRule.DictionaryKey, out res))
            {
                return(res);
            }

            if (!createNew)
            {
                QFramework.Log.I("createNew:{0}", createNew);
                return(null);
            }

            res = ResFactory.Create(resSearchRule);

            if (res != null)
            {
                mResDictionary.Add(resSearchRule.DictionaryKey, res);
                if (!mResList.Contains(res))
                {
                    mResList.Add(res);
                }
            }
            return(res);
        }
コード例 #4
0
        private Res CreateRes(string assetName, string ownerBundle = null)
        {
            var res = ResFactory.Create(assetName, ownerBundle);

            ResMgr.Instance.SharedLoadedReses.Add(res);

            AddRes2Record(res);

            return(res);
        }
コード例 #5
0
        // Use this for initialization
        void Start()
        {
            // 添加创建器
            ResFactory.AddResCreator <MyResCreator>();

            var resLoader = ResLoader.Allocate();

            var resSearchKeys = ResSearchKeys.Allocate("myres://hello_world");

            var myRes = resLoader.LoadResSync(resSearchKeys);

            resSearchKeys.Recycle2Cache();

            Debug.Log(myRes.AssetName);
            Debug.Log(myRes.State);
        }
コード例 #6
0
ファイル: ResMgr.cs プロジェクト: zuojiashun/FrameWorkStudy
        public IRes GetRes(string name, bool createNew = false)
        {
            IRes res = null;

            if (m_ResDictionary.TryGetValue(name, out res))
            {
                return(res);
            }

            if (!createNew)
            {
                return(null);
            }

            res = ResFactory.Create(name);

            if (res != null)
            {
                m_ResDictionary.Add(name, res);
                m_ResList.Add(res);
            }
            return(res);
        }
コード例 #7
0
ファイル: ResMgr.cs プロジェクト: gKev1n/UnityFrameWorkDesign
        public IRes GetRes(ResSearchKeys resSearchKeys, bool createNew = false)
        {
            var res = mTable.GetResBySearchKeys(resSearchKeys);

            if (res != null)
            {
                return(res);
            }

            if (!createNew)
            {
                Log.I("createNew:{0}", createNew);
                return(null);
            }

            res = ResFactory.Create(resSearchKeys);

            if (res != null)
            {
                mTable.Add(res);
            }

            return(res);
        }