private void OnOpen(UILoadState uiState, params object[] args) { if (uiState.IsLoading) { uiState.OpenWhenFinish = true; uiState.OpenArgs = args; return; } UIController uiBase = uiState.UIWindow; if (uiBase.Canvas != null && uiBase.Canvas.enabled) { //已经打开无需再次打开 return; } uiBase.BeforeOpen(args); //TODO 播放界面出现动画 uiBase.gameObject.SetActiveX(true); if (uiBase.Canvas) { uiBase.Canvas.enabled = true; if (sortOrder >= int.MaxValue) { sortOrder = 0; } uiBase.Canvas.sortingOrder = sortOrder++; } if (AppConfig.IsLogFuncCost || AppConfig.IsSaveCostToFile) { KProfiler.BeginWatch("UI.OnOpen"); } uiBase.OnOpen(args); KWatchResult profilerData = null; if (AppConfig.IsLogFuncCost) { profilerData = KProfiler.EndWatch("UI.OnOpen", string.Concat(uiBase.UIName, ".OnOpen")); } if (AppConfig.IsSaveCostToFile) { if (profilerData == null) { profilerData = KProfiler.EndWatch("UI.OnOpen", string.Concat(uiBase.UIName, ".OnOpen")); } LogFileRecorder.WriteUILog(uiBase.UIName, LogFileRecorder.UIState.OnOpen, profilerData.costTime); } if (OnOpenEvent != null) { OnOpenEvent(uiBase); } }
private void InitWindow(UILoadState uiState, UIController uiBase, bool open, params object[] args) { if (AppConfig.IsLogFuncCost || AppConfig.IsSaveCostToFile) { KProfiler.BeginWatch("UI.Init"); } uiBase.OnInit(); KWatchResult profilerData = null; if (AppConfig.IsLogFuncCost) { profilerData = KProfiler.EndWatch("UI.Init", string.Concat(uiState.InstanceName, ".OnInit")); } if (AppConfig.IsSaveCostToFile) { if (profilerData == null) { profilerData = KProfiler.EndWatch("UI.Init", string.Concat(uiState.InstanceName, ".OnInit")); } LogFileRecorder.WriteUILog(uiState.InstanceName, LogFileRecorder.UIState.OnInit, profilerData.costTime); } if (OnInitEvent != null) { OnInitEvent(uiBase); } if (open) { OnOpen(uiState, args); } if (!open) { if (!uiState.IsStaticUI) { CloseWindow(uiBase.UIName); // Destroy return; } else { if (uiBase.Canvas != null) { uiBase.Canvas.enabled = false; } else { uiBase.gameObject.SetActiveX(false); } } } uiState.OnUIWindowLoadedCallbacks(uiState, uiBase); }
private void OnOpen(UILoadState uiState, params object[] args) { if (uiState.IsLoading) { uiState.OpenWhenFinish = true; uiState.OpenArgs = args; return; } UIController uiBase = uiState.UIWindow; if (uiBase.Canvas != null && uiBase.Canvas.enabled) { //已经打开无需再次打开 return; } uiBase.BeforeOpen(args); //TODO 播放界面出现动画 uiBase.gameObject.SetActiveX(true); SetUIOrder(uiBase); string watchKey = null; if (AppConfig.IsLogFuncCost || AppConfig.IsSaveCostToFile) { watchKey = string.Concat(uiBase.UIName, ".OnOpen"); KProfiler.BeginWatch(watchKey); } uiBase.OnOpen(args); KWatchResult profilerData = null; if (AppConfig.IsLogFuncCost) { profilerData = KProfiler.EndWatch(watchKey); } if (AppConfig.IsSaveCostToFile) { if (profilerData == null) { profilerData = KProfiler.EndWatch(watchKey, null, false); } LogFileManager.WriteUILog(uiBase.UIName, LogState.OnOpen, profilerData.costTime); } if (OnOpenEvent != null) { OnOpenEvent(uiBase); } }