Пример #1
0
        public override IEnumerator LoadResource(IInfoData iData, LoadBundleFinish delFinish, object param1, object param2)
        {
            UIInfoData infoData = iData as UIInfoData;

            if (infoData == null)
            {
                yield break;
            }

#if UNITY_EDITOR
            if (PlayerSetting.SimulateAssetBundleInEditor)
            {
                string     assertMainPath = GetBundleLoadUrl(infoData.path, infoData.name + ".prefab");
                GameObject objectRet      = AssetDatabase.LoadAssetAtPath <GameObject>(assertMainPath);

                if (objectRet == null)
                {
                    Debug.Log(infoData.name);
                }
                delFinish(infoData, objectRet, param1, param2);
                yield break;
            }
#endif
            yield return(LoadManifest());

            yield return(LoadCommonUI());

            string bundleName = infoData.GetBundleName().ToLower();

            yield return(LoadPrefabUI(bundleName, true, true));

            yield return(LoadGameObject(bundleName, infoData, delFinish, param1, param2));

            yield return(null);
        }
Пример #2
0
        public IEnumerator LoadGameObject(string bundleName, UIInfoData infoData,
                                          LoadBundleFinish delFinish, object param1, object param2, bool isAync = true)
        {
            GameObject retObj = null;

            if (m_UIBundleCache.ContainsKey(bundleName))
            {
                AssetBundle bundle = m_UIBundleCache[bundleName].UICachedAssetBundle;
                if (isAync)
                {
                    AssetBundleRequest req = bundle.LoadAssetAsync(infoData.name, typeof(GameObject));
                    yield return(req);

                    retObj = req.asset as GameObject;
                }
                else
                {
                    retObj = bundle.LoadAsset(infoData.name, typeof(GameObject)) as GameObject;
                }

                if (null != delFinish)
                {
                    delFinish(infoData, retObj, param1, param2);
                }
            }
        }
Пример #3
0
        public IEnumerator OnUIDestroy(string uiName)
        {
            yield return(0);

            UIInfoData infoData = UIInfoData.GetUIInfoDataByPrefabStr(uiName);

            if (infoData == null)
            {
                yield break;
            }

            ReleaseOneUIBundle(infoData.GetBundleName());
        }