public DTOResponse OrderSenceMode(SceneRequest request) { DTOResponse dtoResponse = new DTOResponse(); try { using (IDbConnection dbConnection = HelperConnection.GetConnectionFactory().OpenDbConnection()) { using (IDbTransaction trans = dbConnection.OpenTransaction()) { dtoResponse = this.OrderSenceMode(request, dbConnection, trans); if (dtoResponse.IsSuccess) { trans.Commit(); } else { trans.Rollback(); } SysSceneService.logger.Info((object)dtoResponse.ToString()); return(dtoResponse); } } } catch (Exception ex) { dtoResponse.IsSuccess = false; dtoResponse.MessageText = ex.Message; SysSceneService.logger.Error((object)ex); return(dtoResponse); } }
private static IEnumerator WaitForSceneLoad(SceneRequest req, bool transitionOnSame) { var currScene = SceneManager.GetActiveScene().name; float waitOut = 0f; if (transitionOnSame || currScene != req.scene.sceneName) { var transition = req.scene.transitionIn == null ? defaultTransition : req.scene.transitionIn; CameraTransition.Fade(transition, out float waitIn, out waitOut); Log.Unity($"Performing fade transition for {waitIn}s before loading scene."); for (; waitIn > ETime.FRAME_YIELD; waitIn -= ETime.FRAME_TIME) { yield return(null); } } Log.Unity($"Scene loading for {req} started.", level: Log.Level.DEBUG3); StaticPreSceneUnloaded(); var op = SceneManager.LoadSceneAsync(req.scene.sceneName); while (!op.isDone) { yield return(null); } Log.Unity( $"Unity finished loading the new scene. Waiting for transition ({waitOut}s) before yielding control to player.", level: Log.Level.DEBUG3); req.onLoaded?.Invoke(); for (; waitOut > ETime.FRAME_YIELD; waitOut -= ETime.FRAME_TIME) { yield return(null); } req.onFinished?.Invoke(); EngineStateManager.SetLoading(false, () => LOADING = false); }
public object Any(SceneRequest request) { DTOResponseLayUI dtoResponseLayUi = new DTOResponseLayUI(); SysSceneService sceneService = new SysSceneService(); DTOResponse response = (DTOResponse)null; if (request.ACTION == 100) { response = sceneService.GetSceneList(request); } else if (request.ACTION != 1) { if (request.ACTION == OPAction.UPDATE) { response = sceneService.SaveEntity(request); } else if (request.ACTION != 3) { if (request.ACTION == 101) { response = sceneService.OrderSenceMode(request); } else { dtoResponseLayUi.code = -1; dtoResponseLayUi.msg = "未定义的操作类型:" + request.ACTION.ToString(); return(dtoResponseLayUi); } } } return(this.ConvertTo(response)); }
public DTOResponse SaveEntity(SceneRequest request) { DTOResponse dtoResponse = new DTOResponse(); try { SysSceneEntity uldScene = JsonSerializer.DeserializeFromString <SysSceneEntity>(request.PostData); if (request.PostData == null) { dtoResponse.IsSuccess = false; dtoResponse.MessageText = "传入的数据为空!"; return(dtoResponse); } int num = 0; using (IDbConnection dbConn = HelperConnection.GetConnectionFactory().OpenDbConnection()) num = dbConn.Update <SysSceneEntity>(uldScene, (Action <IDbCommand>)null); dtoResponse.IsSuccess = true; dtoResponse.MessageText = "保存数据操作成功!" + num.ToString(); return(dtoResponse); } catch (Exception ex) { dtoResponse.IsSuccess = false; dtoResponse.MessageText = ex.Message; SysSceneService.logger.Error((object)ex); return(dtoResponse); } }
public override void Update() { if (this.mAsyncOp != null) { if (this.mAsyncOp.canBeActivated) { this.mAsyncOp.ActivateScene(); } if (!this.mAsyncOp.isDone) { return; } if (this.FadeIn) { GameUtility.FadeIn(this.FadeInTime); } CriticalSection.Leave(CriticalSections.SceneChange); this.mAsyncOp = (SceneRequest)null; } else { if (this.WaitFadeIn && GameUtility.IsScreenFading && this.FadeIn) { return; } this.ActivateNext(); } }
public void RequestIndoorScene(String sceneName) { m_lastRequest = sceneName; if (LoadingScene != null) { return; } Int32 num = m_indoorScenes.FindIndex((IndoorCache a) => a.Key == sceneName); IndoorCache indoorCache = default(IndoorCache); if (num >= 0) { indoorCache = m_indoorScenes[num]; } else if (m_indoorScenes.Count >= 1) { IndoorSceneRoot rootScene = m_indoorScenes[0].RootScene; Helper.DestroyGO <IndoorSceneRoot>(ref rootScene); Resources.UnloadUnusedAssets(); m_indoorScenes.RemoveAt(0); } if (!indoorCache.IsLoading && indoorCache.RootScene == null) { if (num >= 0) { m_indoorScenes[num] = new IndoorCache(sceneName, null, true); } else { m_indoorScenes.Add(new IndoorCache(sceneName, null, true)); } SceneRequest sceneRequest = null; if (LegacyLogic.Instance.ModController.InModMode) { sceneRequest = AssetBundleManagers.Instance.Mod.RequestScene(sceneName, 10, new SceneRequestCallback(OnSceneBundleLoaded), null); } if (sceneRequest == null) { sceneRequest = AssetBundleManagers.Instance.Main.RequestScene(sceneName, 10, new SceneRequestCallback(OnSceneBundleLoaded), null); } if (sceneRequest == null) { Debug.LogError("Fail load indoor scene '" + sceneName + "'"); } LoadingScene = sceneName; } else if (FinishLoadIndoorScene != null && indoorCache.RootScene != null) { FinishLoadIndoorScene(this, new FinishLoadIndoorSceneEventArgs(indoorCache.RootScene)); } }
public static bool LoadScene(SceneRequest req) { if (!EngineStateManager.IsLoading && !LOADING) { Log.Unity($"Successfully requested scene load for {req}."); req.onQueued?.Invoke(); IsFirstScene = false; LOADING = true; EngineStateManager.SetLoading(true, null); SceneLoader.Main.RunRIEnumerator(WaitForSceneLoad(req, true)); return(true); } else { Log.Unity($"REJECTED scene load for {req}."); } return(false); }
private void InternalOnSceneActivate(SceneRequest req) { for (int index1 = 0; index1 < this.mScenes.Count; ++index1) { if (this.mScenes[index1].Request == req) { if (!req.isAdditive) { for (int index2 = 0; index2 < this.mScenes.Count; ++index2) { if (index1 != index2 && this.mScenes[index2].Request == null) { this.mScenes[index2].Drop(); } } } this.mScenes[index1].Request = (SceneRequest)null; break; } } }
public DTOResponse GetCurrent(SceneRequest request) { DTOResponse dtoResponse = new DTOResponse(); try { using (IDbConnection dbConn = HelperConnection.GetConnectionFactory().OpenDbConnection()) { List <SysSceneEntity> uldSceneList = dbConn.Select <SysSceneEntity>((Expression <Func <SysSceneEntity, bool> >)(x => x.SCENESTATE == "1")); dtoResponse.ResultObject = (object)uldSceneList; dtoResponse.IsSuccess = true; dtoResponse.MessageText = "查询操作成功!"; } } catch (Exception ex) { dtoResponse.IsSuccess = false; dtoResponse.MessageText = ex.Message; SysSceneService.logger.Error((object)ex); } return(dtoResponse); }
public override void OnActivate() { this.Sequence.Scene = (GameObject)null; LightmapSettings.set_lightmapsMode((LightmapsMode)0); if (!string.IsNullOrEmpty(this.SceneID)) { if (this.FadeIn) { GameUtility.FadeOut(0.0f); } SceneAwakeObserver.AddListener(new SceneAwakeObserver.SceneEvent(this.OnSceneLoad)); CriticalSection.Enter(CriticalSections.SceneChange); this.mAsyncOp = AssetManager.LoadSceneAsync(this.SceneID, true); } else { if (!Object.op_Inequality((Object)this.Sequence.Scene, (Object)null)) { return; } this.Sequence.Scene = (GameObject)null; this.ActivateNext(); } }
private void StartSceneLoad(string sceneName) { this.mOp = this.SceneType != FlowNode_LoadScene.SceneTypes.Replace ? AssetManager.LoadSceneAsync(sceneName, true) : AssetManager.LoadSceneAsync(sceneName, false); this.mLoadStartTime = Time.get_time(); this.StartCoroutine(this.LoadLevelAsync()); }
public DTOResponse OrderSenceMode( SceneRequest request, IDbConnection db, IDbTransaction trans) { DTOResponse dtoResponse = new DTOResponse(); try { SysSceneEntity uldScene1 = OrmLiteReadExpressionsApi.Single <SysSceneEntity>(db, (Expression <Func <SysSceneEntity, bool> >)(x => x.ID == request.ID || x.SCENENO == request.SCENENO)); if (uldScene1 == null) { throw new Exception("获取场景为空!"); } if (uldScene1.SCENENO != request.SCENENO) { throw new Exception("传入的参数与后台不一致!"); } if (uldScene1.USESTATE != 1) { throw new Exception("当前模式" + uldScene1.SCENENO + "管理员未启用!请联系管理员!"); } INF_JOBDOWNLOADEntity jobdownloadEntity1 = new INF_JOBDOWNLOADEntity(); jobdownloadEntity1.ID = Utils.GetDateTimeGuid(); jobdownloadEntity1.GROUPID = "0"; //jobdownloadEntity1.JOBID = uldScene1.P01; //jobdownloadEntity1.EQUIPMENTID = uldScene1.P02; jobdownloadEntity1.WAREHOUSEID = "none"; jobdownloadEntity1.JOBTYPE = 4; jobdownloadEntity1.ORDERTYPE = 0; jobdownloadEntity1.SOURCE = "0"; //jobdownloadEntity1.TARGET = uldScene1.P02; jobdownloadEntity1.BRANDID = "0"; jobdownloadEntity1.PLANQTY = new Decimal?(new Decimal()); jobdownloadEntity1.PILETYPE = "0"; jobdownloadEntity1.PRIORITY = 1; jobdownloadEntity1.BARCODE = "0"; int id = uldScene1.ID; string str1 = id.ToString(); jobdownloadEntity1.TUTYPE = str1; jobdownloadEntity1.ENTERDATE = Utils.GetTodayNow(); jobdownloadEntity1.RESPONDDATE = (string)null; jobdownloadEntity1.RESPONDCOUNT = 1; jobdownloadEntity1.RESPONDMSG = ""; jobdownloadEntity1.STATUS = 0; jobdownloadEntity1.WEIGHT = new Decimal?(new Decimal()); jobdownloadEntity1.FULLCOUNT = 0; jobdownloadEntity1.EXTENDINFO = ""; jobdownloadEntity1.EXTATTR1 = ""; jobdownloadEntity1.EXTATTR2 = ""; jobdownloadEntity1.EXTATTR3 = ""; jobdownloadEntity1.CREATEDATE = Utils.GetTodayNow(); jobdownloadEntity1.CREATEUSERID = SysInfo.CurrentUserID; jobdownloadEntity1.CREATEUSERNAME = SysInfo.CurrentUserName; string emergencyexit = uldScene1.EMERGENCYEXIT; if (!string.IsNullOrEmpty(emergencyexit)) { string str2 = emergencyexit; char[] chArray = new char[1] { ',' }; foreach (string str3 in str2.Split(chArray)) { string item = str3; LocDetailEntity locationDetailEntity = OrmLiteReadExpressionsApi.Single <LocDetailEntity>(db, (Expression <Func <LocDetailEntity, bool> >)(x => x.GROUPNO == item)); if (locationDetailEntity != null) { locationDetailEntity.EMEXIT = "1"; db.UpdateOnly <LocDetailEntity>(locationDetailEntity, (Expression <Func <LocDetailEntity, object> >)(x => new { EMEXIT = x.EMEXIT }), (Expression <Func <LocDetailEntity, bool> >)null, (Action <IDbCommand>)null); } } } uldScene1.SCENESTATE = "1"; uldScene1.OPBY = SysInfo.CurrentUserName; uldScene1.OPDATE = Utils.GetTodayNow(); SysSceneEntity uldScene2 = uldScene1; id = uldScene1.ID; string str4 = "下达" + id.ToString() + "操作成功!"; uldScene2.OPMESSAGE = str4; // uldScene1.P10 = jobdownloadEntity1.ID; string sql = string.Format("UPDATE PROJ_ULDSCENE SET SCENESTATE='0',OPBY='{1}',OPDATE='{2}',OPMESSAGE='{3}' WHERE ID<>{0}", (object)uldScene1.ID, (object)SysInfo.CurrentUserName, (object)Utils.GetTodayNow(), (object)"场景切换"); long num1 = 0; //num1 = (long)db.SaveAll<INF_JOBDOWNLOADEntity>((IEnumerable<INF_JOBDOWNLOADEntity>)new List<INF_JOBDOWNLOADEntity>() //{ // jobdownloadEntity1 //}); int num2 = db.Update <SysSceneEntity>(uldScene1, (Action <IDbCommand>)null); int num3 = db.ExecuteSql(sql); dtoResponse.IsSuccess = true; dtoResponse.MessageText = "下达操作成功!" + num1.ToString() + "/" + num2.ToString() + "/" + num3.ToString(); SysSceneService.logger.Info((object)dtoResponse.ToString()); return(dtoResponse); } catch (Exception ex) { dtoResponse.IsSuccess = false; dtoResponse.MessageText = ex.Message; SysSceneService.logger.Error((object)ex); return(dtoResponse); } }
public static void OnSceneActivate(SceneRequest req) { AssetManager.Instance.InternalOnSceneActivate(req); }
private void Update() { if (m_CurrentOperation != null) { if (!m_CurrentOperation.isDone) { AsyncOperationProcess(); return; } AsyncOperationDone(); m_CurrentOperation = null; NextLoadState(); } switch (m_LoadState) { case ELoadingState.Initiated: NextLoadState(); break; case ELoadingState.LoadEmptyScene: Application.LoadLevel("Empty"); NextLoadState(); break; case ELoadingState.Skip: if (!String.IsNullOrEmpty(m_LastTargetScene)) { AssetBundleManagers.Instance.Main.UnloadAssetBundleByAssetName(m_LastTargetScene, true, false, true); AssetBundleManagers.Instance.Mod.UnloadAssetBundleByAssetName(m_LastTargetScene, true, false, true); } AssetBundleManagers.Instance.Main.UnloadManager(false); AssetBundleManagers.Instance.Mod.UnloadManager(false); NextLoadState(); break; case ELoadingState.GarbageCollecting: GC.Collect(); GC.WaitForPendingFinalizers(); GC.Collect(); NextLoadState(); break; case ELoadingState.UnloadUnusedAssets: m_CurrentOperation = Resources.UnloadUnusedAssets(); break; case ELoadingState.LoadTargetSceneAssetBundle: { SceneRequest sceneRequest = null; if (LegacyLogic.Instance.ModController.InModMode) { sceneRequest = AssetBundleManagers.Instance.Mod.RequestScene(m_TargetScene, 0, new SceneRequestCallback(OnSceneBundleLoaded), null); } if (sceneRequest == null) { sceneRequest = AssetBundleManagers.Instance.Main.RequestScene(m_TargetScene, 0, new SceneRequestCallback(OnSceneBundleLoaded), null); } if (sceneRequest == null) { Debug.LogError("Scene not in a assetbundle defined! \n" + m_TargetScene); m_LoadState = ELoadingState.UnloadBundles; } else { NextLoadState(); } break; } case ELoadingState.LoadTargetScene: m_CurrentOperation = Application.LoadLevelAsync(m_TargetScene); if (m_CurrentOperation == null) { Debug.LogError("Error load scene! \n" + m_TargetScene); NextLoadState(); } break; case ELoadingState.Skip2: NextLoadState(); break; case ELoadingState.UnloadUnusedAssets2: NextLoadState(); break; case ELoadingState.UnloadBundles: { Camera[] array = (Camera[])FindObjectsOfType(typeof(Camera)); for (Int32 i = 0; i < array.Length; i++) { if (!array[i].CompareTag("UICamera")) { array[i].enabled = false; } } GameObject gameObject = new GameObject(); Camera camera = gameObject.AddComponent <Camera>(); camera.fieldOfView = 180f; camera.nearClipPlane = 0f; camera.farClipPlane = 10000f; camera.useOcclusionCulling = false; RenderTexture temporary = RenderTexture.GetTemporary(1, 1, 0); temporary.isCubemap = true; camera.RenderToCubemap(temporary); temporary.Release(); RenderTexture.ReleaseTemporary(temporary); Destroy(gameObject); m_CurrentOperation = Resources.UnloadUnusedAssets(); break; } case ELoadingState.SceneLoaded: NextLoadState(); SceneLoadFinish(); break; } LegacyLogic.Instance.MapLoader.SceneLoaderProgress = (1f - (ELoadingState.Finish - m_LoadState) / 12f) * 0.5f; }
private void OnSceneBundleLoaded(SceneRequest p_args) { NextLoadState(); }
public override void Update(HomeWindow self) { if (this.state == 0) { self.mFadingOut = true; FlowNode_GameObject.ActivateOutputLinks((Component)self, 11); this.state = 1; } if (this.state == 1) { if (!AssetDownloader.isDone) { return; } if (AssetManager.IsAssetBundle(self.mDesiredSceneName)) { AssetManager.PrepareAssets(self.mDesiredSceneName); if (!AssetDownloader.isDone) { ProgressWindow.OpenGenericDownloadWindow(); AssetDownloader.StartDownload(false, true, ThreadPriority.Normal); this.state = 2; return; } } this.state = 3; } if (this.state == 2) { if (!AssetDownloader.isDone) { return; } ProgressWindow.Close(); this.state = 3; } if (this.state == 3) { self.mLastSceneName = self.mDesiredSceneName; this.req = AssetManager.LoadSceneAsync(self.mDesiredSceneName, true); this.state = 4; } if (this.state == 4) { if (!this.req.canBeActivated || self.mFadingOut || MonoSingleton <GameManager> .Instance.IsImportantJobRunning) { return; } if (!string.IsNullOrEmpty(self.UnloadTrigger)) { GlobalEvent.Invoke(self.UnloadTrigger, (object)this); } SceneAwakeObserver.AddListener(new SceneAwakeObserver.SceneEvent(this.OnSceneAwake)); this.req.ActivateScene(); if (!string.IsNullOrEmpty(self.mLastSceneName)) { AssetManager.UnloadScene(self.mLastSceneName); } this.state = 5; } if (this.state == 5) { if (Object.op_Equality((Object)this.mNewScene, (Object)null) || !this.req.isDone) { return; } CriticalSection.Leave(CriticalSections.SceneChange); this.state = 6; } if (this.state == 6) { if (CriticalSection.IsActive) { return; } GC.Collect(); this.asyncOp = AssetManager.UnloadUnusedAssets(); this.state = (MonoSingleton <GameManager> .Instance.Player.TutorialFlags & 1L) != 0L ? 7 : 101; } if (this.state == 7) { if (this.asyncOp != null && !this.asyncOp.get_isDone()) { return; } FlowNode_GameObject.ActivateOutputLinks((Component)self, 10); GameUtility.FadeIn(0.5f); self.mDesirdSceneSet = false; if (!self.mIgnorePopups && !self.mNewsShown && !GlobalVars.IsTitleStart.Get() && (MonoSingleton <GameManager> .Instance.Player.IsFirstLogin || GameUtility.isLoginInfoDisplay())) { self.mNewsShown = true; GlobalVars.IsTitleStart.Set(true); self.mStateMachine.GotoState <HomeWindow.State_LoginBonus>(); } else { self.NotifyNewFriendRequests(); if (HomeWindow.EnterHomeCount == 0) { self.CheckTrophies(); } if (!self.mNewsShown && !GlobalVars.IsTitleStart.Get() && (MonoSingleton <GameManager> .Instance.Player.IsFirstLogin || self.DebugLoginBonus)) { self.mNewsShown = true; Json_LoginBonus recentLoginBonus = MonoSingleton <GameManager> .Instance.Player.RecentLoginBonus; if (recentLoginBonus != null) { string iname; int num; if (recentLoginBonus.coin > 0) { iname = "$COIN"; num = recentLoginBonus.coin; } else { iname = recentLoginBonus.iname; num = recentLoginBonus.num; } ItemData data = new ItemData(); if (data.Setup(0L, iname, num)) { NotifyList.PushLoginBonus(data); } } self.NotifySupportResult(); } self.mStateMachine.GotoState <HomeWindow.State_Default>(); } if (self.mDesiredSceneIsHome) { self.UnlockContents(); self.FgGIDLoginCheck(); FlowNode_GameObject.ActivateOutputLinks((Component)self, 15); } else { FlowNode_GameObject.ActivateOutputLinks((Component)self, 16); } } if (this.state != 101) { return; } DebugUtility.LogWarning("TUTORIAL: HERE"); FlowNode_GameObject.ActivateOutputLinks((Component)self, 16); FlowNode_GameObject.ActivateOutputLinks((Component)self, 10); GameUtility.FadeIn(0.5f); self.mDesirdSceneSet = false; self.mStateMachine.GotoState <HomeWindow.State_Tutorial>(); }
private void OnSceneBundleLoaded(SceneRequest p_args) { m_loads = Application.LoadLevelAdditiveAsync(p_args.SceneName); }
public override void Update(HomeWindow self) { if (this.state == 0) { self.mFadingOut = true; FlowNode_GameObject.ActivateOutputLinks((Component)self, 11); this.state = 1; } if (this.state == 1) { if (!AssetDownloader.isDone) { return; } if (AssetManager.IsAssetBundle(self.mDesiredSceneName)) { AssetManager.PrepareAssets(self.mDesiredSceneName); if (self.mDesiredSceneIsHome) { foreach (string resourcePath in FlowNode_PlayBGM.GetHomeBGM()) { AssetManager.PrepareAssets(resourcePath); } } if (!AssetDownloader.isDone) { ProgressWindow.OpenGenericDownloadWindow(); AssetDownloader.StartDownload(false, true, ThreadPriority.Normal); this.state = 2; return; } } this.state = 3; } if (this.state == 2) { if (!AssetDownloader.isDone) { return; } ProgressWindow.Close(); this.state = 3; } if (this.state == 3) { if (self.mDesiredSceneIsHome) { FlowNode_PlayBGM.PlayHomeBGM(); } self.mLastSceneName = self.mDesiredSceneName; this.req = AssetManager.LoadSceneAsync(self.mDesiredSceneName, true); this.state = 4; } if (this.state == 4) { if (!this.req.canBeActivated || self.mFadingOut || MonoSingleton <GameManager> .Instance.IsImportantJobRunning) { return; } if (!string.IsNullOrEmpty(self.UnloadTrigger)) { GlobalEvent.Invoke(self.UnloadTrigger, (object)this); } SceneAwakeObserver.AddListener(new SceneAwakeObserver.SceneEvent(this.OnSceneAwake)); this.req.ActivateScene(); if (!string.IsNullOrEmpty(self.mLastSceneName)) { AssetManager.UnloadScene(self.mLastSceneName); } this.state = 5; } if (this.state == 5) { if (UnityEngine.Object.op_Equality((UnityEngine.Object) this.mNewScene, (UnityEngine.Object)null) || !this.req.isDone) { return; } CriticalSection.Leave(CriticalSections.SceneChange); this.state = 6; } if (this.state == 6) { if (CriticalSection.IsActive) { return; } this.asyncOp = AssetManager.UnloadUnusedAssets(); this.state = 7; } if (this.state != 7 || this.asyncOp != null && !this.asyncOp.get_isDone()) { return; } FlowNode_GameObject.ActivateOutputLinks((Component)self, 10); GameUtility.FadeIn(0.5f); self.mDesirdSceneSet = false; if (!self.mIgnorePopups && !self.mNewsShown && !GlobalVars.IsTitleStart.Get() && (MonoSingleton <GameManager> .Instance.Player.IsFirstLogin || GameUtility.isLoginInfoDisplay())) { self.mNewsShown = true; GlobalVars.IsTitleStart.Set(true); self.mStateMachine.GotoState <HomeWindow.State_LoginBonus>(); } else if (!self.mIgnorePopups && !GlobalVars.IsTitleStart.Get() && !self.mBeginnerShown) { self.mBeginnerShown = true; self.mStateMachine.GotoState <HomeWindow.State_BeginnerNotify>(); } else { self.MiscBeforeDefaultState(); self.mStateMachine.GotoState <HomeWindow.State_Default>(); } if (self.mDesiredSceneIsHome) { self.UnlockContents(); self.FgGIDLoginCheck(); FlowNode_GameObject.ActivateOutputLinks((Component)self, 15); } else { FlowNode_GameObject.ActivateOutputLinks((Component)self, 16); } }