public static T GetILRComponent <T>(this UIControllerILR ilr) where T : Component { T ilinstance = ilr.ilinstance as T; if (ilinstance == null) { ilr.ILRObjInit(); ilinstance = ilr.ilinstance as T; } return(ilinstance); }
bool CheckPloaded(PrefabCreator[] pcs, PrefabLoader[] loaders, PloadData data) { bool isPloaded = true; for (int i = 0; i < pcs.Length; i++) { if (!pcs[i].isCurrendAssetLoaded) { isPloaded = false; break; } } if (isPloaded) { for (int i = 0; i < loaders.Length; i++) { if (!loaders[i].IsAssetLoaded) { isPloaded = false; break; } } } if (isPloaded) { if (m_IsPloadedHandler != 0) { ILRTimerManager.instance.RemoveTimer(m_IsPloadedHandler); m_IsPloadedHandler = 0; } if (data.IsHotfix) { if (data.Go.GetComponent <UIControllerILR>() == null) { UIControllerILR ucr = data.Go.AddComponent <UIControllerILR>(); ucr.hotfixClassPath = hotfixClassPath; ucr.ILRObjInit(); } else { UIControllerILR ucr = data.Go.GetComponent <UIControllerILR>(); ucr.ILRObjInit(); } } OnAssetProcess(data.AssetName, data.Go); } return(isPloaded); }
/// <summary> /// 对加载预制完成的数据进行处理(热更的处理,预制嵌套的处理等) /// </summary> /// <param name="isHotfix"></param> /// <param name="assetName"></param> /// <param name="go"></param> /// <returns></returns> IEnumerator Process(bool isHotfix, string assetName, GameObject go) { if (isHotfix) { while (!HotfixILRManager.GetInstance().IsInit) { yield return(null); } } PrefabCreator[] pcs = go.GetComponentsInChildren <PrefabCreator>(true); for (int i = 0; i < pcs.Length; i++) { pcs[i].LoadAsset(); } PrefabLoader[] loaders = go.GetComponentsInChildren <PrefabLoader>(true); for (int i = 0; i < loaders.Length; i++) { loaders[i].LoadPrefab(); } bool isPloaded = false; while (!isPloaded) { isPloaded = true; for (int i = 0; i < pcs.Length; i++) { if (!pcs[i].isCurrendAssetLoaded) { isPloaded = false; break; } } if (!isPloaded) { yield return(null); } } bool isLoaded = false; while (!isLoaded) { isLoaded = true; for (int i = 0; i < loaders.Length; i++) { if (!loaders[i].IsAssetLoaded) { isLoaded = false; break; } } if (!isLoaded) { yield return(null); } } if (isHotfix) { if (go.GetComponent <UIControllerILR>() == null) { UIControllerILR ucr = go.AddComponent <UIControllerILR>(); ucr.hotfixClassPath = hotfixClassPath; ucr.ILRObjInit(); } else { UIControllerILR ucr = go.GetComponent <UIControllerILR>(); ucr.ILRObjInit(); } } OnAssetProcess(assetName, go); }