public void ReceiveNativeMessage(string str) { //Debug.Log("Receive from plugin " + str); string[] msg = str.Split(spliter); //Debug.Log(msg[0]+" "+ msg[1]); Dispather.DispathMsg(msg[0], msg[1]); }
private void FixedUpdate() { if (VRApplication.IsOffline) { return; } if (Reachability != lastState) { Events.DispathMsg(EVENT_STATUS_CHANGED, Reachability); lastState = Reachability; } if (Reachability == NetworkReachability.NotReachable && !GlobalUIManager.Instance.IsShown()) { GlobalUIManager.Instance.Show(Localization.Get(R.Lang.NoNetWorkError), null, null, string.Empty, string.Empty, GlobalUIIcon.NoNetwrok); } }
private IEnumerator RunLoad <T>(string scenePath, object bundle, string transition = TransitionFactory.FadeTransition) where T : IScene { if (IsLoading) { Debug.LogWarning("Scenes is loading, do not load again"); yield break; } isLoading = true; var lst = curScene; if (lst != null) { //VRProfiler.StartWatch(string.Format("[LoadingScene] Scene: {0} UnLoad ", lst.Name)); Events.DispathMsg(Event_OnUnload, lst.Name); lst.Unload(); //VRProfiler.StopWatch(); } //VRProfiler.StartWatch("[LoadingScene] Transition In "); curScene = null; if (null == mask) { mask = TransitionFactory.CreateTransition(transition); } mask.DontDestroyOnLoad(); SetRaycast(false); yield return(mask.TransitIn(TransitionLength)); //VRProfiler.StopWatch(); //VRProfiler.StartWatch("[LoadingScene] Switch To Scene: Loading "); //销毁场景物件 if (lst != null) { Destroy(lst.UnityObject); } //切换至空场景 UnitySceneMgr.LoadScene(VRScene.Loading); //VRProfiler.StopWatch(); //VRProfiler.StartWatch("[LoadingScene] Unload Unused Assets "); //资源回收 yield return(1); yield return(Resources.UnloadUnusedAssets()); GC.Collect(); //VRProfiler.StopWatch(); //VRProfiler.StartWatch(string.Format("[LoadingScene] Switch to Scene:{0} ",scenePath)); //切换下一场景 yield return(UnitySceneMgr.LoadSceneAsync(scenePath)); SetRaycast(true); //场景handler curScene = GetMissingSceneObj <T>(); curScene.Name = scenePath; curScene.gameObject.name = curScene.GetType().Name; //配置场景相关内容 curScene.name = "[scene] " + curScene.Name; // VRProfiler.StopWatch(); //场景加载完成 isLoading = false; //VRProfiler.StartWatch(string.Format("[LoadingScene] Scene: {0} Preload ", curScene.Name)); curScene.Preload(bundle); //VRProfiler.StopWatch(); //等待场景 //VRProfiler.StartWatch(string.Format("[LoadingScene] Scene: {0} Wait ", curScene.Name)); yield return(curScene.Wait()); // VRProfiler.StopWatch(); //VRProfiler.StartWatch(string.Format("[LoadingScene] Scene: {0} Loaded ", curScene.Name)); curScene.Loaded(); Events.DispathMsg(Event_OnLoaded, curScene.Name); //VRProfiler.StopWatch(); //VRProfiler.StartWatch("[LoadingScene] Transition Out "); //黑幕打开 if (null != mask) { yield return(mask.TransitOut(TransitionLength)); mask.DestroySelf(); mask = null; } //VRProfiler.StopWatch(); yield return(1); //加载完成 curScene.Opened(); }
protected void PostTextureMessage(string msg, Texture texture) { dispather.DispathMsg(msg, texture); dispather.ClearListeners(msg); }