Example #1
0
        public override bool LoadSync()//同步加载
        {
            if (string.IsNullOrEmpty(m_AssetBundleName))
            {
                return(false);
            }

            AssetBundleRes abRes = ResMgr.S.GetRes(m_AssetBundleName) as AssetBundleRes;

            //AssetBundleRes abRes = ResMgr.S.GetRes<AssetBundleRes>(m_AssetBundleName);

            if (abRes == null || abRes.assetBundle == null)
            {
                Log.e("#Failed to Load Asset,Not Find AB :" + m_AssetBundleName);
                return(false);
            }

            Object asset = abRes.assetBundle.LoadAsset(m_Name);

            if (asset == null)
            {
                Log.e("#Failed To Load Assset:" + m_Name);
                return(false);
            }
            m_Asset = asset;
            return(true);
        }
Example #2
0
        public static AssetBundleRes Allocate(string name)
        {
            AssetBundleRes res = ObjectPool <AssetBundleRes> .S.Allocate();

            if (res != null)
            {
                res.name = name;
                res.InitAssetBundleName();
            }
            return(res);
        }
Example #3
0
            public IRes CreateRes(string name)
            {
                AssetData data = AssetDataTable.S.GetAssetData(name);

                switch (data.assetType)
                {
                case eResType.kAssetBundle:
                    return(AssetBundleRes.Allocate(name));

                case eResType.kABAsset:
                    return(AssetRes.Allocate(name));

                default:
                    return(null);
                }
            }