private void CreateGUIWindow <T>(string name, bool showLoading, CreateGUICallback <T> callback) where T : GUIWindow { _mCreateGUIQueue.Enqueue(DoCreateGUIWindow <T>(name, showLoading, callback)); // tzz added for requireing window create Statistics.INSTANCE.GUIWndRequireCreateWnd(name); }
IEnumerator DoCreateGUIWindow <T> (string name, bool showLoading, CreateGUICallback <T> callback) where T : GUIWindow { if (GameDefines.USE_ASSET_BUNDLE) { if (!Globals.Instance.MBundleManager.CheckLocalLevelExist(name)) { if (Globals.Instance.MBundleManager.GetBundle(name) == null) { List <string> resList = new List <string>(); resList.Add(name); while (!Globals.Instance.MBundleManager.LoadBundles(resList.ToArray(), true)) { yield return(new WaitForSeconds(0.1f)); } while (true) { if (Globals.Instance.MBundleManager.GetIsDone() == BundleManager.LoadResultEnum.SUCC) { break; } else if (Globals.Instance.MBundleManager.GetIsDone() == BundleManager.LoadResultEnum.FAIL) { Debug.LogError("load scene error" + name); } yield return(new WaitForSeconds(0.1f)); } } } } // tzz modified for showloading parameter if (null != radarScaning && showLoading) { radarScaning.SetVisible(true); } AsyncOperation asynOp = Application.LoadLevelAdditiveAsync(name); while (!asynOp.isDone) { yield return(null); } // tzz modified to comment following statement // the GUIRadarScan.Hide() was called in GUIWindow.Start function // // if (null != radarScaning) // radarScaning.SetVisible(false); // Resolve the bug: the gui GameObject maybe delete when change different level. // yield return null; // Call callback T gui = null; GameObject go = GameObject.Find(name); if (null != go) { gui = go.GetComponent <T>() as T; } else { Debug.Log("[GUIManager:] Cann't find the gui " + name); } if (null != gui) { callback(gui); if (Globals.Instance.MTeachManager != null) { Globals.Instance.MTeachManager.NewOpenWindowEvent(gui.name); } } // tzz added for requireing window create Statistics.INSTANCE.GUIWndCreatedWnd(name); }