private void InitDebugWindow() { RectTransform debugRectTransform = GameCloneUtils.CloneNewObjectWithParent(GameManager.FindStaticPrefabs("UIDebugWindow"), GameManager.UIManager.UIRoot.transform).GetComponent <RectTransform>(); debugWindow = GameManager.UIManager.CreateWindow("Debug console window", debugRectTransform); UIDebugToolBar = GameCloneUtils.CloneNewObjectWithParent(GameManager.FindStaticPrefabs("UIDebugToolBar"), GameManager.UIManager.UIRoot.transform, "GameUIDebugToolBar"); debugWindow.CloseAsHide = true; debugWindow.SetSize(450, 330); debugWindow.SetMinSize(420, 270); debugWindow.MoveToCenter(); debugWindow.Hide(); ico_warning2_big = GameManager.FindStaticAssets <Sprite>("ico_warning2_big"); ico_warning_big = GameManager.FindStaticAssets <Sprite>("ico_warning_big"); ico_info_big = GameManager.FindStaticAssets <Sprite>("ico_info_big"); ico_error_big = GameManager.FindStaticAssets <Sprite>("ico_error_big"); ico_success_big = GameManager.FindStaticAssets <Sprite>("ico_success_big"); ico_warning = GameManager.FindStaticAssets <Sprite>("ico_warning"); ico_info = GameManager.FindStaticAssets <Sprite>("ico_info"); ico_error = GameManager.FindStaticAssets <Sprite>("ico_error"); ico_success = GameManager.FindStaticAssets <Sprite>("ico_success"); box_round_light = GameManager.FindStaticAssets <Sprite>("box_round_grey"); background_transparent = GameManager.FindStaticAssets <Sprite>("background_transparent"); GameManager.UIManager.RegisterWindow(debugWindow); UIDebugToolBar.SetActive(true); DebugTextFPS = UIDebugToolBar.transform.Find("DebugTextFPS").GetComponent <Text>(); DebugTextErrors = debugRectTransform.transform.Find("DebugToolErrors/Text").GetComponent <Text>(); DebugTextWarnings = debugRectTransform.transform.Find("DebugToolWarnings/Text").GetComponent <Text>(); DebugTextInfos = debugRectTransform.transform.Find("DebugToolInfos/Text").GetComponent <Text>(); DebugCmdContent = debugRectTransform.transform.Find("DebugCmdScrollView/Viewport/DebugCmdContent").GetComponent <RectTransform>(); DebugInputCommand = debugRectTransform.transform.Find("DebugInputCommand").GetComponent <InputField>(); DebugToggleInfo = debugRectTransform.transform.Find("DebugToggleInfo").GetComponent <Toggle>(); DebugToggleWarning = debugRectTransform.transform.Find("DebugToggleWarning").GetComponent <Toggle>(); DebugToggleError = debugRectTransform.transform.Find("DebugToggleError").GetComponent <Toggle>(); DebugItemContent = debugRectTransform.transform.Find("DebugDetailsScrollView/Viewport/DebugItemContent").GetComponent <Text>(); Toggle DebugToggleStackTrace = debugRectTransform.transform.Find("DebugToggleStackTrace").GetComponent <Toggle>(); DebugCmdScrollView = debugRectTransform.transform.Find("DebugCmdScrollView").GetComponent <RectTransform>(); DebugCmdScrollViewScrollRect = DebugCmdScrollView.GetComponent <ScrollRect>(); DebugDetailsScrollView = debugRectTransform.transform.Find("DebugDetailsScrollView").GetComponent <RectTransform>(); DebugToolsItem = UIDebugToolBar.transform.Find("DebugToolsItem").gameObject; DebugToolsItemHost = UIDebugToolBar.transform.Find("DebugToolsItem/Viewport/DebugToolsItemHost").GetComponent <RectTransform>(); UIDebugTextItem = GameManager.FindStaticPrefabs("UIDebugTextItem"); fPSManager = GameCloneUtils.CreateEmptyObjectWithParent(GameManager.GameRoot.transform, "FPSManager").AddComponent <FPSManager>(); fPSManager.FpsText = DebugTextFPS; EventTriggerListener.Get(UIDebugToolBar.transform.Find("DebugToolCmd").gameObject).onClick = (g) => { if (debugWindow.GetVisible()) { debugWindow.Hide(); } else { debugWindow.Show(); ForceReloadLogList(); } }; EventTriggerListener.Get(UIDebugToolBar.transform.Find("DebugTools").gameObject).onClick = (g) => { DebugToolsItem.SetActive(!DebugToolsItem.activeSelf); }; EventTriggerListener.Get(debugRectTransform.transform.Find("DebugButtonRun").gameObject).onClick = (g) => { if (RunCommand(DebugInputCommand.text)) { DebugInputCommand.text = ""; } }; EventTriggerListener.Get(debugRectTransform.transform.Find("DebugButtonClear").gameObject).onClick = (g) => { ClearLogs(); }; DebugInputCommand.onEndEdit.AddListener((s) => { ClearCurrentActiveLogItem(); if (RunCommand(s)) { DebugInputCommand.text = ""; } }); DebugToggleError.onValueChanged.AddListener((b) => { SetShowLogTypes(GameLogger.LogType.Error, b); SetShowLogTypes(GameLogger.LogType.Assert, b); ForceReloadLogList(); }); DebugToggleWarning.onValueChanged.AddListener((b) => { SetShowLogTypes(GameLogger.LogType.Warning, b); ForceReloadLogList(); }); DebugToggleInfo.onValueChanged.AddListener((b) => { SetShowLogTypes(GameLogger.LogType.Text, b); SetShowLogTypes(GameLogger.LogType.Info, b); ForceReloadLogList(); }); DebugToggleStackTrace.onValueChanged.AddListener((b) => { DebugDetailsScrollView.gameObject.SetActive(b); if (!b) { UIAnchorPosUtils.SetUILeftBottom(DebugCmdScrollView, UIAnchorPosUtils.GetUILeft(DebugCmdScrollView), 30); } else { UIAnchorPosUtils.SetUILeftBottom(DebugCmdScrollView, UIAnchorPosUtils.GetUILeft(DebugCmdScrollView), 100); } }); GameLogger.RegisterLogCallback(HandleLog); ForceReloadLogList(); }