示例#1
0
        public ResLoader Load(string resPath, bool loadAll = false)
        {
            ResLoader ret = null;

            if (!resPath.Filled())
            {
                Logger.Log("resPath no Filled");
                return(ret);
            }
            if (sMap.TryGetValue(resPath, out ret))
            {
                return(ret);
            }
            else
            {
#if USE_ASSETBUNDLE
                ret = ResLoader.Get();
                sMap.Add(resPath, ret);
                ret.ResPath = resPath;
                if (File.Exists(ret.RealPath))
                {
                    ret.LoadFromBundle();
                }
                else
                {
                    ret.LoadFromResource();
                }
#else
                ret = LoadFromResource(resPath, loadAll);
#endif
            }
            return(ret);
        }//end Load
示例#2
0
        }//end Load

        /// <summary>
        /// 加载资源
        /// </summary>
        /// <param name="resPath"></param>
        /// <returns></returns>
        public ResLoader LoadFromResource(string resPath, bool loadAll = false)
        {
            ResLoader ret = null;

            if (sMap.TryGetValue(resPath, out ret))
            {
                return(ret);
            }
            else
            {
                ret = ResLoader.Get();
                sMap.Add(resPath, ret);
                ret.ResPath = resPath;
                ret.LoadFromResource();
                if (loadAll)
                {
                    ret.LoadAll();
                }
            }
            return(ret);
        }//end Load