/// <summary> /// 加载关键性资源 /// </summary> public static IEnumerator LoadRequiredResource() { if (!s_IsInitRequiredRes) { s_IsInitingRequiredRes = true; s_IsInitRequiredRes = true; //while (!WWWDownLoaderConfig.IsVersionConfigInfoReady) //{ // yield return null; //} IEnumerator itor = LoadStaticData(); while (itor.MoveNext()) { yield return(null); } itor = UIWndLoader.LoadUIConfig(CommonValue.UIDir, CommonValue.InUIDir, CommonValue.NetUIDir); while (itor.MoveNext()) { yield return(null); } s_IsInitingRequiredRes = false; } else { while (s_IsInitingRequiredRes) { yield return(null); } } }
IEnumerator PrepareWndAsync(UIFlag uiID) { if (uiID != UIFlag.none) { UIWnd uiWnd = GetUIWnd(uiID); if (uiWnd == null) { if (!IsUICaching(uiID)) { m_lstCacheUIID.Add(uiID); IEnumerator itor = UIWndLoader.LoadUIWndAsync(uiID.ToString(), false); while (itor.MoveNext()) { yield return(null); } uiWnd = GetUIWnd(uiID); if (uiWnd != null) { uiWnd.gameObject.SetActive(false); } else { Debug.LogError("prepare ui failed: " + uiID.ToString()); } } } } }
/// <summary> /// 初始化loader路径 /// </summary> public static void InitGameLoader() { AnimationLoader.InitAniLoader( CommonValue.AniDir, CommonValue.AniWWWDir, CommonValue.InAniDir, CommonValue.InAniWWWDir, CommonValue.NetAniDir); BoneLoader.InitPlayerBone( CommonValue.BoneDir, CommonValue.BoneWWWDir, CommonValue.InBoneDir, CommonValue.InBoneWWWDir, CommonValue.NetBoneDir); ModelLoader.InitModelLoader( CommonValue.MaterialDir, CommonValue.MaterialWWWDir, CommonValue.InMaterialDir, CommonValue.InMaterialWWWDir, CommonValue.NetMaterialDir); SkinnLoader.InitSkinLoader( CommonValue.MaterialDir, CommonValue.MaterialWWWDir, CommonValue.InMaterialDir, CommonValue.InMaterialWWWDir, CommonValue.NetMaterialDir); UIWndLoader.InitUIWndLoader( CommonValue.UIDir, CommonValue.UIWWWDir, CommonValue.InUIDir, CommonValue.InUIWWWDir, CommonValue.NetUIDir); UIAtlasLoader.InitUIAtlasLoader( CommonValue.UIAtlasDir, CommonValue.UIAtlasWWWDir, CommonValue.InUIAtlasDir, CommonValue.InUIAtlasWWWDir, CommonValue.NetUIAtlasDir); ExtraLoader.InitExtraLoader( CommonValue.UITextureDir, CommonValue.UITextureWWWDir, CommonValue.InUITextureDir, CommonValue.InUITextureWWWDir, CommonValue.NetUITextureDir); SceneLoader.InitSceneLoader( CommonValue.StageWWWDir, CommonValue.StageDir, CommonValue.InStageWWWDir, CommonValue.InStageDir, CommonValue.NetStageDir ); }
IEnumerator DownLoadWndSync(UIFlag uiID) { if (uiID != UIFlag.none)//正确的ID; { IEnumerator itor = UIWndLoader.DownLoadUIWndAsync(uiID.ToString()); while (itor.MoveNext()) { yield return(null); } } }
IEnumerator DestoryAllWndAsync() { UICoroutine.uiCoroutine.gameObject.SetActive(false); //停止所有UICoroutine UICoroutine.uiCoroutine.gameObject.SetActive(true); int showIDCount = m_lstShowUIID.Count; for (int i = 0; i < showIDCount; ++i) { UIFlag hideID = m_lstShowUIID[i]; UIWnd hideWnd = GetUIWnd(hideID); if (hideWnd != null) { hideWnd.OnHideWnd(); hideWnd.gameObject.SetActive(false); } } m_lstShowUIID.Clear(); Dictionary <UIFlag, UIWnd> mapAllMap = new Dictionary <UIFlag, UIWnd>(m_mapAllUIWnd); m_mapAllUIWnd.Clear(); m_lstCacheUIID.Clear(); foreach (KeyValuePair <UIFlag, UIWnd> kvp in mapAllMap) { if (kvp.Value != null && kvp.Value.gameObject) { GameObject.Destroy(kvp.Value.gameObject); yield return(null); //wait for a frame } UIWndLoader.ReleaseUIWnd(kvp.Key.ToString()); } mapAllMap.Clear(); ////DynamicPrefabMgr.Instance.OnDestroyUI(); UIWndLoader.ReleaseAllUIWnd(); //check again UIAtlasLoader.ReleaseAllAtlas(); //TipsBoxMgr.HideAllTipsBox(); //MsgWaitMgr.StopWaiting(); //LoadingMgr.HideViolently(); }
/// <summary> /// 加载公共UI资源 /// </summary> public static IEnumerator LoadCommonUI() { if (!s_IsInitCommUIRes) { s_IsInitingCommUIRes = true; s_IsInitCommUIRes = true; IEnumerator itor = UIWndLoader.LoadMainWndAsync(); while (itor.MoveNext()) { yield return(null); } s_IsInitingCommUIRes = false; } else { while (s_IsInitingCommUIRes) { yield return(null); } } }
/// <summary> /// 加载UI资源 /// </summary> public static IEnumerator LoadUIResource() { if (!s_IsInitUIRes) { s_IsInitUIRes = true; s_IsInitingUIRes = true; IEnumerator itor = ShaderLoader.LoadAllShader( CommonValue.ShaderDir, CommonValue.ShaderWWWDir, CommonValue.InShaderDir, CommonValue.InShaderWWWDir, CommonValue.NetShaderDir); while (itor.MoveNext()) { yield return(null); } //IEnumerator itor; itor = UIWndLoader.PrepareUI(); while (itor.MoveNext()) { yield return(null); } s_IsInitingUIRes = false; } else { while (s_IsInitingUIRes) { yield return(null); } } }