void TestFind() { var btn_1 = gameObject.FindChild <Button>("btn_1"); if (btn_1) { btn_1.onClick.RemoveAllListeners(); btn_1.onClick.AddListener(() => { }); } Log.Info("find btn_1:{0}", btn_1); var btn_xxx = gameObject.FindChild <Button>("btn_xxx"); Log.Info("find btn_xxx:{0}", btn_xxx); var text = gameObject.FindChild <Text>("Text"); Log.Info("find Text:{0} ,Text.text={1}", text, text?.text); KProfiler.BeginWatch("Find-Queue"); var text_name = gameObject.FindChild <Text>("text_name", false, false); Log.Info("find text_name:{0} ,Text.text={1}", text_name, text_name?.text); KProfiler.EndWatch("Find-Queue"); var text_test = gameObject.FindChild <Button>("text_name"); }
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); } }
public static void BuildAllAssetBundles() { if (EditorApplication.isPlaying) { Log.Error("Cannot build in playing mode! Please stop!"); return; } MakeAssetBundleNames(); var outputPath = GetExportPath(EditorUserBuildSettings.activeBuildTarget); KProfiler.BeginWatch("BuildAB"); Log.Info("AsseBundle start build to: {0}", outputPath); //压缩算法不建议用Lzma,要用LZ4 . Lzma读全部的buffer Lz4一个一个block读取,只读取4字节 var opt = BuildAssetBundleOptions.DeterministicAssetBundle | BuildAssetBundleOptions.ChunkBasedCompression;//BuildAssetBundleOptions.AppendHashToAssetBundleName; BuildPipeline.BuildAssetBundles(outputPath, opt, EditorUserBuildSettings.activeBuildTarget); KProfiler.EndWatch("BuildAB", "AsseBundle build Finish"); }