void IConsoleWindow.OnGUI() { // 过滤信息 FilterInfos(); GUILayout.BeginHorizontal(); { GUILayout.Label("搜索关键字 : ", ConsoleGUI.LableStyle, GUILayout.Width(140)); _filterKey = GUILayout.TextField(_filterKey, ConsoleGUI.TextFieldStyle, GUILayout.Width(400)); } GUILayout.EndHorizontal(); ConsoleGUI.Lable($"加载器总数:{_loaderTotalCount}"); float offset = ConsoleGUI.ToolbarStyle.fixedHeight + ConsoleGUI.LableStyle.fontSize; _scrollPos = ConsoleGUI.BeginScrollView(_scrollPos, offset); for (int i = 0; i < _cacheInfos.Count; i++) { var element = _cacheInfos[i]; if (element.LoadState == ELoaderStates.Fail || element.ProviderFailedCount > 0) { ConsoleGUI.RedLable(element.Info); } else { ConsoleGUI.Lable(element.Info); } } ConsoleGUI.EndScrollView(); }
void IConsoleWindow.OnGUI() { // 如果游戏模块没有创建 if (MotionEngine.Contains(typeof(GameObjectPoolManager)) == false) { _scrollPos = ConsoleGUI.BeginScrollView(_scrollPos, 30); ConsoleGUI.YellowLable($"{nameof(GameObjectPoolManager)} is not create."); ConsoleGUI.EndScrollView(); return; } var pools = GameObjectPoolManager.Instance.GetAllCollectors; ConsoleGUI.Lable($"池总数:{pools.Count}"); _scrollPos = ConsoleGUI.BeginScrollView(_scrollPos, 30); foreach (var pair in pools) { string content = $"[{pair.Value.Location}] CacheCount = {pair.Value.Count} SpwanCount = {pair.Value.SpawnCount}"; if (pair.Value.States == EAssetStates.Fail) { ConsoleGUI.RedLable(content); } else { ConsoleGUI.Lable(content); } } ConsoleGUI.EndScrollView(); }
void IConsoleWindow.OnGUI() { var pools = ReferencePool.GetAllCollectors; ConsoleGUI.Lable($"池总数:{pools.Count}"); _scrollPos = ConsoleGUI.BeginScrollView(_scrollPos, 30); foreach (var pair in pools) { ConsoleGUI.Lable($"[{pair.Value.ClassType.FullName}] CacheCount = {pair.Value.Count} SpwanCount = {pair.Value.SpawnCount}"); } ConsoleGUI.EndScrollView(); }
/// <summary> /// 绘制控制台 /// 注意:该接口必须在OnGUI函数内调用 /// </summary> public static void Draw() { // 注意:GUI接口只能在OnGUI内部使用 ConsoleGUI.InitGlobalStyle(); // 整体偏移 if (OffsetPixels > 0) { GUILayout.Space(OffsetPixels); } if (_visibleToggle == false) { // 显示开关 if (GUILayout.Button("X", ConsoleGUI.ButtonStyle, GUILayout.Width(ConsoleGUI.ButtonStyle.fixedHeight))) { _visibleToggle = !_visibleToggle; } return; } GUILayout.BeginHorizontal(); { // 绘制背景 if (_visibleToggle && _bgTexture != null) { GUI.DrawTexture(new Rect(0, 0, Screen.width, Screen.height), _bgTexture, ScaleMode.StretchToFill, true); } // 显示开关 if (GUILayout.Button("X", ConsoleGUI.ButtonStyle, GUILayout.Width(ConsoleGUI.ButtonStyle.fixedHeight))) { _visibleToggle = !_visibleToggle; } // 绘制按钮栏 _showIndex = GUILayout.Toolbar(_showIndex, _toolbarTitles, ConsoleGUI.ToolbarStyle); } GUILayout.EndHorizontal(); // 绘制选中窗口 for (int i = 0; i < _wrappers.Count; i++) { if (_showIndex != i) { continue; } WindowWrapper wrapper = _wrappers[i]; wrapper.Instance.OnGUI(); } }
void IConsoleWindow.OnGUI() { // 过滤信息 FilterInfos(); GUILayout.BeginHorizontal(); { GUILayout.Label("搜索关键字 : ", ConsoleGUI.LableStyle, GUILayout.Width(200)); _filterKey = GUILayout.TextField(_filterKey, ConsoleGUI.TextFieldStyle, GUILayout.Width(500)); } GUILayout.EndHorizontal(); ConsoleGUI.Lable($"加载器总数:{_loaderTotalCount}"); float offset = ConsoleGUI.ToolbarStyle.fixedHeight + ConsoleGUI.LableStyle.fontSize; _scrollPos = ConsoleGUI.BeginScrollView(_scrollPos, offset); for (int i = 0; i < _cacheInfos.Count; i++) { var loaderWrapper = _cacheInfos[i]; string loaderInfo = $"名称:{loaderWrapper.BundleName} 版本:{loaderWrapper.Loader.BundleInfo.Version} 引用:{loaderWrapper.Loader.RefCount}"; if (loaderWrapper.Loader.States == ELoaderStates.Fail) { ConsoleGUI.RedLable(loaderInfo); } else { ConsoleGUI.Lable(loaderInfo); } var providers = loaderWrapper.Loader.GetProviders(); foreach (var provider in providers) { string providerInfo = $"对象:{provider.AssetName} 引用:{provider.RefCount}"; if (provider.States == EAssetStates.Fail) { ConsoleGUI.RedLable(providerInfo); } else { ConsoleGUI.Lable(providerInfo); } } } ConsoleGUI.EndScrollView(); }
/// <summary> /// 绘制控制台 /// 注意:该接口必须在OnGUI函数内调用 /// </summary> public static void Draw() { if (_fpsCounter != null) { if (_lastFrame != Time.frameCount) { _lastFrame = Time.frameCount; _fpsCounter.Update(); } } // 注意:GUI接口只能在OnGUI内部使用 ConsoleGUI.InitGlobalStyle(); float posX = Screen.safeArea.x; float posY = Screen.height - Screen.safeArea.height - Screen.safeArea.y; if (_visible == false) { float wdith = ConsoleGUI.XStyle.fixedWidth; float height = ConsoleGUI.XStyle.fixedHeight; // 显示按钮 if (GUI.Button(new Rect(posX + 10, posY + 10, wdith, height), "X", ConsoleGUI.XStyle)) { _visible = true; } // FPS if (_fpsCounter != null) { int fps = _fpsCounter.GetFPS(); string text = $"<size={ConsoleGUI.RichLabelFontSize * 2}><color=red>{fps}</color></size>"; GUI.Label(new Rect(posX + wdith * 1.5f, posY + 5, wdith * 2, height * 2), text, ConsoleGUI.RichLabelStyle); } } else { Rect windowRect = new Rect(posX, posY, Screen.safeArea.width, Screen.safeArea.height); GUI.Window(0, windowRect, DrawWindow, string.Empty); } }
void IConsoleWindow.OnGUI() { var pools = GameObjectPoolManager.Instance.GetAllCollectors; ConsoleGUI.Lable($"池总数:{pools.Count}"); _scrollPos = ConsoleGUI.BeginScrollView(_scrollPos, 30); foreach (var pair in pools) { string content = $"[{pair.Value.Location}] CacheCount = {pair.Value.Count} SpwanCount = {pair.Value.SpawnCount}"; if (pair.Value.States == EAssetStates.Fail) { ConsoleGUI.RedLable(content); } else { ConsoleGUI.Lable(content); } } ConsoleGUI.EndScrollView(); }
/// <summary> /// 绘制控制台 /// 注意:该接口必须在OnGUI函数内调用 /// </summary> public static void Draw() { // 注意:GUI接口只能在OnGUI内部使用 ConsoleGUI.InitGlobalStyle(); float posX = Screen.safeArea.x; float posY = Screen.height - Screen.safeArea.height - Screen.safeArea.y; if (_visible == false) { // 显示按钮 if (GUI.Button(new Rect(posX + 10, posY + 10, ConsoleGUI.XStyle.fixedWidth, ConsoleGUI.XStyle.fixedHeight), "X", ConsoleGUI.XStyle)) { _visible = true; } } else { Rect windowRect = new Rect(posX, posY, Screen.safeArea.width, Screen.safeArea.height); GUI.Window(0, windowRect, DrawWindow, string.Empty); } }
void IConsoleWindow.OnGUI() { GUILayout.BeginHorizontal(); _showLog = ConsoleGUI.Toggle($"Log ({_logCount})", _showLog); _showWarning = ConsoleGUI.Toggle($"Warning ({_warningCount})", _showWarning); _showError = ConsoleGUI.Toggle($"Error ({_errorCount})", _showError); GUILayout.EndHorizontal(); float offset = ConsoleGUI.ToolbarStyle.fixedHeight; _scrollPos = ConsoleGUI.BeginScrollView(_scrollPos, offset); for (int i = 0; i < _logs.Count; i++) { LogWrapper wrapper = _logs[i]; if (wrapper.Type == LogType.Log) { if (_showLog) { ConsoleGUI.Lable(wrapper.Log); } } else if (wrapper.Type == LogType.Warning) { if (_showWarning) { ConsoleGUI.YellowLable(wrapper.Log); } } else if (wrapper.Type == LogType.Assert || wrapper.Type == LogType.Error || wrapper.Type == LogType.Exception) { if (_showError) { ConsoleGUI.RedLable(wrapper.Log); } } } ConsoleGUI.EndScrollView(); }
void IConsoleWindow.OnGUI() { GUILayout.BeginHorizontal(); _showLog = ConsoleGUI.Toggle("Log", _showLog); _showWarning = ConsoleGUI.Toggle("Warning", _showWarning); _showError = ConsoleGUI.Toggle("Error", _showError); GUILayout.EndHorizontal(); _scrollPos = ConsoleGUI.BeginScrollView(_scrollPos, 40); for (int i = 0; i < _logs.Count; i++) { LogWrapper wrapper = _logs[i]; if (wrapper.Type == LogType.Log) { if (_showLog) { ConsoleGUI.Lable(wrapper.Log); } } else if (wrapper.Type == LogType.Warning) { if (_showWarning) { ConsoleGUI.YellowLable(wrapper.Log); } } else { if (_showError) { ConsoleGUI.RedLable(wrapper.Log); } } } ConsoleGUI.EndScrollView(); }
void IConsoleWindow.OnGUI() { _scrollPos = ConsoleGUI.BeginScrollView(_scrollPos, 0); MotionEngine.DrawModulesGUIContent(); ConsoleGUI.EndScrollView(); }
void IConsoleWindow.OnGUI() { GUILayout.BeginHorizontal(); if (GUILayout.Button("Clear", ConsoleGUI.ButtonStyle, GUILayout.Width(100))) { _totalCount = 0; _logCount = 0; _warningCount = 0; _errorCount = 0; _logs.Clear(); } _showLog = ConsoleGUI.Toggle($"Log ({_logCount})", _showLog); _showWarning = ConsoleGUI.Toggle($"Warning ({_warningCount})", _showWarning); _showError = ConsoleGUI.Toggle($"Error ({_errorCount})", _showError); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); { GUILayout.Label("搜索关键字 : ", ConsoleGUI.LableStyle, GUILayout.Width(200)); _filterKey = GUILayout.TextField(_filterKey, ConsoleGUI.TextFieldStyle, GUILayout.Width(500)); } GUILayout.EndHorizontal(); float offset = ConsoleGUI.ToolbarStyle.fixedHeight * 3; _scrollPos = ConsoleGUI.BeginScrollView(_scrollPos, offset); for (int i = 0; i < _logs.Count; i++) { LogWrapper wrapper = _logs[i]; // 只搜索关键字 if (string.IsNullOrEmpty(_filterKey) == false) { if (wrapper.Log.Contains(_filterKey) == false) { continue; } } if (wrapper.Type == LogType.Log) { if (_showLog) { ConsoleGUI.Lable(wrapper.Log); } } else if (wrapper.Type == LogType.Warning) { if (_showWarning) { ConsoleGUI.YellowLable(wrapper.Log); } } else if (wrapper.Type == LogType.Assert || wrapper.Type == LogType.Error || wrapper.Type == LogType.Exception) { if (_showError) { ConsoleGUI.RedLable(wrapper.Log); } } } ConsoleGUI.EndScrollView(); }
void IConsoleWindow.OnGUI() { int space = 15; _scrollPos = ConsoleGUI.BeginScrollView(_scrollPos); // 时间缩放相关 GUILayout.Space(space); GUILayout.BeginHorizontal(); if (GUILayout.Button("Reset", ConsoleGUI.ButtonStyle, GUILayout.Width(100))) { _timeScaleLevel = 5; SetTimeScale(_timeScaleLevel); } if (GUILayout.Button("+", ConsoleGUI.ButtonStyle, GUILayout.Width(100))) { _timeScaleLevel++; _timeScaleLevel = Mathf.Clamp(_timeScaleLevel, 0, 9); SetTimeScale(_timeScaleLevel); } if (GUILayout.Button("-", ConsoleGUI.ButtonStyle, GUILayout.Width(100))) { _timeScaleLevel--; _timeScaleLevel = Mathf.Clamp(_timeScaleLevel, 0, 9); SetTimeScale(_timeScaleLevel); } GUILayout.EndHorizontal(); GUILayout.Space(space); ConsoleGUI.Lable($"Elapse Time : {GetElapseTime()}"); ConsoleGUI.Lable($"Time Scale : {Time.timeScale}"); GUILayout.Space(space); ConsoleGUI.Lable($"Unity Version : {Application.unityVersion}"); ConsoleGUI.Lable($"Unity Pro License : {Application.HasProLicense()}"); ConsoleGUI.Lable($"Application Version : {Application.version}"); ConsoleGUI.Lable($"Application Install Path : {Application.dataPath}"); ConsoleGUI.Lable($"Application Persistent Path : {Application.persistentDataPath}"); GUILayout.Space(space); ConsoleGUI.Lable($"OS : {SystemInfo.operatingSystem}"); ConsoleGUI.Lable($"OS Memory : {SystemInfo.systemMemorySize / 1024f:f1}GB"); ConsoleGUI.Lable($"CPU : {SystemInfo.processorType}"); ConsoleGUI.Lable($"CPU Core : {SystemInfo.processorCount}"); GUILayout.Space(space); ConsoleGUI.Lable($"Device UID : {SystemInfo.deviceUniqueIdentifier}"); ConsoleGUI.Lable($"Device Model : {SystemInfo.deviceModel}"); ConsoleGUI.Lable($"Device Name : {SystemInfo.deviceName}"); ConsoleGUI.Lable($"Device Type : {SystemInfo.deviceType}"); GUILayout.Space(space); ConsoleGUI.Lable($"Graphics Device Name : {SystemInfo.graphicsDeviceName}"); ConsoleGUI.Lable($"Graphics Device Type : {SystemInfo.graphicsDeviceType}"); ConsoleGUI.Lable($"Graphics Memory : {SystemInfo.graphicsMemorySize / 1024f:f1}GB"); ConsoleGUI.Lable($"Graphics Shader Level : {SystemInfo.graphicsShaderLevel}"); ConsoleGUI.Lable($"Multi-threaded Rendering : {SystemInfo.graphicsMultiThreaded}"); ConsoleGUI.Lable($"Max Cubemap Size : {SystemInfo.maxCubemapSize}"); ConsoleGUI.Lable($"Max Texture Size : {SystemInfo.maxTextureSize}"); GUILayout.Space(space); ConsoleGUI.Lable($"Supports Accelerometer : {SystemInfo.supportsAccelerometer}"); //加速计硬件 ConsoleGUI.Lable($"Supports Gyroscope : {SystemInfo.supportsGyroscope}"); //陀螺仪硬件 ConsoleGUI.Lable($"Supports Audio : {SystemInfo.supportsAudio}"); //音频硬件 ConsoleGUI.Lable($"Supports GPS : {SystemInfo.supportsLocationService}"); //GPS硬件 GUILayout.Space(space); ConsoleGUI.Lable($"Screen DPI : {Screen.dpi}"); ConsoleGUI.Lable($"Game Resolution : {Screen.width} x {Screen.height}"); ConsoleGUI.Lable($"Device Resolution : {Screen.currentResolution.width} x {Screen.currentResolution.height}"); ConsoleGUI.Lable($"Graphics Quality : {QualitySettings.names[QualitySettings.GetQualityLevel()]}"); GUILayout.Space(space); ConsoleGUI.Lable($"Reserved Total Memory : {Profiler.GetTotalReservedMemoryLong() / 1048576}MB"); ConsoleGUI.Lable($"Allocated Graphics Memory : {Profiler.GetAllocatedMemoryForGraphicsDriver() / 1048576}MB"); ConsoleGUI.Lable($"Used Memory Pool : {Profiler.GetTotalAllocatedMemoryLong() / 1048576}MB"); ConsoleGUI.Lable($"Unused Memory Pool : {Profiler.GetTotalUnusedReservedMemoryLong() / 1048576}MB"); ConsoleGUI.Lable($"Total Mono Memory : {Profiler.GetMonoHeapSizeLong() / 1048576}MB"); ConsoleGUI.Lable($"Used Mono Memory : {Profiler.GetMonoUsedSizeLong() / 1048576}MB"); GUILayout.Space(space); ConsoleGUI.Lable($"Battery Level : {SystemInfo.batteryLevel}"); ConsoleGUI.Lable($"Battery Status : {SystemInfo.batteryStatus}"); ConsoleGUI.Lable($"Network Status : {GetNetworkState()}"); ConsoleGUI.EndScrollView(); }
void IConsoleWindow.OnGUI() { int space = 15; _scrollPos = ConsoleGUI.BeginScrollView(_scrollPos, 0); GUILayout.Space(space); ConsoleGUI.Lable($"Unity Version : {Application.unityVersion}"); ConsoleGUI.Lable($"Unity Pro License : {Application.HasProLicense()}"); ConsoleGUI.Lable($"Application Version : {Application.version}"); ConsoleGUI.Lable($"Application Install Path : {Application.dataPath}"); ConsoleGUI.Lable($"Application Persistent Path : {Application.persistentDataPath}"); GUILayout.Space(space); ConsoleGUI.Lable($"OS : {SystemInfo.operatingSystem}"); ConsoleGUI.Lable($"OS Memory : {SystemInfo.systemMemorySize / 1000}GB"); ConsoleGUI.Lable($"CPU : {SystemInfo.processorType}"); ConsoleGUI.Lable($"CPU Core : {SystemInfo.processorCount}"); GUILayout.Space(space); ConsoleGUI.Lable($"Device Model : {SystemInfo.deviceModel}"); ConsoleGUI.Lable($"Device Name : {SystemInfo.deviceName}"); ConsoleGUI.Lable($"Device Type : {SystemInfo.deviceType}"); GUILayout.Space(space); ConsoleGUI.Lable($"Graphics Device Name : {SystemInfo.graphicsDeviceName}"); ConsoleGUI.Lable($"Graphics Device Type : {SystemInfo.graphicsDeviceType}"); ConsoleGUI.Lable($"Graphics Memory : {SystemInfo.graphicsMemorySize / 1000}GB"); ConsoleGUI.Lable($"Graphics Shader Level : {SystemInfo.graphicsShaderLevel}"); ConsoleGUI.Lable($"Multi-threaded Rendering : {SystemInfo.graphicsMultiThreaded}"); ConsoleGUI.Lable($"Max Cubemap Size : {SystemInfo.maxCubemapSize}"); ConsoleGUI.Lable($"Max Texture Size : {SystemInfo.maxTextureSize}"); GUILayout.Space(space); ConsoleGUI.Lable($"Supports Accelerometer : {SystemInfo.supportsAccelerometer}"); //加速计硬件 ConsoleGUI.Lable($"Supports Gyroscope : {SystemInfo.supportsGyroscope}"); //陀螺仪硬件 ConsoleGUI.Lable($"Supports Audio : {SystemInfo.supportsAudio}"); //音频硬件 ConsoleGUI.Lable($"Supports GPS : {SystemInfo.supportsLocationService}"); //GPS硬件 GUILayout.Space(space); ConsoleGUI.Lable($"Screen DPI : {Screen.dpi}"); ConsoleGUI.Lable($"Game Resolution : {Screen.width} x {Screen.height}"); ConsoleGUI.Lable($"Device Resolution : {Screen.currentResolution.width} x {Screen.currentResolution.height}"); ConsoleGUI.Lable($"Graphics Quality : {QualitySettings.names[QualitySettings.GetQualityLevel()]}"); GUILayout.Space(space); long memory = Profiler.GetTotalReservedMemoryLong() / 1000000; ConsoleGUI.Lable($"Total Memory : {memory}MB"); memory = Profiler.GetTotalAllocatedMemoryLong() / 1000000; ConsoleGUI.Lable($"Used Memory : {memory}MB"); memory = Profiler.GetTotalUnusedReservedMemoryLong() / 1000000; ConsoleGUI.Lable($"Free Memory : {memory}MB"); memory = Profiler.GetMonoHeapSizeLong() / 1000000; ConsoleGUI.Lable($"Total Mono Memory : {memory}MB"); memory = Profiler.GetMonoUsedSizeLong() / 1000000; ConsoleGUI.Lable($"Used Mono Memory : {memory}MB"); GUILayout.Space(space); ConsoleGUI.Lable($"Battery Level : {SystemInfo.batteryLevel}"); ConsoleGUI.Lable($"Battery Status : {SystemInfo.batteryStatus}"); ConsoleGUI.Lable($"Network Status : {GetNetworkState()}"); ConsoleGUI.Lable($"Elapse Time : {GetElapseTime()}"); ConsoleGUI.Lable($"Time Scale : {Time.timeScale}"); ConsoleGUI.EndScrollView(); }