初始化仓库
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
//------------------------------------------------------------
|
||||
// Game Framework
|
||||
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
|
||||
// Homepage: https://gameframework.cn/
|
||||
// Feedback: mailto:ellan@gameframework.cn
|
||||
//------------------------------------------------------------
|
||||
|
||||
namespace UnityGameFramework.Runtime
|
||||
{
|
||||
/// <summary>
|
||||
/// 调试器激活窗口类型。
|
||||
/// </summary>
|
||||
public enum DebuggerActiveWindowType : byte
|
||||
{
|
||||
/// <summary>
|
||||
/// 总是打开。
|
||||
/// </summary>
|
||||
AlwaysOpen = 0,
|
||||
|
||||
/// <summary>
|
||||
/// 仅在开发模式时打开。
|
||||
/// </summary>
|
||||
OnlyOpenWhenDevelopment,
|
||||
|
||||
/// <summary>
|
||||
/// 仅在编辑器中打开。
|
||||
/// </summary>
|
||||
OnlyOpenInEditor,
|
||||
|
||||
/// <summary>
|
||||
/// 总是关闭。
|
||||
/// </summary>
|
||||
AlwaysClose,
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d1baccfe5abb590428eb0322088bf4ce
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,509 @@
|
||||
//------------------------------------------------------------
|
||||
// Game Framework
|
||||
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
|
||||
// Homepage: https://gameframework.cn/
|
||||
// Feedback: mailto:ellan@gameframework.cn
|
||||
//------------------------------------------------------------
|
||||
|
||||
using GameFramework;
|
||||
using GameFramework.Debugger;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace UnityGameFramework.Runtime
|
||||
{
|
||||
public sealed partial class DebuggerComponent : GameFrameworkComponent
|
||||
{
|
||||
[Serializable]
|
||||
private sealed class ConsoleWindow : IDebuggerWindow
|
||||
{
|
||||
private readonly Queue<LogNode> m_LogNodes = new Queue<LogNode>();
|
||||
|
||||
private SettingComponent m_SettingComponent = null;
|
||||
private Vector2 m_LogScrollPosition = Vector2.zero;
|
||||
private Vector2 m_StackScrollPosition = Vector2.zero;
|
||||
private int m_InfoCount = 0;
|
||||
private int m_WarningCount = 0;
|
||||
private int m_ErrorCount = 0;
|
||||
private int m_FatalCount = 0;
|
||||
private LogNode m_SelectedNode = null;
|
||||
private bool m_LastLockScroll = true;
|
||||
private bool m_LastInfoFilter = true;
|
||||
private bool m_LastWarningFilter = true;
|
||||
private bool m_LastErrorFilter = true;
|
||||
private bool m_LastFatalFilter = true;
|
||||
|
||||
[SerializeField]
|
||||
private bool m_LockScroll = true;
|
||||
|
||||
[SerializeField]
|
||||
private int m_MaxLine = 100;
|
||||
|
||||
[SerializeField]
|
||||
private bool m_InfoFilter = true;
|
||||
|
||||
[SerializeField]
|
||||
private bool m_WarningFilter = true;
|
||||
|
||||
[SerializeField]
|
||||
private bool m_ErrorFilter = true;
|
||||
|
||||
[SerializeField]
|
||||
private bool m_FatalFilter = true;
|
||||
|
||||
[SerializeField]
|
||||
private Color32 m_InfoColor = Color.white;
|
||||
|
||||
[SerializeField]
|
||||
private Color32 m_WarningColor = Color.yellow;
|
||||
|
||||
[SerializeField]
|
||||
private Color32 m_ErrorColor = Color.red;
|
||||
|
||||
[SerializeField]
|
||||
private Color32 m_FatalColor = new Color(0.7f, 0.2f, 0.2f);
|
||||
|
||||
public bool LockScroll
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_LockScroll;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_LockScroll = value;
|
||||
}
|
||||
}
|
||||
|
||||
public int MaxLine
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_MaxLine;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_MaxLine = value;
|
||||
}
|
||||
}
|
||||
|
||||
public bool InfoFilter
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_InfoFilter;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_InfoFilter = value;
|
||||
}
|
||||
}
|
||||
|
||||
public bool WarningFilter
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_WarningFilter;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_WarningFilter = value;
|
||||
}
|
||||
}
|
||||
|
||||
public bool ErrorFilter
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_ErrorFilter;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_ErrorFilter = value;
|
||||
}
|
||||
}
|
||||
|
||||
public bool FatalFilter
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_FatalFilter;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_FatalFilter = value;
|
||||
}
|
||||
}
|
||||
|
||||
public int InfoCount
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_InfoCount;
|
||||
}
|
||||
}
|
||||
|
||||
public int WarningCount
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_WarningCount;
|
||||
}
|
||||
}
|
||||
|
||||
public int ErrorCount
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_ErrorCount;
|
||||
}
|
||||
}
|
||||
|
||||
public int FatalCount
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_FatalCount;
|
||||
}
|
||||
}
|
||||
|
||||
public Color32 InfoColor
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_InfoColor;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_InfoColor = value;
|
||||
}
|
||||
}
|
||||
|
||||
public Color32 WarningColor
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_WarningColor;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_WarningColor = value;
|
||||
}
|
||||
}
|
||||
|
||||
public Color32 ErrorColor
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_ErrorColor;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_ErrorColor = value;
|
||||
}
|
||||
}
|
||||
|
||||
public Color32 FatalColor
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_FatalColor;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_FatalColor = value;
|
||||
}
|
||||
}
|
||||
|
||||
public void Initialize(params object[] args)
|
||||
{
|
||||
m_SettingComponent = GameEntry.GetComponent<SettingComponent>();
|
||||
if (m_SettingComponent == null)
|
||||
{
|
||||
Log.Fatal("Setting component is invalid.");
|
||||
return;
|
||||
}
|
||||
|
||||
Application.logMessageReceived += OnLogMessageReceived;
|
||||
m_LockScroll = m_LastLockScroll = m_SettingComponent.GetBool("Debugger.Console.LockScroll", true);
|
||||
m_InfoFilter = m_LastInfoFilter = m_SettingComponent.GetBool("Debugger.Console.InfoFilter", true);
|
||||
m_WarningFilter = m_LastWarningFilter = m_SettingComponent.GetBool("Debugger.Console.WarningFilter", true);
|
||||
m_ErrorFilter = m_LastErrorFilter = m_SettingComponent.GetBool("Debugger.Console.ErrorFilter", true);
|
||||
m_FatalFilter = m_LastFatalFilter = m_SettingComponent.GetBool("Debugger.Console.FatalFilter", true);
|
||||
}
|
||||
|
||||
public void Shutdown()
|
||||
{
|
||||
Application.logMessageReceived -= OnLogMessageReceived;
|
||||
Clear();
|
||||
}
|
||||
|
||||
public void OnEnter()
|
||||
{
|
||||
}
|
||||
|
||||
public void OnLeave()
|
||||
{
|
||||
}
|
||||
|
||||
public void OnUpdate(float elapseSeconds, float realElapseSeconds)
|
||||
{
|
||||
if (m_LastLockScroll != m_LockScroll)
|
||||
{
|
||||
m_LastLockScroll = m_LockScroll;
|
||||
m_SettingComponent.SetBool("Debugger.Console.LockScroll", m_LockScroll);
|
||||
}
|
||||
|
||||
if (m_LastInfoFilter != m_InfoFilter)
|
||||
{
|
||||
m_LastInfoFilter = m_InfoFilter;
|
||||
m_SettingComponent.SetBool("Debugger.Console.InfoFilter", m_InfoFilter);
|
||||
}
|
||||
|
||||
if (m_LastWarningFilter != m_WarningFilter)
|
||||
{
|
||||
m_LastWarningFilter = m_WarningFilter;
|
||||
m_SettingComponent.SetBool("Debugger.Console.WarningFilter", m_WarningFilter);
|
||||
}
|
||||
|
||||
if (m_LastErrorFilter != m_ErrorFilter)
|
||||
{
|
||||
m_LastErrorFilter = m_ErrorFilter;
|
||||
m_SettingComponent.SetBool("Debugger.Console.ErrorFilter", m_ErrorFilter);
|
||||
}
|
||||
|
||||
if (m_LastFatalFilter != m_FatalFilter)
|
||||
{
|
||||
m_LastFatalFilter = m_FatalFilter;
|
||||
m_SettingComponent.SetBool("Debugger.Console.FatalFilter", m_FatalFilter);
|
||||
}
|
||||
}
|
||||
|
||||
public void OnDraw()
|
||||
{
|
||||
RefreshCount();
|
||||
|
||||
GUILayout.BeginHorizontal();
|
||||
{
|
||||
if (GUILayout.Button("Clear All", GUILayout.Width(100f)))
|
||||
{
|
||||
Clear();
|
||||
}
|
||||
m_LockScroll = GUILayout.Toggle(m_LockScroll, "Lock Scroll", GUILayout.Width(90f));
|
||||
GUILayout.FlexibleSpace();
|
||||
m_InfoFilter = GUILayout.Toggle(m_InfoFilter, Utility.Text.Format("Info ({0})", m_InfoCount), GUILayout.Width(90f));
|
||||
m_WarningFilter = GUILayout.Toggle(m_WarningFilter, Utility.Text.Format("Warning ({0})", m_WarningCount), GUILayout.Width(90f));
|
||||
m_ErrorFilter = GUILayout.Toggle(m_ErrorFilter, Utility.Text.Format("Error ({0})", m_ErrorCount), GUILayout.Width(90f));
|
||||
m_FatalFilter = GUILayout.Toggle(m_FatalFilter, Utility.Text.Format("Fatal ({0})", m_FatalCount), GUILayout.Width(90f));
|
||||
}
|
||||
GUILayout.EndHorizontal();
|
||||
|
||||
GUILayout.BeginVertical("box");
|
||||
{
|
||||
if (m_LockScroll)
|
||||
{
|
||||
m_LogScrollPosition.y = float.MaxValue;
|
||||
}
|
||||
|
||||
m_LogScrollPosition = GUILayout.BeginScrollView(m_LogScrollPosition);
|
||||
{
|
||||
bool selected = false;
|
||||
foreach (LogNode logNode in m_LogNodes)
|
||||
{
|
||||
switch (logNode.LogType)
|
||||
{
|
||||
case LogType.Log:
|
||||
if (!m_InfoFilter)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
|
||||
case LogType.Warning:
|
||||
if (!m_WarningFilter)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
|
||||
case LogType.Error:
|
||||
if (!m_ErrorFilter)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
|
||||
case LogType.Exception:
|
||||
if (!m_FatalFilter)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (GUILayout.Toggle(m_SelectedNode == logNode, GetLogString(logNode)))
|
||||
{
|
||||
selected = true;
|
||||
if (m_SelectedNode != logNode)
|
||||
{
|
||||
m_SelectedNode = logNode;
|
||||
m_StackScrollPosition = Vector2.zero;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!selected)
|
||||
{
|
||||
m_SelectedNode = null;
|
||||
}
|
||||
}
|
||||
GUILayout.EndScrollView();
|
||||
}
|
||||
GUILayout.EndVertical();
|
||||
|
||||
GUILayout.BeginVertical("box");
|
||||
{
|
||||
m_StackScrollPosition = GUILayout.BeginScrollView(m_StackScrollPosition, GUILayout.Height(100f));
|
||||
{
|
||||
if (m_SelectedNode != null)
|
||||
{
|
||||
Color32 color = GetLogStringColor(m_SelectedNode.LogType);
|
||||
if (GUILayout.Button(Utility.Text.Format("<color=#{0:x2}{1:x2}{2:x2}{3:x2}><b>{4}</b></color>{6}{6}{5}", color.r, color.g, color.b, color.a, m_SelectedNode.LogMessage, m_SelectedNode.StackTrack, Environment.NewLine), "label"))
|
||||
{
|
||||
CopyToClipboard(Utility.Text.Format("{0}{2}{2}{1}", m_SelectedNode.LogMessage, m_SelectedNode.StackTrack, Environment.NewLine));
|
||||
}
|
||||
}
|
||||
}
|
||||
GUILayout.EndScrollView();
|
||||
}
|
||||
GUILayout.EndVertical();
|
||||
}
|
||||
|
||||
private void Clear()
|
||||
{
|
||||
m_LogNodes.Clear();
|
||||
}
|
||||
|
||||
public void RefreshCount()
|
||||
{
|
||||
m_InfoCount = 0;
|
||||
m_WarningCount = 0;
|
||||
m_ErrorCount = 0;
|
||||
m_FatalCount = 0;
|
||||
foreach (LogNode logNode in m_LogNodes)
|
||||
{
|
||||
switch (logNode.LogType)
|
||||
{
|
||||
case LogType.Log:
|
||||
m_InfoCount++;
|
||||
break;
|
||||
|
||||
case LogType.Warning:
|
||||
m_WarningCount++;
|
||||
break;
|
||||
|
||||
case LogType.Error:
|
||||
m_ErrorCount++;
|
||||
break;
|
||||
|
||||
case LogType.Exception:
|
||||
m_FatalCount++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void GetRecentLogs(List<LogNode> results)
|
||||
{
|
||||
if (results == null)
|
||||
{
|
||||
Log.Error("Results is invalid.");
|
||||
return;
|
||||
}
|
||||
|
||||
results.Clear();
|
||||
foreach (LogNode logNode in m_LogNodes)
|
||||
{
|
||||
results.Add(logNode);
|
||||
}
|
||||
}
|
||||
|
||||
public void GetRecentLogs(List<LogNode> results, int count)
|
||||
{
|
||||
if (results == null)
|
||||
{
|
||||
Log.Error("Results is invalid.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (count <= 0)
|
||||
{
|
||||
Log.Error("Count is invalid.");
|
||||
return;
|
||||
}
|
||||
|
||||
int position = m_LogNodes.Count - count;
|
||||
if (position < 0)
|
||||
{
|
||||
position = 0;
|
||||
}
|
||||
|
||||
int index = 0;
|
||||
results.Clear();
|
||||
foreach (LogNode logNode in m_LogNodes)
|
||||
{
|
||||
if (index++ < position)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
results.Add(logNode);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnLogMessageReceived(string logMessage, string stackTrace, LogType logType)
|
||||
{
|
||||
if (logType == LogType.Assert)
|
||||
{
|
||||
logType = LogType.Error;
|
||||
}
|
||||
|
||||
m_LogNodes.Enqueue(LogNode.Create(logType, logMessage, stackTrace));
|
||||
while (m_LogNodes.Count > m_MaxLine)
|
||||
{
|
||||
ReferencePool.Release(m_LogNodes.Dequeue());
|
||||
}
|
||||
}
|
||||
|
||||
private string GetLogString(LogNode logNode)
|
||||
{
|
||||
Color32 color = GetLogStringColor(logNode.LogType);
|
||||
return Utility.Text.Format("<color=#{0:x2}{1:x2}{2:x2}{3:x2}>[{4:HH:mm:ss.fff}][{5}] {6}</color>", color.r, color.g, color.b, color.a, logNode.LogTime.ToLocalTime(), logNode.LogFrameCount, logNode.LogMessage);
|
||||
}
|
||||
|
||||
internal Color32 GetLogStringColor(LogType logType)
|
||||
{
|
||||
Color32 color = Color.white;
|
||||
switch (logType)
|
||||
{
|
||||
case LogType.Log:
|
||||
color = m_InfoColor;
|
||||
break;
|
||||
|
||||
case LogType.Warning:
|
||||
color = m_WarningColor;
|
||||
break;
|
||||
|
||||
case LogType.Error:
|
||||
color = m_ErrorColor;
|
||||
break;
|
||||
|
||||
case LogType.Exception:
|
||||
color = m_FatalColor;
|
||||
break;
|
||||
}
|
||||
|
||||
return color;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4a47e2730f999784eb1bbeefab72ef11
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+96
@@ -0,0 +1,96 @@
|
||||
//------------------------------------------------------------
|
||||
// Game Framework
|
||||
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
|
||||
// Homepage: https://gameframework.cn/
|
||||
// Feedback: mailto:ellan@gameframework.cn
|
||||
//------------------------------------------------------------
|
||||
|
||||
using GameFramework;
|
||||
using UnityEngine;
|
||||
#if UNITY_5_5_OR_NEWER
|
||||
using UnityEngine.Rendering;
|
||||
#endif
|
||||
|
||||
namespace UnityGameFramework.Runtime
|
||||
{
|
||||
public sealed partial class DebuggerComponent : GameFrameworkComponent
|
||||
{
|
||||
private sealed class EnvironmentInformationWindow : ScrollableDebuggerWindowBase
|
||||
{
|
||||
private BaseComponent m_BaseComponent = null;
|
||||
private ResourceComponent m_ResourceComponent = null;
|
||||
|
||||
public override void Initialize(params object[] args)
|
||||
{
|
||||
m_BaseComponent = GameEntry.GetComponent<BaseComponent>();
|
||||
if (m_BaseComponent == null)
|
||||
{
|
||||
Log.Fatal("Base component is invalid.");
|
||||
return;
|
||||
}
|
||||
|
||||
m_ResourceComponent = GameEntry.GetComponent<ResourceComponent>();
|
||||
if (m_ResourceComponent == null)
|
||||
{
|
||||
Log.Fatal("Resource component is invalid.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnDrawScrollableWindow()
|
||||
{
|
||||
GUILayout.Label("<b>Environment Information</b>");
|
||||
GUILayout.BeginVertical("box");
|
||||
{
|
||||
DrawItem("Product Name", Application.productName);
|
||||
DrawItem("Company Name", Application.companyName);
|
||||
#if UNITY_5_6_OR_NEWER
|
||||
DrawItem("Game Identifier", Application.identifier);
|
||||
#else
|
||||
DrawItem("Game Identifier", Application.bundleIdentifier);
|
||||
#endif
|
||||
DrawItem("Game Framework Version", Version.GameFrameworkVersion);
|
||||
DrawItem("Game Version", Utility.Text.Format("{0} ({1})", Version.GameVersion, Version.InternalGameVersion));
|
||||
DrawItem("Resource Version", m_BaseComponent.EditorResourceMode ? "Unavailable in editor resource mode" : (string.IsNullOrEmpty(m_ResourceComponent.ApplicableGameVersion) ? "Unknown" : Utility.Text.Format("{0} ({1})", m_ResourceComponent.ApplicableGameVersion, m_ResourceComponent.InternalResourceVersion)));
|
||||
DrawItem("Application Version", Application.version);
|
||||
DrawItem("Unity Version", Application.unityVersion);
|
||||
DrawItem("Platform", Application.platform.ToString());
|
||||
DrawItem("System Language", Application.systemLanguage.ToString());
|
||||
DrawItem("Cloud Project Id", Application.cloudProjectId);
|
||||
#if UNITY_5_6_OR_NEWER
|
||||
DrawItem("Build Guid", Application.buildGUID);
|
||||
#endif
|
||||
DrawItem("Target Frame Rate", Application.targetFrameRate.ToString());
|
||||
DrawItem("Internet Reachability", Application.internetReachability.ToString());
|
||||
DrawItem("Background Loading Priority", Application.backgroundLoadingPriority.ToString());
|
||||
DrawItem("Is Playing", Application.isPlaying.ToString());
|
||||
#if UNITY_5_5_OR_NEWER
|
||||
DrawItem("Splash Screen Is Finished", SplashScreen.isFinished.ToString());
|
||||
#else
|
||||
DrawItem("Is Showing Splash Screen", Application.isShowingSplashScreen.ToString());
|
||||
#endif
|
||||
DrawItem("Run In Background", Application.runInBackground.ToString());
|
||||
#if UNITY_5_5_OR_NEWER
|
||||
DrawItem("Install Name", Application.installerName);
|
||||
#endif
|
||||
DrawItem("Install Mode", Application.installMode.ToString());
|
||||
DrawItem("Sandbox Type", Application.sandboxType.ToString());
|
||||
DrawItem("Is Mobile Platform", Application.isMobilePlatform.ToString());
|
||||
DrawItem("Is Console Platform", Application.isConsolePlatform.ToString());
|
||||
DrawItem("Is Editor", Application.isEditor.ToString());
|
||||
DrawItem("Is Debug Build", Debug.isDebugBuild.ToString());
|
||||
#if UNITY_5_6_OR_NEWER
|
||||
DrawItem("Is Focused", Application.isFocused.ToString());
|
||||
#endif
|
||||
#if UNITY_2018_2_OR_NEWER
|
||||
DrawItem("Is Batch Mode", Application.isBatchMode.ToString());
|
||||
#endif
|
||||
#if UNITY_5_3
|
||||
DrawItem("Stack Trace Log Type", Application.stackTraceLogType.ToString());
|
||||
#endif
|
||||
}
|
||||
GUILayout.EndVertical();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c52c8dc8849c5fb429c50b45975a599b
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,83 @@
|
||||
//------------------------------------------------------------
|
||||
// Game Framework
|
||||
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
|
||||
// Homepage: https://gameframework.cn/
|
||||
// Feedback: mailto:ellan@gameframework.cn
|
||||
//------------------------------------------------------------
|
||||
|
||||
namespace UnityGameFramework.Runtime
|
||||
{
|
||||
public sealed partial class DebuggerComponent : GameFrameworkComponent
|
||||
{
|
||||
private sealed class FpsCounter
|
||||
{
|
||||
private float m_UpdateInterval;
|
||||
private float m_CurrentFps;
|
||||
private int m_Frames;
|
||||
private float m_Accumulator;
|
||||
private float m_TimeLeft;
|
||||
|
||||
public FpsCounter(float updateInterval)
|
||||
{
|
||||
if (updateInterval <= 0f)
|
||||
{
|
||||
Log.Error("Update interval is invalid.");
|
||||
return;
|
||||
}
|
||||
|
||||
m_UpdateInterval = updateInterval;
|
||||
Reset();
|
||||
}
|
||||
|
||||
public float UpdateInterval
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_UpdateInterval;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value <= 0f)
|
||||
{
|
||||
Log.Error("Update interval is invalid.");
|
||||
return;
|
||||
}
|
||||
|
||||
m_UpdateInterval = value;
|
||||
Reset();
|
||||
}
|
||||
}
|
||||
|
||||
public float CurrentFps
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_CurrentFps;
|
||||
}
|
||||
}
|
||||
|
||||
public void Update(float elapseSeconds, float realElapseSeconds)
|
||||
{
|
||||
m_Frames++;
|
||||
m_Accumulator += realElapseSeconds;
|
||||
m_TimeLeft -= realElapseSeconds;
|
||||
|
||||
if (m_TimeLeft <= 0f)
|
||||
{
|
||||
m_CurrentFps = m_Accumulator > 0f ? m_Frames / m_Accumulator : 0f;
|
||||
m_Frames = 0;
|
||||
m_Accumulator = 0f;
|
||||
m_TimeLeft += m_UpdateInterval;
|
||||
}
|
||||
}
|
||||
|
||||
private void Reset()
|
||||
{
|
||||
m_CurrentFps = 0f;
|
||||
m_Frames = 0;
|
||||
m_Accumulator = 0f;
|
||||
m_TimeLeft = 0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4f24c805ead515d4286d3c03cd50f750
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+170
@@ -0,0 +1,170 @@
|
||||
//------------------------------------------------------------
|
||||
// Game Framework
|
||||
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
|
||||
// Homepage: https://gameframework.cn/
|
||||
// Feedback: mailto:ellan@gameframework.cn
|
||||
//------------------------------------------------------------
|
||||
|
||||
using GameFramework;
|
||||
using UnityEngine;
|
||||
|
||||
namespace UnityGameFramework.Runtime
|
||||
{
|
||||
public sealed partial class DebuggerComponent : GameFrameworkComponent
|
||||
{
|
||||
private sealed class GraphicsInformationWindow : ScrollableDebuggerWindowBase
|
||||
{
|
||||
protected override void OnDrawScrollableWindow()
|
||||
{
|
||||
GUILayout.Label("<b>Graphics Information</b>");
|
||||
GUILayout.BeginVertical("box");
|
||||
{
|
||||
DrawItem("Device ID", SystemInfo.graphicsDeviceID.ToString());
|
||||
DrawItem("Device Name", SystemInfo.graphicsDeviceName);
|
||||
DrawItem("Device Vendor ID", SystemInfo.graphicsDeviceVendorID.ToString());
|
||||
DrawItem("Device Vendor", SystemInfo.graphicsDeviceVendor);
|
||||
DrawItem("Device Type", SystemInfo.graphicsDeviceType.ToString());
|
||||
DrawItem("Device Version", SystemInfo.graphicsDeviceVersion);
|
||||
DrawItem("Memory Size", Utility.Text.Format("{0} MB", SystemInfo.graphicsMemorySize));
|
||||
DrawItem("Multi Threaded", SystemInfo.graphicsMultiThreaded.ToString());
|
||||
#if UNITY_2019_3_OR_NEWER
|
||||
DrawItem("Rendering Threading Mode", SystemInfo.renderingThreadingMode.ToString());
|
||||
#endif
|
||||
#if UNITY_2020_1_OR_NEWER
|
||||
DrawItem("HRD Display Support Flags", SystemInfo.hdrDisplaySupportFlags.ToString());
|
||||
#endif
|
||||
DrawItem("Shader Level", GetShaderLevelString(SystemInfo.graphicsShaderLevel));
|
||||
DrawItem("Global Maximum LOD", Shader.globalMaximumLOD.ToString());
|
||||
#if UNITY_5_6_OR_NEWER
|
||||
DrawItem("Global Render Pipeline", Shader.globalRenderPipeline);
|
||||
#endif
|
||||
#if UNITY_2020_2_OR_NEWER
|
||||
DrawItem("Min OpenGLES Version", Graphics.minOpenGLESVersion.ToString());
|
||||
#endif
|
||||
#if UNITY_5_5_OR_NEWER
|
||||
DrawItem("Active Tier", Graphics.activeTier.ToString());
|
||||
#endif
|
||||
#if UNITY_2017_2_OR_NEWER
|
||||
DrawItem("Active Color Gamut", Graphics.activeColorGamut.ToString());
|
||||
#endif
|
||||
#if UNITY_2019_2_OR_NEWER
|
||||
DrawItem("Preserve Frame Buffer Alpha", Graphics.preserveFramebufferAlpha.ToString());
|
||||
#endif
|
||||
DrawItem("NPOT Support", SystemInfo.npotSupport.ToString());
|
||||
DrawItem("Max Texture Size", SystemInfo.maxTextureSize.ToString());
|
||||
DrawItem("Supported Render Target Count", SystemInfo.supportedRenderTargetCount.ToString());
|
||||
#if UNITY_2019_3_OR_NEWER
|
||||
DrawItem("Supported Random Write Target Count", SystemInfo.supportedRandomWriteTargetCount.ToString());
|
||||
#endif
|
||||
#if UNITY_5_4_OR_NEWER
|
||||
DrawItem("Copy Texture Support", SystemInfo.copyTextureSupport.ToString());
|
||||
#endif
|
||||
#if UNITY_5_5_OR_NEWER
|
||||
DrawItem("Uses Reversed ZBuffer", SystemInfo.usesReversedZBuffer.ToString());
|
||||
#endif
|
||||
#if UNITY_5_6_OR_NEWER
|
||||
DrawItem("Max Cubemap Size", SystemInfo.maxCubemapSize.ToString());
|
||||
DrawItem("Graphics UV Starts At Top", SystemInfo.graphicsUVStartsAtTop.ToString());
|
||||
#endif
|
||||
#if UNITY_2020_2_OR_NEWER
|
||||
DrawItem("Constant Buffer Offset Alignment", SystemInfo.constantBufferOffsetAlignment.ToString());
|
||||
#elif UNITY_2019_1_OR_NEWER
|
||||
DrawItem("Min Constant Buffer Offset Alignment", SystemInfo.minConstantBufferOffsetAlignment.ToString());
|
||||
#endif
|
||||
#if UNITY_2018_3_OR_NEWER
|
||||
DrawItem("Has Hidden Surface Removal On GPU", SystemInfo.hasHiddenSurfaceRemovalOnGPU.ToString());
|
||||
DrawItem("Has Dynamic Uniform Array Indexing In Fragment Shaders", SystemInfo.hasDynamicUniformArrayIndexingInFragmentShaders.ToString());
|
||||
#endif
|
||||
#if UNITY_2019_2_OR_NEWER
|
||||
DrawItem("Has Mip Max Level", SystemInfo.hasMipMaxLevel.ToString());
|
||||
#endif
|
||||
#if UNITY_2019_3_OR_NEWER
|
||||
DrawItem("Uses Load Store Actions", SystemInfo.usesLoadStoreActions.ToString());
|
||||
DrawItem("Max Compute Buffer Inputs Compute", SystemInfo.maxComputeBufferInputsCompute.ToString());
|
||||
DrawItem("Max Compute Buffer Inputs Domain", SystemInfo.maxComputeBufferInputsDomain.ToString());
|
||||
DrawItem("Max Compute Buffer Inputs Fragment", SystemInfo.maxComputeBufferInputsFragment.ToString());
|
||||
DrawItem("Max Compute Buffer Inputs Geometry", SystemInfo.maxComputeBufferInputsGeometry.ToString());
|
||||
DrawItem("Max Compute Buffer Inputs Hull", SystemInfo.maxComputeBufferInputsHull.ToString());
|
||||
DrawItem("Max Compute Buffer Inputs Vertex", SystemInfo.maxComputeBufferInputsVertex.ToString());
|
||||
DrawItem("Max Compute Work Group Size", SystemInfo.maxComputeWorkGroupSize.ToString());
|
||||
DrawItem("Max Compute Work Group Size X", SystemInfo.maxComputeWorkGroupSizeX.ToString());
|
||||
DrawItem("Max Compute Work Group Size Y", SystemInfo.maxComputeWorkGroupSizeY.ToString());
|
||||
DrawItem("Max Compute Work Group Size Z", SystemInfo.maxComputeWorkGroupSizeZ.ToString());
|
||||
#endif
|
||||
#if UNITY_5_3 || UNITY_5_4
|
||||
DrawItem("Supports Stencil", SystemInfo.supportsStencil.ToString());
|
||||
DrawItem("Supports Render Textures", SystemInfo.supportsRenderTextures.ToString());
|
||||
#endif
|
||||
DrawItem("Supports Sparse Textures", SystemInfo.supportsSparseTextures.ToString());
|
||||
DrawItem("Supports 3D Textures", SystemInfo.supports3DTextures.ToString());
|
||||
DrawItem("Supports Shadows", SystemInfo.supportsShadows.ToString());
|
||||
DrawItem("Supports Raw Shadow Depth Sampling", SystemInfo.supportsRawShadowDepthSampling.ToString());
|
||||
#if !UNITY_2019_1_OR_NEWER
|
||||
DrawItem("Supports Render To Cubemap", SystemInfo.supportsRenderToCubemap.ToString());
|
||||
DrawItem("Supports Image Effects", SystemInfo.supportsImageEffects.ToString());
|
||||
#endif
|
||||
DrawItem("Supports Compute Shader", SystemInfo.supportsComputeShaders.ToString());
|
||||
DrawItem("Supports Instancing", SystemInfo.supportsInstancing.ToString());
|
||||
#if UNITY_5_4_OR_NEWER
|
||||
DrawItem("Supports 2D Array Textures", SystemInfo.supports2DArrayTextures.ToString());
|
||||
DrawItem("Supports Motion Vectors", SystemInfo.supportsMotionVectors.ToString());
|
||||
#endif
|
||||
#if UNITY_5_5_OR_NEWER
|
||||
DrawItem("Supports Cubemap Array Textures", SystemInfo.supportsCubemapArrayTextures.ToString());
|
||||
#endif
|
||||
#if UNITY_5_6_OR_NEWER
|
||||
DrawItem("Supports 3D Render Textures", SystemInfo.supports3DRenderTextures.ToString());
|
||||
#endif
|
||||
#if UNITY_2017_2_OR_NEWER && !UNITY_2017_2_0 || UNITY_2017_1_4
|
||||
DrawItem("Supports Texture Wrap Mirror Once", SystemInfo.supportsTextureWrapMirrorOnce.ToString());
|
||||
#endif
|
||||
#if UNITY_2019_1_OR_NEWER
|
||||
DrawItem("Supports Graphics Fence", SystemInfo.supportsGraphicsFence.ToString());
|
||||
#elif UNITY_2017_3_OR_NEWER
|
||||
DrawItem("Supports GPU Fence", SystemInfo.supportsGPUFence.ToString());
|
||||
#endif
|
||||
#if UNITY_2017_3_OR_NEWER
|
||||
DrawItem("Supports Async Compute", SystemInfo.supportsAsyncCompute.ToString());
|
||||
DrawItem("Supports Multi-sampled Textures", SystemInfo.supportsMultisampledTextures.ToString());
|
||||
#endif
|
||||
#if UNITY_2018_1_OR_NEWER
|
||||
DrawItem("Supports Async GPU Readback", SystemInfo.supportsAsyncGPUReadback.ToString());
|
||||
DrawItem("Supports 32bits Index Buffer", SystemInfo.supports32bitsIndexBuffer.ToString());
|
||||
DrawItem("Supports Hardware Quad Topology", SystemInfo.supportsHardwareQuadTopology.ToString());
|
||||
#endif
|
||||
#if UNITY_2018_2_OR_NEWER
|
||||
DrawItem("Supports Mip Streaming", SystemInfo.supportsMipStreaming.ToString());
|
||||
DrawItem("Supports Multi-sample Auto Resolve", SystemInfo.supportsMultisampleAutoResolve.ToString());
|
||||
#endif
|
||||
#if UNITY_2018_3_OR_NEWER
|
||||
DrawItem("Supports Separated Render Targets Blend", SystemInfo.supportsSeparatedRenderTargetsBlend.ToString());
|
||||
#endif
|
||||
#if UNITY_2019_1_OR_NEWER
|
||||
DrawItem("Supports Set Constant Buffer", SystemInfo.supportsSetConstantBuffer.ToString());
|
||||
#endif
|
||||
#if UNITY_2019_3_OR_NEWER
|
||||
DrawItem("Supports Geometry Shaders", SystemInfo.supportsGeometryShaders.ToString());
|
||||
DrawItem("Supports Ray Tracing", SystemInfo.supportsRayTracing.ToString());
|
||||
DrawItem("Supports Tessellation Shaders", SystemInfo.supportsTessellationShaders.ToString());
|
||||
#endif
|
||||
#if UNITY_2020_1_OR_NEWER
|
||||
DrawItem("Supports Compressed 3D Textures", SystemInfo.supportsCompressed3DTextures.ToString());
|
||||
DrawItem("Supports Conservative Raster", SystemInfo.supportsConservativeRaster.ToString());
|
||||
DrawItem("Supports GPU Recorder", SystemInfo.supportsGpuRecorder.ToString());
|
||||
#endif
|
||||
#if UNITY_2020_2_OR_NEWER
|
||||
DrawItem("Supports Multi-sampled 2D Array Textures", SystemInfo.supportsMultisampled2DArrayTextures.ToString());
|
||||
DrawItem("Supports Multiview", SystemInfo.supportsMultiview.ToString());
|
||||
DrawItem("Supports Render Target Array Index From Vertex Shader", SystemInfo.supportsRenderTargetArrayIndexFromVertexShader.ToString());
|
||||
#endif
|
||||
}
|
||||
GUILayout.EndVertical();
|
||||
}
|
||||
|
||||
private string GetShaderLevelString(int shaderLevel)
|
||||
{
|
||||
return Utility.Text.Format("Shader Model {0}.{1}", shaderLevel / 10, shaderLevel % 10);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a1342573add002c41b3bb1a8abb8ef3a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+46
@@ -0,0 +1,46 @@
|
||||
//------------------------------------------------------------
|
||||
// Game Framework
|
||||
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
|
||||
// Homepage: https://gameframework.cn/
|
||||
// Feedback: mailto:ellan@gameframework.cn
|
||||
//------------------------------------------------------------
|
||||
|
||||
using GameFramework;
|
||||
using UnityEngine;
|
||||
|
||||
namespace UnityGameFramework.Runtime
|
||||
{
|
||||
public sealed partial class DebuggerComponent : GameFrameworkComponent
|
||||
{
|
||||
private sealed class InputAccelerationInformationWindow : ScrollableDebuggerWindowBase
|
||||
{
|
||||
protected override void OnDrawScrollableWindow()
|
||||
{
|
||||
GUILayout.Label("<b>Input Acceleration Information</b>");
|
||||
GUILayout.BeginVertical("box");
|
||||
{
|
||||
DrawItem("Acceleration", Input.acceleration.ToString());
|
||||
DrawItem("Acceleration Event Count", Input.accelerationEventCount.ToString());
|
||||
DrawItem("Acceleration Events", GetAccelerationEventsString(Input.accelerationEvents));
|
||||
}
|
||||
GUILayout.EndVertical();
|
||||
}
|
||||
|
||||
private string GetAccelerationEventString(AccelerationEvent accelerationEvent)
|
||||
{
|
||||
return Utility.Text.Format("{0}, {1}", accelerationEvent.acceleration, accelerationEvent.deltaTime);
|
||||
}
|
||||
|
||||
private string GetAccelerationEventsString(AccelerationEvent[] accelerationEvents)
|
||||
{
|
||||
string[] accelerationEventStrings = new string[accelerationEvents.Length];
|
||||
for (int i = 0; i < accelerationEvents.Length; i++)
|
||||
{
|
||||
accelerationEventStrings[i] = GetAccelerationEventString(accelerationEvents[i]);
|
||||
}
|
||||
|
||||
return string.Join("; ", accelerationEventStrings);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 99bd178c0d097a24d9e04fe1522bca60
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+48
@@ -0,0 +1,48 @@
|
||||
//------------------------------------------------------------
|
||||
// Game Framework
|
||||
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
|
||||
// Homepage: https://gameframework.cn/
|
||||
// Feedback: mailto:ellan@gameframework.cn
|
||||
//------------------------------------------------------------
|
||||
|
||||
using UnityEngine;
|
||||
|
||||
namespace UnityGameFramework.Runtime
|
||||
{
|
||||
public sealed partial class DebuggerComponent : GameFrameworkComponent
|
||||
{
|
||||
private sealed class InputCompassInformationWindow : ScrollableDebuggerWindowBase
|
||||
{
|
||||
protected override void OnDrawScrollableWindow()
|
||||
{
|
||||
GUILayout.Label("<b>Input Compass Information</b>");
|
||||
GUILayout.BeginVertical("box");
|
||||
{
|
||||
GUILayout.BeginHorizontal();
|
||||
{
|
||||
if (GUILayout.Button("Enable", GUILayout.Height(30f)))
|
||||
{
|
||||
Input.compass.enabled = true;
|
||||
}
|
||||
if (GUILayout.Button("Disable", GUILayout.Height(30f)))
|
||||
{
|
||||
Input.compass.enabled = false;
|
||||
}
|
||||
}
|
||||
GUILayout.EndHorizontal();
|
||||
|
||||
DrawItem("Enabled", Input.compass.enabled.ToString());
|
||||
if (Input.compass.enabled)
|
||||
{
|
||||
DrawItem("Heading Accuracy", Input.compass.headingAccuracy.ToString());
|
||||
DrawItem("Magnetic Heading", Input.compass.magneticHeading.ToString());
|
||||
DrawItem("Raw Vector", Input.compass.rawVector.ToString());
|
||||
DrawItem("Timestamp", Input.compass.timestamp.ToString());
|
||||
DrawItem("True Heading", Input.compass.trueHeading.ToString());
|
||||
}
|
||||
}
|
||||
GUILayout.EndVertical();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a8e33bb9948f7f54d988d80a6ae6a24a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+49
@@ -0,0 +1,49 @@
|
||||
//------------------------------------------------------------
|
||||
// Game Framework
|
||||
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
|
||||
// Homepage: https://gameframework.cn/
|
||||
// Feedback: mailto:ellan@gameframework.cn
|
||||
//------------------------------------------------------------
|
||||
|
||||
using UnityEngine;
|
||||
|
||||
namespace UnityGameFramework.Runtime
|
||||
{
|
||||
public sealed partial class DebuggerComponent : GameFrameworkComponent
|
||||
{
|
||||
private sealed class InputGyroscopeInformationWindow : ScrollableDebuggerWindowBase
|
||||
{
|
||||
protected override void OnDrawScrollableWindow()
|
||||
{
|
||||
GUILayout.Label("<b>Input Gyroscope Information</b>");
|
||||
GUILayout.BeginVertical("box");
|
||||
{
|
||||
GUILayout.BeginHorizontal();
|
||||
{
|
||||
if (GUILayout.Button("Enable", GUILayout.Height(30f)))
|
||||
{
|
||||
Input.gyro.enabled = true;
|
||||
}
|
||||
if (GUILayout.Button("Disable", GUILayout.Height(30f)))
|
||||
{
|
||||
Input.gyro.enabled = false;
|
||||
}
|
||||
}
|
||||
GUILayout.EndHorizontal();
|
||||
|
||||
DrawItem("Enabled", Input.gyro.enabled.ToString());
|
||||
if (Input.gyro.enabled)
|
||||
{
|
||||
DrawItem("Update Interval", Input.gyro.updateInterval.ToString());
|
||||
DrawItem("Attitude", Input.gyro.attitude.eulerAngles.ToString());
|
||||
DrawItem("Gravity", Input.gyro.gravity.ToString());
|
||||
DrawItem("Rotation Rate", Input.gyro.rotationRate.ToString());
|
||||
DrawItem("Rotation Rate Unbiased", Input.gyro.rotationRateUnbiased.ToString());
|
||||
DrawItem("User Acceleration", Input.gyro.userAcceleration.ToString());
|
||||
}
|
||||
}
|
||||
GUILayout.EndVertical();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 709450f452a296b44b4aa939cf37f37c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+50
@@ -0,0 +1,50 @@
|
||||
//------------------------------------------------------------
|
||||
// Game Framework
|
||||
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
|
||||
// Homepage: https://gameframework.cn/
|
||||
// Feedback: mailto:ellan@gameframework.cn
|
||||
//------------------------------------------------------------
|
||||
|
||||
using UnityEngine;
|
||||
|
||||
namespace UnityGameFramework.Runtime
|
||||
{
|
||||
public sealed partial class DebuggerComponent : GameFrameworkComponent
|
||||
{
|
||||
private sealed class InputLocationInformationWindow : ScrollableDebuggerWindowBase
|
||||
{
|
||||
protected override void OnDrawScrollableWindow()
|
||||
{
|
||||
GUILayout.Label("<b>Input Location Information</b>");
|
||||
GUILayout.BeginVertical("box");
|
||||
{
|
||||
GUILayout.BeginHorizontal();
|
||||
{
|
||||
if (GUILayout.Button("Enable", GUILayout.Height(30f)))
|
||||
{
|
||||
Input.location.Start();
|
||||
}
|
||||
if (GUILayout.Button("Disable", GUILayout.Height(30f)))
|
||||
{
|
||||
Input.location.Stop();
|
||||
}
|
||||
}
|
||||
GUILayout.EndHorizontal();
|
||||
|
||||
DrawItem("Is Enabled By User", Input.location.isEnabledByUser.ToString());
|
||||
DrawItem("Status", Input.location.status.ToString());
|
||||
if (Input.location.status == LocationServiceStatus.Running)
|
||||
{
|
||||
DrawItem("Horizontal Accuracy", Input.location.lastData.horizontalAccuracy.ToString());
|
||||
DrawItem("Vertical Accuracy", Input.location.lastData.verticalAccuracy.ToString());
|
||||
DrawItem("Longitude", Input.location.lastData.longitude.ToString());
|
||||
DrawItem("Latitude", Input.location.lastData.latitude.ToString());
|
||||
DrawItem("Altitude", Input.location.lastData.altitude.ToString());
|
||||
DrawItem("Timestamp", Input.location.lastData.timestamp.ToString());
|
||||
}
|
||||
}
|
||||
GUILayout.EndVertical();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 74c5698b7ee786442b28b64003f564fc
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
//------------------------------------------------------------
|
||||
// Game Framework
|
||||
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
|
||||
// Homepage: https://gameframework.cn/
|
||||
// Feedback: mailto:ellan@gameframework.cn
|
||||
//------------------------------------------------------------
|
||||
|
||||
using UnityEngine;
|
||||
|
||||
namespace UnityGameFramework.Runtime
|
||||
{
|
||||
public sealed partial class DebuggerComponent : GameFrameworkComponent
|
||||
{
|
||||
private sealed class InputSummaryInformationWindow : ScrollableDebuggerWindowBase
|
||||
{
|
||||
protected override void OnDrawScrollableWindow()
|
||||
{
|
||||
GUILayout.Label("<b>Input Summary Information</b>");
|
||||
GUILayout.BeginVertical("box");
|
||||
{
|
||||
DrawItem("Back Button Leaves App", Input.backButtonLeavesApp.ToString());
|
||||
DrawItem("Device Orientation", Input.deviceOrientation.ToString());
|
||||
DrawItem("Mouse Present", Input.mousePresent.ToString());
|
||||
DrawItem("Mouse Position", Input.mousePosition.ToString());
|
||||
DrawItem("Mouse Scroll Delta", Input.mouseScrollDelta.ToString());
|
||||
DrawItem("Any Key", Input.anyKey.ToString());
|
||||
DrawItem("Any Key Down", Input.anyKeyDown.ToString());
|
||||
DrawItem("Input String", Input.inputString);
|
||||
DrawItem("IME Is Selected", Input.imeIsSelected.ToString());
|
||||
DrawItem("IME Composition Mode", Input.imeCompositionMode.ToString());
|
||||
DrawItem("Compensate Sensors", Input.compensateSensors.ToString());
|
||||
DrawItem("Composition Cursor Position", Input.compositionCursorPos.ToString());
|
||||
DrawItem("Composition String", Input.compositionString);
|
||||
}
|
||||
GUILayout.EndVertical();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a2756ce9647dc6a49a66c75437edef8b
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+50
@@ -0,0 +1,50 @@
|
||||
//------------------------------------------------------------
|
||||
// Game Framework
|
||||
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
|
||||
// Homepage: https://gameframework.cn/
|
||||
// Feedback: mailto:ellan@gameframework.cn
|
||||
//------------------------------------------------------------
|
||||
|
||||
using GameFramework;
|
||||
using UnityEngine;
|
||||
|
||||
namespace UnityGameFramework.Runtime
|
||||
{
|
||||
public sealed partial class DebuggerComponent : GameFrameworkComponent
|
||||
{
|
||||
private sealed class InputTouchInformationWindow : ScrollableDebuggerWindowBase
|
||||
{
|
||||
protected override void OnDrawScrollableWindow()
|
||||
{
|
||||
GUILayout.Label("<b>Input Touch Information</b>");
|
||||
GUILayout.BeginVertical("box");
|
||||
{
|
||||
DrawItem("Touch Supported", Input.touchSupported.ToString());
|
||||
DrawItem("Touch Pressure Supported", Input.touchPressureSupported.ToString());
|
||||
DrawItem("Stylus Touch Supported", Input.stylusTouchSupported.ToString());
|
||||
DrawItem("Simulate Mouse With Touches", Input.simulateMouseWithTouches.ToString());
|
||||
DrawItem("Multi Touch Enabled", Input.multiTouchEnabled.ToString());
|
||||
DrawItem("Touch Count", Input.touchCount.ToString());
|
||||
DrawItem("Touches", GetTouchesString(Input.touches));
|
||||
}
|
||||
GUILayout.EndVertical();
|
||||
}
|
||||
|
||||
private string GetTouchString(Touch touch)
|
||||
{
|
||||
return Utility.Text.Format("{0}, {1}, {2}, {3}, {4}", touch.position, touch.deltaPosition, touch.rawPosition, touch.pressure, touch.phase);
|
||||
}
|
||||
|
||||
private string GetTouchesString(Touch[] touches)
|
||||
{
|
||||
string[] touchStrings = new string[touches.Length];
|
||||
for (int i = 0; i < touches.Length; i++)
|
||||
{
|
||||
touchStrings[i] = GetTouchString(touches[i]);
|
||||
}
|
||||
|
||||
return string.Join("; ", touchStrings);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6a76aa41d893e994f9630028d5e3001d
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,125 @@
|
||||
//------------------------------------------------------------
|
||||
// Game Framework
|
||||
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
|
||||
// Homepage: https://gameframework.cn/
|
||||
// Feedback: mailto:ellan@gameframework.cn
|
||||
//------------------------------------------------------------
|
||||
|
||||
using GameFramework;
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
namespace UnityGameFramework.Runtime
|
||||
{
|
||||
public sealed partial class DebuggerComponent : GameFrameworkComponent
|
||||
{
|
||||
/// <summary>
|
||||
/// 日志记录结点。
|
||||
/// </summary>
|
||||
public sealed class LogNode : IReference
|
||||
{
|
||||
private DateTime m_LogTime;
|
||||
private int m_LogFrameCount;
|
||||
private LogType m_LogType;
|
||||
private string m_LogMessage;
|
||||
private string m_StackTrack;
|
||||
|
||||
/// <summary>
|
||||
/// 初始化日志记录结点的新实例。
|
||||
/// </summary>
|
||||
public LogNode()
|
||||
{
|
||||
m_LogTime = default(DateTime);
|
||||
m_LogFrameCount = 0;
|
||||
m_LogType = LogType.Error;
|
||||
m_LogMessage = null;
|
||||
m_StackTrack = null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取日志时间。
|
||||
/// </summary>
|
||||
public DateTime LogTime
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_LogTime;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取日志帧计数。
|
||||
/// </summary>
|
||||
public int LogFrameCount
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_LogFrameCount;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取日志类型。
|
||||
/// </summary>
|
||||
public LogType LogType
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_LogType;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取日志内容。
|
||||
/// </summary>
|
||||
public string LogMessage
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_LogMessage;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取日志堆栈信息。
|
||||
/// </summary>
|
||||
public string StackTrack
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_StackTrack;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 创建日志记录结点。
|
||||
/// </summary>
|
||||
/// <param name="logType">日志类型。</param>
|
||||
/// <param name="logMessage">日志内容。</param>
|
||||
/// <param name="stackTrack">日志堆栈信息。</param>
|
||||
/// <returns>创建的日志记录结点。</returns>
|
||||
public static LogNode Create(LogType logType, string logMessage, string stackTrack)
|
||||
{
|
||||
LogNode logNode = ReferencePool.Acquire<LogNode>();
|
||||
logNode.m_LogTime = DateTime.UtcNow;
|
||||
logNode.m_LogFrameCount = Time.frameCount;
|
||||
logNode.m_LogType = logType;
|
||||
logNode.m_LogMessage = logMessage;
|
||||
logNode.m_StackTrack = stackTrack;
|
||||
return logNode;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 清理日志记录结点。
|
||||
/// </summary>
|
||||
public void Clear()
|
||||
{
|
||||
m_LogTime = default(DateTime);
|
||||
m_LogFrameCount = 0;
|
||||
m_LogType = LogType.Error;
|
||||
m_LogMessage = null;
|
||||
m_StackTrack = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 168b4dfdd72224e4bbc5fb606eec23dd
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+70
@@ -0,0 +1,70 @@
|
||||
//------------------------------------------------------------
|
||||
// Game Framework
|
||||
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
|
||||
// Homepage: https://gameframework.cn/
|
||||
// Feedback: mailto:ellan@gameframework.cn
|
||||
//------------------------------------------------------------
|
||||
|
||||
using GameFramework;
|
||||
using GameFramework.Network;
|
||||
using UnityEngine;
|
||||
|
||||
namespace UnityGameFramework.Runtime
|
||||
{
|
||||
public sealed partial class DebuggerComponent : GameFrameworkComponent
|
||||
{
|
||||
private sealed class NetworkInformationWindow : ScrollableDebuggerWindowBase
|
||||
{
|
||||
private NetworkComponent m_NetworkComponent = null;
|
||||
|
||||
public override void Initialize(params object[] args)
|
||||
{
|
||||
m_NetworkComponent = GameEntry.GetComponent<NetworkComponent>();
|
||||
if (m_NetworkComponent == null)
|
||||
{
|
||||
Log.Fatal("Network component is invalid.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnDrawScrollableWindow()
|
||||
{
|
||||
GUILayout.Label("<b>Network Information</b>");
|
||||
GUILayout.BeginVertical("box");
|
||||
{
|
||||
DrawItem("Network Channel Count", m_NetworkComponent.NetworkChannelCount.ToString());
|
||||
}
|
||||
GUILayout.EndVertical();
|
||||
INetworkChannel[] networkChannels = m_NetworkComponent.GetAllNetworkChannels();
|
||||
for (int i = 0; i < networkChannels.Length; i++)
|
||||
{
|
||||
DrawNetworkChannel(networkChannels[i]);
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawNetworkChannel(INetworkChannel networkChannel)
|
||||
{
|
||||
GUILayout.Label(Utility.Text.Format("<b>Network Channel: {0} ({1})</b>", networkChannel.Name, networkChannel.Connected ? "Connected" : "Disconnected"));
|
||||
GUILayout.BeginVertical("box");
|
||||
{
|
||||
DrawItem("Service Type", networkChannel.ServiceType.ToString());
|
||||
DrawItem("Address Family", networkChannel.AddressFamily.ToString());
|
||||
DrawItem("Local Address", networkChannel.Connected ? networkChannel.Socket.LocalEndPoint.ToString() : "Unavailable");
|
||||
DrawItem("Remote Address", networkChannel.Connected ? networkChannel.Socket.RemoteEndPoint.ToString() : "Unavailable");
|
||||
DrawItem("Send Packet", Utility.Text.Format("{0} / {1}", networkChannel.SendPacketCount, networkChannel.SentPacketCount));
|
||||
DrawItem("Receive Packet", Utility.Text.Format("{0} / {1}", networkChannel.ReceivePacketCount, networkChannel.ReceivedPacketCount));
|
||||
DrawItem("Miss Heart Beat Count", networkChannel.MissHeartBeatCount.ToString());
|
||||
DrawItem("Heart Beat", Utility.Text.Format("{0:F2} / {1:F2}", networkChannel.HeartBeatElapseSeconds, networkChannel.HeartBeatInterval));
|
||||
if (networkChannel.Connected)
|
||||
{
|
||||
if (GUILayout.Button("Disconnect", GUILayout.Height(30f)))
|
||||
{
|
||||
networkChannel.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
GUILayout.EndVertical();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 51d087cb976f4944487629d900a5c057
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+95
@@ -0,0 +1,95 @@
|
||||
//------------------------------------------------------------
|
||||
// Game Framework
|
||||
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
|
||||
// Homepage: https://gameframework.cn/
|
||||
// Feedback: mailto:ellan@gameframework.cn
|
||||
//------------------------------------------------------------
|
||||
|
||||
using GameFramework;
|
||||
using GameFramework.ObjectPool;
|
||||
using UnityEngine;
|
||||
|
||||
namespace UnityGameFramework.Runtime
|
||||
{
|
||||
public sealed partial class DebuggerComponent : GameFrameworkComponent
|
||||
{
|
||||
private sealed class ObjectPoolInformationWindow : ScrollableDebuggerWindowBase
|
||||
{
|
||||
private ObjectPoolComponent m_ObjectPoolComponent = null;
|
||||
|
||||
public override void Initialize(params object[] args)
|
||||
{
|
||||
m_ObjectPoolComponent = GameEntry.GetComponent<ObjectPoolComponent>();
|
||||
if (m_ObjectPoolComponent == null)
|
||||
{
|
||||
Log.Fatal("Object pool component is invalid.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnDrawScrollableWindow()
|
||||
{
|
||||
GUILayout.Label("<b>Object Pool Information</b>");
|
||||
GUILayout.BeginVertical("box");
|
||||
{
|
||||
DrawItem("Object Pool Count", m_ObjectPoolComponent.Count.ToString());
|
||||
}
|
||||
GUILayout.EndVertical();
|
||||
ObjectPoolBase[] objectPools = m_ObjectPoolComponent.GetAllObjectPools(true);
|
||||
for (int i = 0; i < objectPools.Length; i++)
|
||||
{
|
||||
DrawObjectPool(objectPools[i]);
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawObjectPool(ObjectPoolBase objectPool)
|
||||
{
|
||||
GUILayout.Label(Utility.Text.Format("<b>Object Pool: {0}</b>", objectPool.FullName));
|
||||
GUILayout.BeginVertical("box");
|
||||
{
|
||||
DrawItem("Name", objectPool.Name);
|
||||
DrawItem("Type", objectPool.ObjectType.FullName);
|
||||
DrawItem("Auto Release Interval", objectPool.AutoReleaseInterval.ToString());
|
||||
DrawItem("Capacity", objectPool.Capacity.ToString());
|
||||
DrawItem("Used Count", objectPool.Count.ToString());
|
||||
DrawItem("Can Release Count", objectPool.CanReleaseCount.ToString());
|
||||
DrawItem("Expire Time", objectPool.ExpireTime.ToString());
|
||||
DrawItem("Priority", objectPool.Priority.ToString());
|
||||
ObjectInfo[] objectInfos = objectPool.GetAllObjectInfos();
|
||||
GUILayout.BeginHorizontal();
|
||||
{
|
||||
GUILayout.Label("<b>Name</b>");
|
||||
GUILayout.Label("<b>Locked</b>", GUILayout.Width(60f));
|
||||
GUILayout.Label(objectPool.AllowMultiSpawn ? "<b>Count</b>" : "<b>In Use</b>", GUILayout.Width(60f));
|
||||
GUILayout.Label("<b>Flag</b>", GUILayout.Width(60f));
|
||||
GUILayout.Label("<b>Priority</b>", GUILayout.Width(60f));
|
||||
GUILayout.Label("<b>Last Use Time</b>", GUILayout.Width(120f));
|
||||
}
|
||||
GUILayout.EndHorizontal();
|
||||
|
||||
if (objectInfos.Length > 0)
|
||||
{
|
||||
for (int i = 0; i < objectInfos.Length; i++)
|
||||
{
|
||||
GUILayout.BeginHorizontal();
|
||||
{
|
||||
GUILayout.Label(string.IsNullOrEmpty(objectInfos[i].Name) ? "<None>" : objectInfos[i].Name);
|
||||
GUILayout.Label(objectInfos[i].Locked.ToString(), GUILayout.Width(60f));
|
||||
GUILayout.Label(objectPool.AllowMultiSpawn ? objectInfos[i].SpawnCount.ToString() : objectInfos[i].IsInUse.ToString(), GUILayout.Width(60f));
|
||||
GUILayout.Label(objectInfos[i].CustomCanReleaseFlag.ToString(), GUILayout.Width(60f));
|
||||
GUILayout.Label(objectInfos[i].Priority.ToString(), GUILayout.Width(60f));
|
||||
GUILayout.Label(objectInfos[i].LastUseTime.ToLocalTime().ToString("yyyy-MM-dd HH:mm:ss"), GUILayout.Width(120f));
|
||||
}
|
||||
GUILayout.EndHorizontal();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
GUILayout.Label("<i>Object Pool is Empty ...</i>");
|
||||
}
|
||||
}
|
||||
GUILayout.EndVertical();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5898a6ad35652924590c863ef4bc6341
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,66 @@
|
||||
//------------------------------------------------------------
|
||||
// Game Framework
|
||||
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
|
||||
// Homepage: https://gameframework.cn/
|
||||
// Feedback: mailto:ellan@gameframework.cn
|
||||
//------------------------------------------------------------
|
||||
|
||||
using UnityEngine;
|
||||
|
||||
namespace UnityGameFramework.Runtime
|
||||
{
|
||||
public sealed partial class DebuggerComponent : GameFrameworkComponent
|
||||
{
|
||||
private sealed class OperationsWindow : ScrollableDebuggerWindowBase
|
||||
{
|
||||
protected override void OnDrawScrollableWindow()
|
||||
{
|
||||
GUILayout.Label("<b>Operations</b>");
|
||||
GUILayout.BeginVertical("box");
|
||||
{
|
||||
ObjectPoolComponent objectPoolComponent = GameEntry.GetComponent<ObjectPoolComponent>();
|
||||
if (objectPoolComponent != null)
|
||||
{
|
||||
if (GUILayout.Button("Object Pool Release", GUILayout.Height(30f)))
|
||||
{
|
||||
objectPoolComponent.Release();
|
||||
}
|
||||
|
||||
if (GUILayout.Button("Object Pool Release All Unused", GUILayout.Height(30f)))
|
||||
{
|
||||
objectPoolComponent.ReleaseAllUnused();
|
||||
}
|
||||
}
|
||||
|
||||
ResourceComponent resourceCompoent = GameEntry.GetComponent<ResourceComponent>();
|
||||
if (resourceCompoent != null)
|
||||
{
|
||||
if (GUILayout.Button("Unload Unused Assets", GUILayout.Height(30f)))
|
||||
{
|
||||
resourceCompoent.ForceUnloadUnusedAssets(false);
|
||||
}
|
||||
|
||||
if (GUILayout.Button("Unload Unused Assets and Garbage Collect", GUILayout.Height(30f)))
|
||||
{
|
||||
resourceCompoent.ForceUnloadUnusedAssets(true);
|
||||
}
|
||||
}
|
||||
|
||||
if (GUILayout.Button("Shutdown Game Framework (None)", GUILayout.Height(30f)))
|
||||
{
|
||||
GameEntry.Shutdown(ShutdownType.None);
|
||||
}
|
||||
if (GUILayout.Button("Shutdown Game Framework (Restart)", GUILayout.Height(30f)))
|
||||
{
|
||||
GameEntry.Shutdown(ShutdownType.Restart);
|
||||
}
|
||||
if (GUILayout.Button("Shutdown Game Framework (Quit)", GUILayout.Height(30f)))
|
||||
{
|
||||
GameEntry.Shutdown(ShutdownType.Quit);
|
||||
}
|
||||
}
|
||||
GUILayout.EndVertical();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a695dd87b92d7374fbe3790f5a25e9d5
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
//------------------------------------------------------------
|
||||
// Game Framework
|
||||
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
|
||||
// Homepage: https://gameframework.cn/
|
||||
// Feedback: mailto:ellan@gameframework.cn
|
||||
//------------------------------------------------------------
|
||||
|
||||
using GameFramework;
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
namespace UnityGameFramework.Runtime
|
||||
{
|
||||
public sealed partial class DebuggerComponent : GameFrameworkComponent
|
||||
{
|
||||
private sealed class PathInformationWindow : ScrollableDebuggerWindowBase
|
||||
{
|
||||
protected override void OnDrawScrollableWindow()
|
||||
{
|
||||
GUILayout.Label("<b>Path Information</b>");
|
||||
GUILayout.BeginVertical("box");
|
||||
{
|
||||
DrawItem("Current Directory", Utility.Path.GetRegularPath(Environment.CurrentDirectory));
|
||||
DrawItem("Data Path", Utility.Path.GetRegularPath(Application.dataPath));
|
||||
DrawItem("Persistent Data Path", Utility.Path.GetRegularPath(Application.persistentDataPath));
|
||||
DrawItem("Streaming Assets Path", Utility.Path.GetRegularPath(Application.streamingAssetsPath));
|
||||
DrawItem("Temporary Cache Path", Utility.Path.GetRegularPath(Application.temporaryCachePath));
|
||||
#if UNITY_2018_3_OR_NEWER
|
||||
DrawItem("Console Log Path", Utility.Path.GetRegularPath(Application.consoleLogPath));
|
||||
#endif
|
||||
}
|
||||
GUILayout.EndVertical();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e86b5be349fea7b46bf4c9cff62cf940
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+67
@@ -0,0 +1,67 @@
|
||||
//------------------------------------------------------------
|
||||
// Game Framework
|
||||
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
|
||||
// Homepage: https://gameframework.cn/
|
||||
// Feedback: mailto:ellan@gameframework.cn
|
||||
//------------------------------------------------------------
|
||||
|
||||
using GameFramework;
|
||||
using UnityEngine;
|
||||
#if UNITY_5_5_OR_NEWER
|
||||
using UnityEngine.Profiling;
|
||||
#endif
|
||||
|
||||
namespace UnityGameFramework.Runtime
|
||||
{
|
||||
public sealed partial class DebuggerComponent : GameFrameworkComponent
|
||||
{
|
||||
private sealed class ProfilerInformationWindow : ScrollableDebuggerWindowBase
|
||||
{
|
||||
protected override void OnDrawScrollableWindow()
|
||||
{
|
||||
GUILayout.Label("<b>Profiler Information</b>");
|
||||
GUILayout.BeginVertical("box");
|
||||
{
|
||||
DrawItem("Supported", Profiler.supported.ToString());
|
||||
DrawItem("Enabled", Profiler.enabled.ToString());
|
||||
DrawItem("Enable Binary Log", Profiler.enableBinaryLog ? Utility.Text.Format("True, {0}", Profiler.logFile) : "False");
|
||||
#if UNITY_2019_3_OR_NEWER
|
||||
DrawItem("Enable Allocation Callstacks", Profiler.enableAllocationCallstacks.ToString());
|
||||
#endif
|
||||
#if UNITY_2018_3_OR_NEWER
|
||||
DrawItem("Area Count", Profiler.areaCount.ToString());
|
||||
#endif
|
||||
#if UNITY_5_3 || UNITY_5_4
|
||||
DrawItem("Max Samples Number Per Frame", Profiler.maxNumberOfSamplesPerFrame.ToString());
|
||||
#endif
|
||||
#if UNITY_2018_3_OR_NEWER
|
||||
DrawItem("Max Used Memory", GetByteLengthString(Profiler.maxUsedMemory));
|
||||
#endif
|
||||
#if UNITY_5_6_OR_NEWER
|
||||
DrawItem("Mono Used Size", GetByteLengthString(Profiler.GetMonoUsedSizeLong()));
|
||||
DrawItem("Mono Heap Size", GetByteLengthString(Profiler.GetMonoHeapSizeLong()));
|
||||
DrawItem("Used Heap Size", GetByteLengthString(Profiler.usedHeapSizeLong));
|
||||
DrawItem("Total Allocated Memory", GetByteLengthString(Profiler.GetTotalAllocatedMemoryLong()));
|
||||
DrawItem("Total Reserved Memory", GetByteLengthString(Profiler.GetTotalReservedMemoryLong()));
|
||||
DrawItem("Total Unused Reserved Memory", GetByteLengthString(Profiler.GetTotalUnusedReservedMemoryLong()));
|
||||
#else
|
||||
DrawItem("Mono Used Size", GetByteLengthString(Profiler.GetMonoUsedSize()));
|
||||
DrawItem("Mono Heap Size", GetByteLengthString(Profiler.GetMonoHeapSize()));
|
||||
DrawItem("Used Heap Size", GetByteLengthString(Profiler.usedHeapSize));
|
||||
DrawItem("Total Allocated Memory", GetByteLengthString(Profiler.GetTotalAllocatedMemory()));
|
||||
DrawItem("Total Reserved Memory", GetByteLengthString(Profiler.GetTotalReservedMemory()));
|
||||
DrawItem("Total Unused Reserved Memory", GetByteLengthString(Profiler.GetTotalUnusedReservedMemory()));
|
||||
#endif
|
||||
#if UNITY_2018_1_OR_NEWER
|
||||
DrawItem("Allocated Memory For Graphics Driver", GetByteLengthString(Profiler.GetAllocatedMemoryForGraphicsDriver()));
|
||||
#endif
|
||||
#if UNITY_5_5_OR_NEWER
|
||||
DrawItem("Temp Allocator Size", GetByteLengthString(Profiler.GetTempAllocatorSize()));
|
||||
#endif
|
||||
DrawItem("Marshal Cached HGlobal Size", GetByteLengthString(Utility.Marshal.CachedHGlobalSize));
|
||||
}
|
||||
GUILayout.EndVertical();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 73fd64cd790a9564d9e49d13ed0742c7
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+110
@@ -0,0 +1,110 @@
|
||||
//------------------------------------------------------------
|
||||
// Game Framework
|
||||
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
|
||||
// Homepage: https://gameframework.cn/
|
||||
// Feedback: mailto:ellan@gameframework.cn
|
||||
//------------------------------------------------------------
|
||||
|
||||
using GameFramework;
|
||||
using UnityEngine;
|
||||
|
||||
namespace UnityGameFramework.Runtime
|
||||
{
|
||||
public sealed partial class DebuggerComponent : GameFrameworkComponent
|
||||
{
|
||||
private sealed class QualityInformationWindow : ScrollableDebuggerWindowBase
|
||||
{
|
||||
private bool m_ApplyExpensiveChanges = false;
|
||||
|
||||
protected override void OnDrawScrollableWindow()
|
||||
{
|
||||
GUILayout.Label("<b>Quality Level</b>");
|
||||
GUILayout.BeginVertical("box");
|
||||
{
|
||||
int currentQualityLevel = QualitySettings.GetQualityLevel();
|
||||
|
||||
DrawItem("Current Quality Level", QualitySettings.names[currentQualityLevel]);
|
||||
m_ApplyExpensiveChanges = GUILayout.Toggle(m_ApplyExpensiveChanges, "Apply expensive changes on quality level change.");
|
||||
|
||||
int newQualityLevel = GUILayout.SelectionGrid(currentQualityLevel, QualitySettings.names, 3, "toggle");
|
||||
if (newQualityLevel != currentQualityLevel)
|
||||
{
|
||||
QualitySettings.SetQualityLevel(newQualityLevel, m_ApplyExpensiveChanges);
|
||||
}
|
||||
}
|
||||
GUILayout.EndVertical();
|
||||
|
||||
GUILayout.Label("<b>Rendering Information</b>");
|
||||
GUILayout.BeginVertical("box");
|
||||
{
|
||||
DrawItem("Active Color Space", QualitySettings.activeColorSpace.ToString());
|
||||
DrawItem("Desired Color Space", QualitySettings.desiredColorSpace.ToString());
|
||||
DrawItem("Max Queued Frames", QualitySettings.maxQueuedFrames.ToString());
|
||||
DrawItem("Pixel Light Count", QualitySettings.pixelLightCount.ToString());
|
||||
DrawItem("Master Texture Limit", QualitySettings.globalTextureMipmapLimit.ToString());
|
||||
DrawItem("Anisotropic Filtering", QualitySettings.anisotropicFiltering.ToString());
|
||||
DrawItem("Anti Aliasing", QualitySettings.antiAliasing.ToString());
|
||||
#if UNITY_5_5_OR_NEWER
|
||||
DrawItem("Soft Particles", QualitySettings.softParticles.ToString());
|
||||
#endif
|
||||
DrawItem("Soft Vegetation", QualitySettings.softVegetation.ToString());
|
||||
DrawItem("Realtime Reflection Probes", QualitySettings.realtimeReflectionProbes.ToString());
|
||||
DrawItem("Billboards Face Camera Position", QualitySettings.billboardsFaceCameraPosition.ToString());
|
||||
#if UNITY_2017_1_OR_NEWER
|
||||
DrawItem("Resolution Scaling Fixed DPI Factor", QualitySettings.resolutionScalingFixedDPIFactor.ToString());
|
||||
#endif
|
||||
#if UNITY_2018_2_OR_NEWER
|
||||
DrawItem("Texture Streaming Enabled", QualitySettings.streamingMipmapsActive.ToString());
|
||||
DrawItem("Texture Streaming Add All Cameras", QualitySettings.streamingMipmapsAddAllCameras.ToString());
|
||||
DrawItem("Texture Streaming Memory Budget", QualitySettings.streamingMipmapsMemoryBudget.ToString());
|
||||
DrawItem("Texture Streaming Renderers Per Frame", QualitySettings.streamingMipmapsRenderersPerFrame.ToString());
|
||||
DrawItem("Texture Streaming Max Level Reduction", QualitySettings.streamingMipmapsMaxLevelReduction.ToString());
|
||||
DrawItem("Texture Streaming Max File IO Requests", QualitySettings.streamingMipmapsMaxFileIORequests.ToString());
|
||||
#endif
|
||||
}
|
||||
GUILayout.EndVertical();
|
||||
|
||||
GUILayout.Label("<b>Shadows Information</b>");
|
||||
GUILayout.BeginVertical("box");
|
||||
{
|
||||
#if UNITY_2017_1_OR_NEWER
|
||||
DrawItem("Shadowmask Mode", QualitySettings.shadowmaskMode.ToString());
|
||||
#endif
|
||||
#if UNITY_5_5_OR_NEWER
|
||||
DrawItem("Shadow Quality", QualitySettings.shadows.ToString());
|
||||
#endif
|
||||
#if UNITY_5_4_OR_NEWER
|
||||
DrawItem("Shadow Resolution", QualitySettings.shadowResolution.ToString());
|
||||
#endif
|
||||
DrawItem("Shadow Projection", QualitySettings.shadowProjection.ToString());
|
||||
DrawItem("Shadow Distance", QualitySettings.shadowDistance.ToString());
|
||||
DrawItem("Shadow Near Plane Offset", QualitySettings.shadowNearPlaneOffset.ToString());
|
||||
DrawItem("Shadow Cascades", QualitySettings.shadowCascades.ToString());
|
||||
DrawItem("Shadow Cascade 2 Split", QualitySettings.shadowCascade2Split.ToString());
|
||||
DrawItem("Shadow Cascade 4 Split", QualitySettings.shadowCascade4Split.ToString());
|
||||
}
|
||||
GUILayout.EndVertical();
|
||||
|
||||
GUILayout.Label("<b>Other Information</b>");
|
||||
GUILayout.BeginVertical("box");
|
||||
{
|
||||
#if UNITY_2019_1_OR_NEWER
|
||||
DrawItem("Skin Weights", QualitySettings.skinWeights.ToString());
|
||||
#else
|
||||
DrawItem("Blend Weights", QualitySettings.blendWeights.ToString());
|
||||
#endif
|
||||
DrawItem("VSync Count", QualitySettings.vSyncCount.ToString());
|
||||
DrawItem("LOD Bias", QualitySettings.lodBias.ToString());
|
||||
DrawItem("Maximum LOD Level", QualitySettings.maximumLODLevel.ToString());
|
||||
DrawItem("Particle Raycast Budget", QualitySettings.particleRaycastBudget.ToString());
|
||||
DrawItem("Async Upload Time Slice", Utility.Text.Format("{0} ms", QualitySettings.asyncUploadTimeSlice));
|
||||
DrawItem("Async Upload Buffer Size", Utility.Text.Format("{0} MB", QualitySettings.asyncUploadBufferSize));
|
||||
#if UNITY_2018_3_OR_NEWER
|
||||
DrawItem("Async Upload Persistent Buffer", QualitySettings.asyncUploadPersistentBuffer.ToString());
|
||||
#endif
|
||||
}
|
||||
GUILayout.EndVertical();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: dc21c02fdf159d840a5254513a44c065
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+114
@@ -0,0 +1,114 @@
|
||||
//------------------------------------------------------------
|
||||
// Game Framework
|
||||
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
|
||||
// Homepage: https://gameframework.cn/
|
||||
// Feedback: mailto:ellan@gameframework.cn
|
||||
//------------------------------------------------------------
|
||||
|
||||
using GameFramework;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace UnityGameFramework.Runtime
|
||||
{
|
||||
public sealed partial class DebuggerComponent : GameFrameworkComponent
|
||||
{
|
||||
private sealed class ReferencePoolInformationWindow : ScrollableDebuggerWindowBase
|
||||
{
|
||||
private readonly Dictionary<string, List<ReferencePoolInfo>> m_ReferencePoolInfos = new Dictionary<string, List<ReferencePoolInfo>>(StringComparer.Ordinal);
|
||||
private readonly Comparison<ReferencePoolInfo> m_NormalClassNameComparer = NormalClassNameComparer;
|
||||
private readonly Comparison<ReferencePoolInfo> m_FullClassNameComparer = FullClassNameComparer;
|
||||
private bool m_ShowFullClassName = false;
|
||||
|
||||
public override void Initialize(params object[] args)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void OnDrawScrollableWindow()
|
||||
{
|
||||
GUILayout.Label("<b>Reference Pool Information</b>");
|
||||
GUILayout.BeginVertical("box");
|
||||
{
|
||||
DrawItem("Enable Strict Check", ReferencePool.EnableStrictCheck.ToString());
|
||||
DrawItem("Reference Pool Count", ReferencePool.Count.ToString());
|
||||
}
|
||||
GUILayout.EndVertical();
|
||||
|
||||
m_ShowFullClassName = GUILayout.Toggle(m_ShowFullClassName, "Show Full Class Name");
|
||||
m_ReferencePoolInfos.Clear();
|
||||
ReferencePoolInfo[] referencePoolInfos = ReferencePool.GetAllReferencePoolInfos();
|
||||
foreach (ReferencePoolInfo referencePoolInfo in referencePoolInfos)
|
||||
{
|
||||
string assemblyName = referencePoolInfo.Type.Assembly.GetName().Name;
|
||||
List<ReferencePoolInfo> results = null;
|
||||
if (!m_ReferencePoolInfos.TryGetValue(assemblyName, out results))
|
||||
{
|
||||
results = new List<ReferencePoolInfo>();
|
||||
m_ReferencePoolInfos.Add(assemblyName, results);
|
||||
}
|
||||
|
||||
results.Add(referencePoolInfo);
|
||||
}
|
||||
|
||||
foreach (KeyValuePair<string, List<ReferencePoolInfo>> assemblyReferencePoolInfo in m_ReferencePoolInfos)
|
||||
{
|
||||
GUILayout.Label(Utility.Text.Format("<b>Assembly: {0}</b>", assemblyReferencePoolInfo.Key));
|
||||
GUILayout.BeginVertical("box");
|
||||
{
|
||||
GUILayout.BeginHorizontal();
|
||||
{
|
||||
GUILayout.Label(m_ShowFullClassName ? "<b>Full Class Name</b>" : "<b>Class Name</b>");
|
||||
GUILayout.Label("<b>Unused</b>", GUILayout.Width(60f));
|
||||
GUILayout.Label("<b>Using</b>", GUILayout.Width(60f));
|
||||
GUILayout.Label("<b>Acquire</b>", GUILayout.Width(60f));
|
||||
GUILayout.Label("<b>Release</b>", GUILayout.Width(60f));
|
||||
GUILayout.Label("<b>Add</b>", GUILayout.Width(60f));
|
||||
GUILayout.Label("<b>Remove</b>", GUILayout.Width(60f));
|
||||
}
|
||||
GUILayout.EndHorizontal();
|
||||
|
||||
if (assemblyReferencePoolInfo.Value.Count > 0)
|
||||
{
|
||||
assemblyReferencePoolInfo.Value.Sort(m_ShowFullClassName ? m_FullClassNameComparer : m_NormalClassNameComparer);
|
||||
foreach (ReferencePoolInfo referencePoolInfo in assemblyReferencePoolInfo.Value)
|
||||
{
|
||||
DrawReferencePoolInfo(referencePoolInfo);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
GUILayout.Label("<i>Reference Pool is Empty ...</i>");
|
||||
}
|
||||
}
|
||||
GUILayout.EndVertical();
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawReferencePoolInfo(ReferencePoolInfo referencePoolInfo)
|
||||
{
|
||||
GUILayout.BeginHorizontal();
|
||||
{
|
||||
GUILayout.Label(m_ShowFullClassName ? referencePoolInfo.Type.FullName : referencePoolInfo.Type.Name);
|
||||
GUILayout.Label(referencePoolInfo.UnusedReferenceCount.ToString(), GUILayout.Width(60f));
|
||||
GUILayout.Label(referencePoolInfo.UsingReferenceCount.ToString(), GUILayout.Width(60f));
|
||||
GUILayout.Label(referencePoolInfo.AcquireReferenceCount.ToString(), GUILayout.Width(60f));
|
||||
GUILayout.Label(referencePoolInfo.ReleaseReferenceCount.ToString(), GUILayout.Width(60f));
|
||||
GUILayout.Label(referencePoolInfo.AddReferenceCount.ToString(), GUILayout.Width(60f));
|
||||
GUILayout.Label(referencePoolInfo.RemoveReferenceCount.ToString(), GUILayout.Width(60f));
|
||||
}
|
||||
GUILayout.EndHorizontal();
|
||||
}
|
||||
|
||||
private static int NormalClassNameComparer(ReferencePoolInfo a, ReferencePoolInfo b)
|
||||
{
|
||||
return a.Type.Name.CompareTo(b.Type.Name);
|
||||
}
|
||||
|
||||
private static int FullClassNameComparer(ReferencePoolInfo a, ReferencePoolInfo b)
|
||||
{
|
||||
return a.Type.FullName.CompareTo(b.Type.FullName);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 33068d0a27ec5684e994545a7995a17c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+67
@@ -0,0 +1,67 @@
|
||||
//------------------------------------------------------------
|
||||
// Game Framework
|
||||
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
|
||||
// Homepage: https://gameframework.cn/
|
||||
// Feedback: mailto:ellan@gameframework.cn
|
||||
//------------------------------------------------------------
|
||||
|
||||
namespace UnityGameFramework.Runtime
|
||||
{
|
||||
public sealed partial class DebuggerComponent : GameFrameworkComponent
|
||||
{
|
||||
private sealed partial class RuntimeMemoryInformationWindow<T> : ScrollableDebuggerWindowBase where T : UnityEngine.Object
|
||||
{
|
||||
private sealed class Sample
|
||||
{
|
||||
private readonly string m_Name;
|
||||
private readonly string m_Type;
|
||||
private readonly long m_Size;
|
||||
private bool m_Highlight;
|
||||
|
||||
public Sample(string name, string type, long size)
|
||||
{
|
||||
m_Name = name;
|
||||
m_Type = type;
|
||||
m_Size = size;
|
||||
m_Highlight = false;
|
||||
}
|
||||
|
||||
public string Name
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_Name;
|
||||
}
|
||||
}
|
||||
|
||||
public string Type
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_Type;
|
||||
}
|
||||
}
|
||||
|
||||
public long Size
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_Size;
|
||||
}
|
||||
}
|
||||
|
||||
public bool Highlight
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_Highlight;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_Highlight = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0da72213ab82f43458578c3ce477a57c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+142
@@ -0,0 +1,142 @@
|
||||
//------------------------------------------------------------
|
||||
// Game Framework
|
||||
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
|
||||
// Homepage: https://gameframework.cn/
|
||||
// Feedback: mailto:ellan@gameframework.cn
|
||||
//------------------------------------------------------------
|
||||
|
||||
using GameFramework;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
#if UNITY_5_5_OR_NEWER
|
||||
using UnityEngine.Profiling;
|
||||
#endif
|
||||
|
||||
namespace UnityGameFramework.Runtime
|
||||
{
|
||||
public sealed partial class DebuggerComponent : GameFrameworkComponent
|
||||
{
|
||||
private sealed partial class RuntimeMemoryInformationWindow<T> : ScrollableDebuggerWindowBase where T : UnityEngine.Object
|
||||
{
|
||||
private const int ShowSampleCount = 300;
|
||||
|
||||
private readonly List<Sample> m_Samples = new List<Sample>();
|
||||
private readonly Comparison<Sample> m_SampleComparer = SampleComparer;
|
||||
private DateTime m_SampleTime = DateTime.MinValue;
|
||||
private long m_SampleSize = 0L;
|
||||
private long m_DuplicateSampleSize = 0L;
|
||||
private int m_DuplicateSimpleCount = 0;
|
||||
|
||||
protected override void OnDrawScrollableWindow()
|
||||
{
|
||||
string typeName = typeof(T).Name;
|
||||
GUILayout.Label(Utility.Text.Format("<b>{0} Runtime Memory Information</b>", typeName));
|
||||
GUILayout.BeginVertical("box");
|
||||
{
|
||||
if (GUILayout.Button(Utility.Text.Format("Take Sample for {0}", typeName), GUILayout.Height(30f)))
|
||||
{
|
||||
TakeSample();
|
||||
}
|
||||
|
||||
if (m_SampleTime <= DateTime.MinValue)
|
||||
{
|
||||
GUILayout.Label(Utility.Text.Format("<b>Please take sample for {0} first.</b>", typeName));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_DuplicateSimpleCount > 0)
|
||||
{
|
||||
GUILayout.Label(Utility.Text.Format("<b>{0} {1}s ({2}) obtained at {3:yyyy-MM-dd HH:mm:ss}, while {4} {1}s ({5}) might be duplicated.</b>", m_Samples.Count, typeName, GetByteLengthString(m_SampleSize), m_SampleTime.ToLocalTime(), m_DuplicateSimpleCount, GetByteLengthString(m_DuplicateSampleSize)));
|
||||
}
|
||||
else
|
||||
{
|
||||
GUILayout.Label(Utility.Text.Format("<b>{0} {1}s ({2}) obtained at {3:yyyy-MM-dd HH:mm:ss}.</b>", m_Samples.Count, typeName, GetByteLengthString(m_SampleSize), m_SampleTime.ToLocalTime()));
|
||||
}
|
||||
|
||||
if (m_Samples.Count > 0)
|
||||
{
|
||||
GUILayout.BeginHorizontal();
|
||||
{
|
||||
GUILayout.Label(Utility.Text.Format("<b>{0} Name</b>", typeName));
|
||||
GUILayout.Label("<b>Type</b>", GUILayout.Width(240f));
|
||||
GUILayout.Label("<b>Size</b>", GUILayout.Width(80f));
|
||||
}
|
||||
GUILayout.EndHorizontal();
|
||||
}
|
||||
|
||||
int count = 0;
|
||||
for (int i = 0; i < m_Samples.Count; i++)
|
||||
{
|
||||
GUILayout.BeginHorizontal();
|
||||
{
|
||||
GUILayout.Label(m_Samples[i].Highlight ? Utility.Text.Format("<color=yellow>{0}</color>", m_Samples[i].Name) : m_Samples[i].Name);
|
||||
GUILayout.Label(m_Samples[i].Highlight ? Utility.Text.Format("<color=yellow>{0}</color>", m_Samples[i].Type) : m_Samples[i].Type, GUILayout.Width(240f));
|
||||
GUILayout.Label(m_Samples[i].Highlight ? Utility.Text.Format("<color=yellow>{0}</color>", GetByteLengthString(m_Samples[i].Size)) : GetByteLengthString(m_Samples[i].Size), GUILayout.Width(80f));
|
||||
}
|
||||
GUILayout.EndHorizontal();
|
||||
|
||||
count++;
|
||||
if (count >= ShowSampleCount)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
GUILayout.EndVertical();
|
||||
}
|
||||
|
||||
private void TakeSample()
|
||||
{
|
||||
m_SampleTime = DateTime.UtcNow;
|
||||
m_SampleSize = 0L;
|
||||
m_DuplicateSampleSize = 0L;
|
||||
m_DuplicateSimpleCount = 0;
|
||||
m_Samples.Clear();
|
||||
|
||||
T[] samples = Resources.FindObjectsOfTypeAll<T>();
|
||||
for (int i = 0; i < samples.Length; i++)
|
||||
{
|
||||
long sampleSize = 0L;
|
||||
#if UNITY_5_6_OR_NEWER
|
||||
sampleSize = Profiler.GetRuntimeMemorySizeLong(samples[i]);
|
||||
#else
|
||||
sampleSize = Profiler.GetRuntimeMemorySize(samples[i]);
|
||||
#endif
|
||||
m_SampleSize += sampleSize;
|
||||
m_Samples.Add(new Sample(samples[i].name, samples[i].GetType().Name, sampleSize));
|
||||
}
|
||||
|
||||
m_Samples.Sort(m_SampleComparer);
|
||||
|
||||
for (int i = 1; i < m_Samples.Count; i++)
|
||||
{
|
||||
if (m_Samples[i].Name == m_Samples[i - 1].Name && m_Samples[i].Type == m_Samples[i - 1].Type && m_Samples[i].Size == m_Samples[i - 1].Size)
|
||||
{
|
||||
m_Samples[i].Highlight = true;
|
||||
m_DuplicateSampleSize += m_Samples[i].Size;
|
||||
m_DuplicateSimpleCount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static int SampleComparer(Sample a, Sample b)
|
||||
{
|
||||
int result = b.Size.CompareTo(a.Size);
|
||||
if (result != 0)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
result = a.Type.CompareTo(b.Type);
|
||||
if (result != 0)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
return a.Name.CompareTo(b.Name);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 21007b3290d97754ea3ab4d9f46900e6
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+61
@@ -0,0 +1,61 @@
|
||||
//------------------------------------------------------------
|
||||
// Game Framework
|
||||
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
|
||||
// Homepage: https://gameframework.cn/
|
||||
// Feedback: mailto:ellan@gameframework.cn
|
||||
//------------------------------------------------------------
|
||||
|
||||
namespace UnityGameFramework.Runtime
|
||||
{
|
||||
public sealed partial class DebuggerComponent : GameFrameworkComponent
|
||||
{
|
||||
private sealed partial class RuntimeMemorySummaryWindow : ScrollableDebuggerWindowBase
|
||||
{
|
||||
private sealed class Record
|
||||
{
|
||||
private readonly string m_Name;
|
||||
private int m_Count;
|
||||
private long m_Size;
|
||||
|
||||
public Record(string name)
|
||||
{
|
||||
m_Name = name;
|
||||
m_Count = 0;
|
||||
m_Size = 0L;
|
||||
}
|
||||
|
||||
public string Name
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_Name;
|
||||
}
|
||||
}
|
||||
|
||||
public int Count
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_Count;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_Count = value;
|
||||
}
|
||||
}
|
||||
|
||||
public long Size
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_Size;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_Size = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 468bbdd114a04de429a6bd97b202c891
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+130
@@ -0,0 +1,130 @@
|
||||
//------------------------------------------------------------
|
||||
// Game Framework
|
||||
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
|
||||
// Homepage: https://gameframework.cn/
|
||||
// Feedback: mailto:ellan@gameframework.cn
|
||||
//------------------------------------------------------------
|
||||
|
||||
using GameFramework;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
#if UNITY_5_5_OR_NEWER
|
||||
using UnityEngine.Profiling;
|
||||
#endif
|
||||
|
||||
namespace UnityGameFramework.Runtime
|
||||
{
|
||||
public sealed partial class DebuggerComponent : GameFrameworkComponent
|
||||
{
|
||||
private sealed partial class RuntimeMemorySummaryWindow : ScrollableDebuggerWindowBase
|
||||
{
|
||||
private readonly List<Record> m_Records = new List<Record>();
|
||||
private readonly Comparison<Record> m_RecordComparer = RecordComparer;
|
||||
private DateTime m_SampleTime = DateTime.MinValue;
|
||||
private int m_SampleCount = 0;
|
||||
private long m_SampleSize = 0L;
|
||||
|
||||
protected override void OnDrawScrollableWindow()
|
||||
{
|
||||
GUILayout.Label("<b>Runtime Memory Summary</b>");
|
||||
GUILayout.BeginVertical("box");
|
||||
{
|
||||
if (GUILayout.Button("Take Sample", GUILayout.Height(30f)))
|
||||
{
|
||||
TakeSample();
|
||||
}
|
||||
|
||||
if (m_SampleTime <= DateTime.MinValue)
|
||||
{
|
||||
GUILayout.Label("<b>Please take sample first.</b>");
|
||||
}
|
||||
else
|
||||
{
|
||||
GUILayout.Label(Utility.Text.Format("<b>{0} Objects ({1}) obtained at {2:yyyy-MM-dd HH:mm:ss}.</b>", m_SampleCount, GetByteLengthString(m_SampleSize), m_SampleTime.ToLocalTime()));
|
||||
|
||||
GUILayout.BeginHorizontal();
|
||||
{
|
||||
GUILayout.Label("<b>Type</b>");
|
||||
GUILayout.Label("<b>Count</b>", GUILayout.Width(120f));
|
||||
GUILayout.Label("<b>Size</b>", GUILayout.Width(120f));
|
||||
}
|
||||
GUILayout.EndHorizontal();
|
||||
|
||||
for (int i = 0; i < m_Records.Count; i++)
|
||||
{
|
||||
GUILayout.BeginHorizontal();
|
||||
{
|
||||
GUILayout.Label(m_Records[i].Name);
|
||||
GUILayout.Label(m_Records[i].Count.ToString(), GUILayout.Width(120f));
|
||||
GUILayout.Label(GetByteLengthString(m_Records[i].Size), GUILayout.Width(120f));
|
||||
}
|
||||
GUILayout.EndHorizontal();
|
||||
}
|
||||
}
|
||||
}
|
||||
GUILayout.EndVertical();
|
||||
}
|
||||
|
||||
private void TakeSample()
|
||||
{
|
||||
m_Records.Clear();
|
||||
m_SampleTime = DateTime.UtcNow;
|
||||
m_SampleCount = 0;
|
||||
m_SampleSize = 0L;
|
||||
|
||||
UnityEngine.Object[] samples = Resources.FindObjectsOfTypeAll<UnityEngine.Object>();
|
||||
for (int i = 0; i < samples.Length; i++)
|
||||
{
|
||||
long sampleSize = 0L;
|
||||
#if UNITY_5_6_OR_NEWER
|
||||
sampleSize = Profiler.GetRuntimeMemorySizeLong(samples[i]);
|
||||
#else
|
||||
sampleSize = Profiler.GetRuntimeMemorySize(samples[i]);
|
||||
#endif
|
||||
string name = samples[i].GetType().Name;
|
||||
m_SampleCount++;
|
||||
m_SampleSize += sampleSize;
|
||||
|
||||
Record record = null;
|
||||
foreach (Record r in m_Records)
|
||||
{
|
||||
if (r.Name == name)
|
||||
{
|
||||
record = r;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (record == null)
|
||||
{
|
||||
record = new Record(name);
|
||||
m_Records.Add(record);
|
||||
}
|
||||
|
||||
record.Count++;
|
||||
record.Size += sampleSize;
|
||||
}
|
||||
|
||||
m_Records.Sort(m_RecordComparer);
|
||||
}
|
||||
|
||||
private static int RecordComparer(Record a, Record b)
|
||||
{
|
||||
int result = b.Size.CompareTo(a.Size);
|
||||
if (result != 0)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
result = a.Count.CompareTo(b.Count);
|
||||
if (result != 0)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
return a.Name.CompareTo(b.Name);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 45a9f76b48e192d44b0de0eac60975b2
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
//------------------------------------------------------------
|
||||
// Game Framework
|
||||
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
|
||||
// Homepage: https://gameframework.cn/
|
||||
// Feedback: mailto:ellan@gameframework.cn
|
||||
//------------------------------------------------------------
|
||||
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
namespace UnityGameFramework.Runtime
|
||||
{
|
||||
public sealed partial class DebuggerComponent : GameFrameworkComponent
|
||||
{
|
||||
private sealed class SceneInformationWindow : ScrollableDebuggerWindowBase
|
||||
{
|
||||
protected override void OnDrawScrollableWindow()
|
||||
{
|
||||
GUILayout.Label("<b>Scene Information</b>");
|
||||
GUILayout.BeginVertical("box");
|
||||
{
|
||||
DrawItem("Scene Count", SceneManager.sceneCount.ToString());
|
||||
DrawItem("Scene Count In Build Settings", SceneManager.sceneCountInBuildSettings.ToString());
|
||||
|
||||
Scene activeScene = SceneManager.GetActiveScene();
|
||||
#if UNITY_2018_3_OR_NEWER
|
||||
DrawItem("Active Scene Handle", activeScene.handle.ToString());
|
||||
#endif
|
||||
DrawItem("Active Scene Name", activeScene.name);
|
||||
DrawItem("Active Scene Path", activeScene.path);
|
||||
DrawItem("Active Scene Build Index", activeScene.buildIndex.ToString());
|
||||
DrawItem("Active Scene Is Dirty", activeScene.isDirty.ToString());
|
||||
DrawItem("Active Scene Is Loaded", activeScene.isLoaded.ToString());
|
||||
DrawItem("Active Scene Is Valid", activeScene.IsValid().ToString());
|
||||
DrawItem("Active Scene Root Count", activeScene.rootCount.ToString());
|
||||
#if UNITY_2019_1_OR_NEWER
|
||||
DrawItem("Active Scene Is Sub Scene", activeScene.isSubScene.ToString());
|
||||
#endif
|
||||
}
|
||||
GUILayout.EndVertical();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0c5471e8b14eef444a96f1e1cb4b6987
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+95
@@ -0,0 +1,95 @@
|
||||
//------------------------------------------------------------
|
||||
// Game Framework
|
||||
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
|
||||
// Homepage: https://gameframework.cn/
|
||||
// Feedback: mailto:ellan@gameframework.cn
|
||||
//------------------------------------------------------------
|
||||
|
||||
using GameFramework;
|
||||
using UnityEngine;
|
||||
|
||||
namespace UnityGameFramework.Runtime
|
||||
{
|
||||
public sealed partial class DebuggerComponent : GameFrameworkComponent
|
||||
{
|
||||
private sealed class ScreenInformationWindow : ScrollableDebuggerWindowBase
|
||||
{
|
||||
protected override void OnDrawScrollableWindow()
|
||||
{
|
||||
GUILayout.Label("<b>Screen Information</b>");
|
||||
GUILayout.BeginVertical("box");
|
||||
{
|
||||
DrawItem("Current Resolution", GetResolutionString(Screen.currentResolution));
|
||||
DrawItem("Screen Width", Utility.Text.Format("{0} px / {1:F2} in / {2:F2} cm", Screen.width, Utility.Converter.GetInchesFromPixels(Screen.width), Utility.Converter.GetCentimetersFromPixels(Screen.width)));
|
||||
DrawItem("Screen Height", Utility.Text.Format("{0} px / {1:F2} in / {2:F2} cm", Screen.height, Utility.Converter.GetInchesFromPixels(Screen.height), Utility.Converter.GetCentimetersFromPixels(Screen.height)));
|
||||
DrawItem("Screen DPI", Screen.dpi.ToString("F2"));
|
||||
DrawItem("Screen Orientation", Screen.orientation.ToString());
|
||||
DrawItem("Is Full Screen", Screen.fullScreen.ToString());
|
||||
#if UNITY_2018_1_OR_NEWER
|
||||
DrawItem("Full Screen Mode", Screen.fullScreenMode.ToString());
|
||||
#endif
|
||||
DrawItem("Sleep Timeout", GetSleepTimeoutDescription(Screen.sleepTimeout));
|
||||
#if UNITY_2019_2_OR_NEWER
|
||||
DrawItem("Brightness", Screen.brightness.ToString("F2"));
|
||||
#endif
|
||||
DrawItem("Cursor Visible", Cursor.visible.ToString());
|
||||
DrawItem("Cursor Lock State", Cursor.lockState.ToString());
|
||||
DrawItem("Auto Landscape Left", Screen.autorotateToLandscapeLeft.ToString());
|
||||
DrawItem("Auto Landscape Right", Screen.autorotateToLandscapeRight.ToString());
|
||||
DrawItem("Auto Portrait", Screen.autorotateToPortrait.ToString());
|
||||
DrawItem("Auto Portrait Upside Down", Screen.autorotateToPortraitUpsideDown.ToString());
|
||||
#if UNITY_2017_2_OR_NEWER && !UNITY_2017_2_0
|
||||
DrawItem("Safe Area", Screen.safeArea.ToString());
|
||||
#endif
|
||||
#if UNITY_2019_2_OR_NEWER
|
||||
DrawItem("Cutouts", GetCutoutsString(Screen.cutouts));
|
||||
#endif
|
||||
DrawItem("Support Resolutions", GetResolutionsString(Screen.resolutions));
|
||||
}
|
||||
GUILayout.EndVertical();
|
||||
}
|
||||
|
||||
private string GetSleepTimeoutDescription(int sleepTimeout)
|
||||
{
|
||||
if (sleepTimeout == SleepTimeout.NeverSleep)
|
||||
{
|
||||
return "Never Sleep";
|
||||
}
|
||||
|
||||
if (sleepTimeout == SleepTimeout.SystemSetting)
|
||||
{
|
||||
return "System Setting";
|
||||
}
|
||||
|
||||
return sleepTimeout.ToString();
|
||||
}
|
||||
|
||||
private string GetResolutionString(Resolution resolution)
|
||||
{
|
||||
return Utility.Text.Format("{0} x {1} @ {2}Hz", resolution.width, resolution.height, resolution.refreshRate);
|
||||
}
|
||||
|
||||
private string GetCutoutsString(Rect[] cutouts)
|
||||
{
|
||||
string[] cutoutStrings = new string[cutouts.Length];
|
||||
for (int i = 0; i < cutouts.Length; i++)
|
||||
{
|
||||
cutoutStrings[i] = cutouts[i].ToString();
|
||||
}
|
||||
|
||||
return string.Join("; ", cutoutStrings);
|
||||
}
|
||||
|
||||
private string GetResolutionsString(Resolution[] resolutions)
|
||||
{
|
||||
string[] resolutionStrings = new string[resolutions.Length];
|
||||
for (int i = 0; i < resolutions.Length; i++)
|
||||
{
|
||||
resolutionStrings[i] = GetResolutionString(resolutions[i]);
|
||||
}
|
||||
|
||||
return string.Join("; ", resolutionStrings);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: dc352756f31513048a46e56ad2900db7
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+101
@@ -0,0 +1,101 @@
|
||||
//------------------------------------------------------------
|
||||
// Game Framework
|
||||
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
|
||||
// Homepage: https://gameframework.cn/
|
||||
// Feedback: mailto:ellan@gameframework.cn
|
||||
//------------------------------------------------------------
|
||||
|
||||
using GameFramework;
|
||||
using GameFramework.Debugger;
|
||||
using UnityEngine;
|
||||
|
||||
namespace UnityGameFramework.Runtime
|
||||
{
|
||||
public sealed partial class DebuggerComponent : GameFrameworkComponent
|
||||
{
|
||||
private abstract class ScrollableDebuggerWindowBase : IDebuggerWindow
|
||||
{
|
||||
private const float TitleWidth = 240f;
|
||||
private Vector2 m_ScrollPosition = Vector2.zero;
|
||||
|
||||
public virtual void Initialize(params object[] args)
|
||||
{
|
||||
}
|
||||
|
||||
public virtual void Shutdown()
|
||||
{
|
||||
}
|
||||
|
||||
public virtual void OnEnter()
|
||||
{
|
||||
}
|
||||
|
||||
public virtual void OnLeave()
|
||||
{
|
||||
}
|
||||
|
||||
public virtual void OnUpdate(float elapseSeconds, float realElapseSeconds)
|
||||
{
|
||||
}
|
||||
|
||||
public void OnDraw()
|
||||
{
|
||||
m_ScrollPosition = GUILayout.BeginScrollView(m_ScrollPosition);
|
||||
{
|
||||
OnDrawScrollableWindow();
|
||||
}
|
||||
GUILayout.EndScrollView();
|
||||
}
|
||||
|
||||
protected abstract void OnDrawScrollableWindow();
|
||||
|
||||
protected static void DrawItem(string title, string content)
|
||||
{
|
||||
GUILayout.BeginHorizontal();
|
||||
{
|
||||
GUILayout.Label(title, GUILayout.Width(TitleWidth));
|
||||
if (GUILayout.Button(content, "label"))
|
||||
{
|
||||
CopyToClipboard(content);
|
||||
}
|
||||
}
|
||||
GUILayout.EndHorizontal();
|
||||
}
|
||||
|
||||
protected static string GetByteLengthString(long byteLength)
|
||||
{
|
||||
if (byteLength < 1024L) // 2 ^ 10
|
||||
{
|
||||
return Utility.Text.Format("{0} Bytes", byteLength);
|
||||
}
|
||||
|
||||
if (byteLength < 1048576L) // 2 ^ 20
|
||||
{
|
||||
return Utility.Text.Format("{0:F2} KB", byteLength / 1024f);
|
||||
}
|
||||
|
||||
if (byteLength < 1073741824L) // 2 ^ 30
|
||||
{
|
||||
return Utility.Text.Format("{0:F2} MB", byteLength / 1048576f);
|
||||
}
|
||||
|
||||
if (byteLength < 1099511627776L) // 2 ^ 40
|
||||
{
|
||||
return Utility.Text.Format("{0:F2} GB", byteLength / 1073741824f);
|
||||
}
|
||||
|
||||
if (byteLength < 1125899906842624L) // 2 ^ 50
|
||||
{
|
||||
return Utility.Text.Format("{0:F2} TB", byteLength / 1099511627776f);
|
||||
}
|
||||
|
||||
if (byteLength < 1152921504606846976L) // 2 ^ 60
|
||||
{
|
||||
return Utility.Text.Format("{0:F2} PB", byteLength / 1125899906842624f);
|
||||
}
|
||||
|
||||
return Utility.Text.Format("{0:F2} EB", byteLength / 1152921504606846976f);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1af7b258c93df0341a163adfdd378f8a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,219 @@
|
||||
//------------------------------------------------------------
|
||||
// Game Framework
|
||||
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
|
||||
// Homepage: https://gameframework.cn/
|
||||
// Feedback: mailto:ellan@gameframework.cn
|
||||
//------------------------------------------------------------
|
||||
|
||||
using UnityEngine;
|
||||
|
||||
namespace UnityGameFramework.Runtime
|
||||
{
|
||||
public sealed partial class DebuggerComponent : GameFrameworkComponent
|
||||
{
|
||||
private sealed class SettingsWindow : ScrollableDebuggerWindowBase
|
||||
{
|
||||
private DebuggerComponent m_DebuggerComponent = null;
|
||||
private SettingComponent m_SettingComponent = null;
|
||||
private float m_LastIconX = 0f;
|
||||
private float m_LastIconY = 0f;
|
||||
private float m_LastWindowX = 0f;
|
||||
private float m_LastWindowY = 0f;
|
||||
private float m_LastWindowWidth = 0f;
|
||||
private float m_LastWindowHeight = 0f;
|
||||
private float m_LastWindowScale = 0f;
|
||||
|
||||
public override void Initialize(params object[] args)
|
||||
{
|
||||
m_DebuggerComponent = GameEntry.GetComponent<DebuggerComponent>();
|
||||
if (m_DebuggerComponent == null)
|
||||
{
|
||||
Log.Fatal("Debugger component is invalid.");
|
||||
return;
|
||||
}
|
||||
|
||||
m_SettingComponent = GameEntry.GetComponent<SettingComponent>();
|
||||
if (m_SettingComponent == null)
|
||||
{
|
||||
Log.Fatal("Setting component is invalid.");
|
||||
return;
|
||||
}
|
||||
|
||||
m_LastIconX = m_SettingComponent.GetFloat("Debugger.Icon.X", DefaultIconRect.x);
|
||||
m_LastIconY = m_SettingComponent.GetFloat("Debugger.Icon.Y", DefaultIconRect.y);
|
||||
m_LastWindowX = m_SettingComponent.GetFloat("Debugger.Window.X", DefaultWindowRect.x);
|
||||
m_LastWindowY = m_SettingComponent.GetFloat("Debugger.Window.Y", DefaultWindowRect.y);
|
||||
m_LastWindowWidth = m_SettingComponent.GetFloat("Debugger.Window.Width", DefaultWindowRect.width);
|
||||
m_LastWindowHeight = m_SettingComponent.GetFloat("Debugger.Window.Height", DefaultWindowRect.height);
|
||||
m_DebuggerComponent.WindowScale = m_LastWindowScale = m_SettingComponent.GetFloat("Debugger.Window.Scale", DefaultWindowScale);
|
||||
m_DebuggerComponent.IconRect = new Rect(m_LastIconX, m_LastIconY, DefaultIconRect.width, DefaultIconRect.height);
|
||||
m_DebuggerComponent.WindowRect = new Rect(m_LastWindowX, m_LastWindowY, m_LastWindowWidth, m_LastWindowHeight);
|
||||
}
|
||||
|
||||
public override void OnUpdate(float elapseSeconds, float realElapseSeconds)
|
||||
{
|
||||
if (m_LastIconX != m_DebuggerComponent.IconRect.x)
|
||||
{
|
||||
m_LastIconX = m_DebuggerComponent.IconRect.x;
|
||||
m_SettingComponent.SetFloat("Debugger.Icon.X", m_DebuggerComponent.IconRect.x);
|
||||
}
|
||||
|
||||
if (m_LastIconY != m_DebuggerComponent.IconRect.y)
|
||||
{
|
||||
m_LastIconY = m_DebuggerComponent.IconRect.y;
|
||||
m_SettingComponent.SetFloat("Debugger.Icon.Y", m_DebuggerComponent.IconRect.y);
|
||||
}
|
||||
|
||||
if (m_LastWindowX != m_DebuggerComponent.WindowRect.x)
|
||||
{
|
||||
m_LastWindowX = m_DebuggerComponent.WindowRect.x;
|
||||
m_SettingComponent.SetFloat("Debugger.Window.X", m_DebuggerComponent.WindowRect.x);
|
||||
}
|
||||
|
||||
if (m_LastWindowY != m_DebuggerComponent.WindowRect.y)
|
||||
{
|
||||
m_LastWindowY = m_DebuggerComponent.WindowRect.y;
|
||||
m_SettingComponent.SetFloat("Debugger.Window.Y", m_DebuggerComponent.WindowRect.y);
|
||||
}
|
||||
|
||||
if (m_LastWindowWidth != m_DebuggerComponent.WindowRect.width)
|
||||
{
|
||||
m_LastWindowWidth = m_DebuggerComponent.WindowRect.width;
|
||||
m_SettingComponent.SetFloat("Debugger.Window.Width", m_DebuggerComponent.WindowRect.width);
|
||||
}
|
||||
|
||||
if (m_LastWindowHeight != m_DebuggerComponent.WindowRect.height)
|
||||
{
|
||||
m_LastWindowHeight = m_DebuggerComponent.WindowRect.height;
|
||||
m_SettingComponent.SetFloat("Debugger.Window.Height", m_DebuggerComponent.WindowRect.height);
|
||||
}
|
||||
|
||||
if (m_LastWindowScale != m_DebuggerComponent.WindowScale)
|
||||
{
|
||||
m_LastWindowScale = m_DebuggerComponent.WindowScale;
|
||||
m_SettingComponent.SetFloat("Debugger.Window.Scale", m_DebuggerComponent.WindowScale);
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnDrawScrollableWindow()
|
||||
{
|
||||
GUILayout.Label("<b>Window Settings</b>");
|
||||
GUILayout.BeginVertical("box");
|
||||
{
|
||||
GUILayout.BeginHorizontal();
|
||||
{
|
||||
GUILayout.Label("Position:", GUILayout.Width(60f));
|
||||
GUILayout.Label("Drag window caption to move position.");
|
||||
}
|
||||
GUILayout.EndHorizontal();
|
||||
|
||||
GUILayout.BeginHorizontal();
|
||||
{
|
||||
float width = m_DebuggerComponent.WindowRect.width;
|
||||
GUILayout.Label("Width:", GUILayout.Width(60f));
|
||||
if (GUILayout.RepeatButton("-", GUILayout.Width(30f)))
|
||||
{
|
||||
width--;
|
||||
}
|
||||
width = GUILayout.HorizontalSlider(width, 100f, Screen.width - 20f);
|
||||
if (GUILayout.RepeatButton("+", GUILayout.Width(30f)))
|
||||
{
|
||||
width++;
|
||||
}
|
||||
width = Mathf.Clamp(width, 100f, Screen.width - 20f);
|
||||
if (width != m_DebuggerComponent.WindowRect.width)
|
||||
{
|
||||
m_DebuggerComponent.WindowRect = new Rect(m_DebuggerComponent.WindowRect.x, m_DebuggerComponent.WindowRect.y, width, m_DebuggerComponent.WindowRect.height);
|
||||
}
|
||||
}
|
||||
GUILayout.EndHorizontal();
|
||||
|
||||
GUILayout.BeginHorizontal();
|
||||
{
|
||||
float height = m_DebuggerComponent.WindowRect.height;
|
||||
GUILayout.Label("Height:", GUILayout.Width(60f));
|
||||
if (GUILayout.RepeatButton("-", GUILayout.Width(30f)))
|
||||
{
|
||||
height--;
|
||||
}
|
||||
height = GUILayout.HorizontalSlider(height, 100f, Screen.height - 20f);
|
||||
if (GUILayout.RepeatButton("+", GUILayout.Width(30f)))
|
||||
{
|
||||
height++;
|
||||
}
|
||||
height = Mathf.Clamp(height, 100f, Screen.height - 20f);
|
||||
if (height != m_DebuggerComponent.WindowRect.height)
|
||||
{
|
||||
m_DebuggerComponent.WindowRect = new Rect(m_DebuggerComponent.WindowRect.x, m_DebuggerComponent.WindowRect.y, m_DebuggerComponent.WindowRect.width, height);
|
||||
}
|
||||
}
|
||||
GUILayout.EndHorizontal();
|
||||
|
||||
GUILayout.BeginHorizontal();
|
||||
{
|
||||
float scale = m_DebuggerComponent.WindowScale;
|
||||
GUILayout.Label("Scale:", GUILayout.Width(60f));
|
||||
if (GUILayout.RepeatButton("-", GUILayout.Width(30f)))
|
||||
{
|
||||
scale -= 0.01f;
|
||||
}
|
||||
scale = GUILayout.HorizontalSlider(scale, 0.5f, 4f);
|
||||
if (GUILayout.RepeatButton("+", GUILayout.Width(30f)))
|
||||
{
|
||||
scale += 0.01f;
|
||||
}
|
||||
scale = Mathf.Clamp(scale, 0.5f, 4f);
|
||||
if (scale != m_DebuggerComponent.WindowScale)
|
||||
{
|
||||
m_DebuggerComponent.WindowScale = scale;
|
||||
}
|
||||
}
|
||||
GUILayout.EndHorizontal();
|
||||
|
||||
GUILayout.BeginHorizontal();
|
||||
{
|
||||
if (GUILayout.Button("0.5x", GUILayout.Height(60f)))
|
||||
{
|
||||
m_DebuggerComponent.WindowScale = 0.5f;
|
||||
}
|
||||
if (GUILayout.Button("1.0x", GUILayout.Height(60f)))
|
||||
{
|
||||
m_DebuggerComponent.WindowScale = 1f;
|
||||
}
|
||||
if (GUILayout.Button("1.5x", GUILayout.Height(60f)))
|
||||
{
|
||||
m_DebuggerComponent.WindowScale = 1.5f;
|
||||
}
|
||||
if (GUILayout.Button("2.0x", GUILayout.Height(60f)))
|
||||
{
|
||||
m_DebuggerComponent.WindowScale = 2f;
|
||||
}
|
||||
if (GUILayout.Button("2.5x", GUILayout.Height(60f)))
|
||||
{
|
||||
m_DebuggerComponent.WindowScale = 2.5f;
|
||||
}
|
||||
if (GUILayout.Button("3.0x", GUILayout.Height(60f)))
|
||||
{
|
||||
m_DebuggerComponent.WindowScale = 3f;
|
||||
}
|
||||
if (GUILayout.Button("3.5x", GUILayout.Height(60f)))
|
||||
{
|
||||
m_DebuggerComponent.WindowScale = 3.5f;
|
||||
}
|
||||
if (GUILayout.Button("4.0x", GUILayout.Height(60f)))
|
||||
{
|
||||
m_DebuggerComponent.WindowScale = 4f;
|
||||
}
|
||||
}
|
||||
GUILayout.EndHorizontal();
|
||||
|
||||
if (GUILayout.Button("Reset Layout", GUILayout.Height(30f)))
|
||||
{
|
||||
m_DebuggerComponent.ResetLayout();
|
||||
}
|
||||
}
|
||||
GUILayout.EndVertical();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b4a36d102b4e1a648810a983c2101967
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+62
@@ -0,0 +1,62 @@
|
||||
//------------------------------------------------------------
|
||||
// Game Framework
|
||||
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
|
||||
// Homepage: https://gameframework.cn/
|
||||
// Feedback: mailto:ellan@gameframework.cn
|
||||
//------------------------------------------------------------
|
||||
|
||||
using GameFramework;
|
||||
using UnityEngine;
|
||||
|
||||
namespace UnityGameFramework.Runtime
|
||||
{
|
||||
public sealed partial class DebuggerComponent : GameFrameworkComponent
|
||||
{
|
||||
private sealed class SystemInformationWindow : ScrollableDebuggerWindowBase
|
||||
{
|
||||
protected override void OnDrawScrollableWindow()
|
||||
{
|
||||
GUILayout.Label("<b>System Information</b>");
|
||||
GUILayout.BeginVertical("box");
|
||||
{
|
||||
DrawItem("Device Unique ID", SystemInfo.deviceUniqueIdentifier);
|
||||
DrawItem("Device Name", SystemInfo.deviceName);
|
||||
DrawItem("Device Type", SystemInfo.deviceType.ToString());
|
||||
DrawItem("Device Model", SystemInfo.deviceModel);
|
||||
DrawItem("Processor Type", SystemInfo.processorType);
|
||||
DrawItem("Processor Count", SystemInfo.processorCount.ToString());
|
||||
DrawItem("Processor Frequency", Utility.Text.Format("{0} MHz", SystemInfo.processorFrequency));
|
||||
DrawItem("System Memory Size", Utility.Text.Format("{0} MB", SystemInfo.systemMemorySize));
|
||||
#if UNITY_5_5_OR_NEWER
|
||||
DrawItem("Operating System Family", SystemInfo.operatingSystemFamily.ToString());
|
||||
#endif
|
||||
DrawItem("Operating System", SystemInfo.operatingSystem);
|
||||
#if UNITY_5_6_OR_NEWER
|
||||
DrawItem("Battery Status", SystemInfo.batteryStatus.ToString());
|
||||
DrawItem("Battery Level", GetBatteryLevelString(SystemInfo.batteryLevel));
|
||||
#endif
|
||||
#if UNITY_5_4_OR_NEWER
|
||||
DrawItem("Supports Audio", SystemInfo.supportsAudio.ToString());
|
||||
#endif
|
||||
DrawItem("Supports Location Service", SystemInfo.supportsLocationService.ToString());
|
||||
DrawItem("Supports Accelerometer", SystemInfo.supportsAccelerometer.ToString());
|
||||
DrawItem("Supports Gyroscope", SystemInfo.supportsGyroscope.ToString());
|
||||
DrawItem("Supports Vibration", SystemInfo.supportsVibration.ToString());
|
||||
DrawItem("Genuine", Application.genuine.ToString());
|
||||
DrawItem("Genuine Check Available", Application.genuineCheckAvailable.ToString());
|
||||
}
|
||||
GUILayout.EndVertical();
|
||||
}
|
||||
|
||||
private string GetBatteryLevelString(float batteryLevel)
|
||||
{
|
||||
if (batteryLevel < 0f)
|
||||
{
|
||||
return "Unavailable";
|
||||
}
|
||||
|
||||
return batteryLevel.ToString("P0");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 788d38477d0fde741b8939db86e6a083
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+76
@@ -0,0 +1,76 @@
|
||||
//------------------------------------------------------------
|
||||
// Game Framework
|
||||
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
|
||||
// Homepage: https://gameframework.cn/
|
||||
// Feedback: mailto:ellan@gameframework.cn
|
||||
//------------------------------------------------------------
|
||||
|
||||
using GameFramework;
|
||||
using UnityEngine;
|
||||
|
||||
namespace UnityGameFramework.Runtime
|
||||
{
|
||||
public sealed partial class DebuggerComponent : GameFrameworkComponent
|
||||
{
|
||||
private sealed class TimeInformationWindow : ScrollableDebuggerWindowBase
|
||||
{
|
||||
protected override void OnDrawScrollableWindow()
|
||||
{
|
||||
GUILayout.Label("<b>Time Information</b>");
|
||||
GUILayout.BeginVertical("box");
|
||||
{
|
||||
DrawItem("Time Scale", Utility.Text.Format("{0} [{1}]", Time.timeScale, GetTimeScaleDescription(Time.timeScale)));
|
||||
DrawItem("Realtime Since Startup", Time.realtimeSinceStartup.ToString());
|
||||
DrawItem("Time Since Level Load", Time.timeSinceLevelLoad.ToString());
|
||||
DrawItem("Time", Time.time.ToString());
|
||||
DrawItem("Fixed Time", Time.fixedTime.ToString());
|
||||
DrawItem("Unscaled Time", Time.unscaledTime.ToString());
|
||||
#if UNITY_5_6_OR_NEWER
|
||||
DrawItem("Fixed Unscaled Time", Time.fixedUnscaledTime.ToString());
|
||||
#endif
|
||||
DrawItem("Delta Time", Time.deltaTime.ToString());
|
||||
DrawItem("Fixed Delta Time", Time.fixedDeltaTime.ToString());
|
||||
DrawItem("Unscaled Delta Time", Time.unscaledDeltaTime.ToString());
|
||||
#if UNITY_5_6_OR_NEWER
|
||||
DrawItem("Fixed Unscaled Delta Time", Time.fixedUnscaledDeltaTime.ToString());
|
||||
#endif
|
||||
DrawItem("Smooth Delta Time", Time.smoothDeltaTime.ToString());
|
||||
DrawItem("Maximum Delta Time", Time.maximumDeltaTime.ToString());
|
||||
#if UNITY_5_5_OR_NEWER
|
||||
DrawItem("Maximum Particle Delta Time", Time.maximumParticleDeltaTime.ToString());
|
||||
#endif
|
||||
DrawItem("Frame Count", Time.frameCount.ToString());
|
||||
DrawItem("Rendered Frame Count", Time.renderedFrameCount.ToString());
|
||||
DrawItem("Capture Framerate", Time.captureFramerate.ToString());
|
||||
#if UNITY_2019_2_OR_NEWER
|
||||
DrawItem("Capture Delta Time", Time.captureDeltaTime.ToString());
|
||||
#endif
|
||||
#if UNITY_5_6_OR_NEWER
|
||||
DrawItem("In Fixed Time Step", Time.inFixedTimeStep.ToString());
|
||||
#endif
|
||||
}
|
||||
GUILayout.EndVertical();
|
||||
}
|
||||
|
||||
private string GetTimeScaleDescription(float timeScale)
|
||||
{
|
||||
if (timeScale <= 0f)
|
||||
{
|
||||
return "Pause";
|
||||
}
|
||||
|
||||
if (timeScale < 1f)
|
||||
{
|
||||
return "Slower";
|
||||
}
|
||||
|
||||
if (timeScale > 1f)
|
||||
{
|
||||
return "Faster";
|
||||
}
|
||||
|
||||
return "Normal";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e8bdf40da7ffdc94ab9e39ba8daeaa3a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
//------------------------------------------------------------
|
||||
// Game Framework
|
||||
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
|
||||
// Homepage: https://gameframework.cn/
|
||||
// Feedback: mailto:ellan@gameframework.cn
|
||||
//------------------------------------------------------------
|
||||
|
||||
using UnityEngine;
|
||||
|
||||
namespace UnityGameFramework.Runtime
|
||||
{
|
||||
public sealed partial class DebuggerComponent : GameFrameworkComponent
|
||||
{
|
||||
private sealed class WebPlayerInformationWindow : ScrollableDebuggerWindowBase
|
||||
{
|
||||
protected override void OnDrawScrollableWindow()
|
||||
{
|
||||
GUILayout.Label("<b>Web Player Information</b>");
|
||||
GUILayout.BeginVertical("box");
|
||||
{
|
||||
#if !UNITY_2017_2_OR_NEWER
|
||||
DrawItem("Is Web Player", Application.isWebPlayer.ToString());
|
||||
#endif
|
||||
DrawItem("Absolute URL", Application.absoluteURL);
|
||||
#if !UNITY_2017_2_OR_NEWER
|
||||
DrawItem("Source Value", Application.srcValue);
|
||||
#endif
|
||||
#if !UNITY_2018_2_OR_NEWER
|
||||
DrawItem("Streamed Bytes", Application.streamedBytes.ToString());
|
||||
#endif
|
||||
#if UNITY_5_3 || UNITY_5_4
|
||||
DrawItem("Web Security Enabled", Application.webSecurityEnabled.ToString());
|
||||
DrawItem("Web Security Host URL", Application.webSecurityHostUrl.ToString());
|
||||
#endif
|
||||
}
|
||||
GUILayout.EndVertical();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: eea52d2ddd7a8804f956d4b9a2d67e8f
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,432 @@
|
||||
//------------------------------------------------------------
|
||||
// Game Framework
|
||||
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
|
||||
// Homepage: https://gameframework.cn/
|
||||
// Feedback: mailto:ellan@gameframework.cn
|
||||
//------------------------------------------------------------
|
||||
|
||||
using GameFramework;
|
||||
using GameFramework.Debugger;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace UnityGameFramework.Runtime
|
||||
{
|
||||
/// <summary>
|
||||
/// 调试器组件。
|
||||
/// </summary>
|
||||
[DisallowMultipleComponent]
|
||||
[AddComponentMenu("Game Framework/Debugger")]
|
||||
public sealed partial class DebuggerComponent : GameFrameworkComponent
|
||||
{
|
||||
/// <summary>
|
||||
/// 默认调试器漂浮框大小。
|
||||
/// </summary>
|
||||
internal static readonly Rect DefaultIconRect = new Rect(10f, 10f, 60f, 60f);
|
||||
|
||||
/// <summary>
|
||||
/// 默认调试器窗口大小。
|
||||
/// </summary>
|
||||
internal static readonly Rect DefaultWindowRect = new Rect(10f, 10f, 640f, 480f);
|
||||
|
||||
/// <summary>
|
||||
/// 默认调试器窗口缩放比例。
|
||||
/// </summary>
|
||||
internal static readonly float DefaultWindowScale = 1f;
|
||||
|
||||
private static readonly TextEditor s_TextEditor = new TextEditor();
|
||||
private IDebuggerManager m_DebuggerManager = null;
|
||||
private Rect m_DragRect = new Rect(0f, 0f, float.MaxValue, 25f);
|
||||
private Rect m_IconRect = DefaultIconRect;
|
||||
private Rect m_WindowRect = DefaultWindowRect;
|
||||
private float m_WindowScale = DefaultWindowScale;
|
||||
|
||||
[SerializeField]
|
||||
private GUISkin m_Skin = null;
|
||||
|
||||
[SerializeField]
|
||||
private DebuggerActiveWindowType m_ActiveWindow = DebuggerActiveWindowType.AlwaysOpen;
|
||||
|
||||
[SerializeField]
|
||||
private bool m_ShowFullWindow = false;
|
||||
|
||||
[SerializeField]
|
||||
private ConsoleWindow m_ConsoleWindow = new ConsoleWindow();
|
||||
|
||||
private SystemInformationWindow m_SystemInformationWindow = new SystemInformationWindow();
|
||||
private EnvironmentInformationWindow m_EnvironmentInformationWindow = new EnvironmentInformationWindow();
|
||||
private ScreenInformationWindow m_ScreenInformationWindow = new ScreenInformationWindow();
|
||||
private GraphicsInformationWindow m_GraphicsInformationWindow = new GraphicsInformationWindow();
|
||||
private InputSummaryInformationWindow m_InputSummaryInformationWindow = new InputSummaryInformationWindow();
|
||||
private InputTouchInformationWindow m_InputTouchInformationWindow = new InputTouchInformationWindow();
|
||||
private InputLocationInformationWindow m_InputLocationInformationWindow = new InputLocationInformationWindow();
|
||||
private InputAccelerationInformationWindow m_InputAccelerationInformationWindow = new InputAccelerationInformationWindow();
|
||||
private InputGyroscopeInformationWindow m_InputGyroscopeInformationWindow = new InputGyroscopeInformationWindow();
|
||||
private InputCompassInformationWindow m_InputCompassInformationWindow = new InputCompassInformationWindow();
|
||||
private PathInformationWindow m_PathInformationWindow = new PathInformationWindow();
|
||||
private SceneInformationWindow m_SceneInformationWindow = new SceneInformationWindow();
|
||||
private TimeInformationWindow m_TimeInformationWindow = new TimeInformationWindow();
|
||||
private QualityInformationWindow m_QualityInformationWindow = new QualityInformationWindow();
|
||||
private ProfilerInformationWindow m_ProfilerInformationWindow = new ProfilerInformationWindow();
|
||||
private WebPlayerInformationWindow m_WebPlayerInformationWindow = new WebPlayerInformationWindow();
|
||||
private RuntimeMemorySummaryWindow m_RuntimeMemorySummaryWindow = new RuntimeMemorySummaryWindow();
|
||||
private RuntimeMemoryInformationWindow<Object> m_RuntimeMemoryAllInformationWindow = new RuntimeMemoryInformationWindow<Object>();
|
||||
private RuntimeMemoryInformationWindow<Texture> m_RuntimeMemoryTextureInformationWindow = new RuntimeMemoryInformationWindow<Texture>();
|
||||
private RuntimeMemoryInformationWindow<Mesh> m_RuntimeMemoryMeshInformationWindow = new RuntimeMemoryInformationWindow<Mesh>();
|
||||
private RuntimeMemoryInformationWindow<Material> m_RuntimeMemoryMaterialInformationWindow = new RuntimeMemoryInformationWindow<Material>();
|
||||
private RuntimeMemoryInformationWindow<Shader> m_RuntimeMemoryShaderInformationWindow = new RuntimeMemoryInformationWindow<Shader>();
|
||||
private RuntimeMemoryInformationWindow<AnimationClip> m_RuntimeMemoryAnimationClipInformationWindow = new RuntimeMemoryInformationWindow<AnimationClip>();
|
||||
private RuntimeMemoryInformationWindow<AudioClip> m_RuntimeMemoryAudioClipInformationWindow = new RuntimeMemoryInformationWindow<AudioClip>();
|
||||
private RuntimeMemoryInformationWindow<Font> m_RuntimeMemoryFontInformationWindow = new RuntimeMemoryInformationWindow<Font>();
|
||||
private RuntimeMemoryInformationWindow<TextAsset> m_RuntimeMemoryTextAssetInformationWindow = new RuntimeMemoryInformationWindow<TextAsset>();
|
||||
private RuntimeMemoryInformationWindow<ScriptableObject> m_RuntimeMemoryScriptableObjectInformationWindow = new RuntimeMemoryInformationWindow<ScriptableObject>();
|
||||
private ObjectPoolInformationWindow m_ObjectPoolInformationWindow = new ObjectPoolInformationWindow();
|
||||
private ReferencePoolInformationWindow m_ReferencePoolInformationWindow = new ReferencePoolInformationWindow();
|
||||
private NetworkInformationWindow m_NetworkInformationWindow = new NetworkInformationWindow();
|
||||
private SettingsWindow m_SettingsWindow = new SettingsWindow();
|
||||
private OperationsWindow m_OperationsWindow = new OperationsWindow();
|
||||
|
||||
private FpsCounter m_FpsCounter = null;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置调试器窗口是否激活。
|
||||
/// </summary>
|
||||
public bool ActiveWindow
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_DebuggerManager.ActiveWindow;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_DebuggerManager.ActiveWindow = value;
|
||||
enabled = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置是否显示完整调试器界面。
|
||||
/// </summary>
|
||||
public bool ShowFullWindow
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_ShowFullWindow;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_ShowFullWindow = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置调试器漂浮框大小。
|
||||
/// </summary>
|
||||
public Rect IconRect
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_IconRect;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_IconRect = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置调试器窗口大小。
|
||||
/// </summary>
|
||||
public Rect WindowRect
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_WindowRect;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_WindowRect = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置调试器窗口缩放比例。
|
||||
/// </summary>
|
||||
public float WindowScale
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_WindowScale;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_WindowScale = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 游戏框架组件初始化。
|
||||
/// </summary>
|
||||
protected override void Awake()
|
||||
{
|
||||
base.Awake();
|
||||
|
||||
m_DebuggerManager = GameFrameworkEntry.GetModule<IDebuggerManager>();
|
||||
if (m_DebuggerManager == null)
|
||||
{
|
||||
Log.Fatal("Debugger manager is invalid.");
|
||||
return;
|
||||
}
|
||||
|
||||
m_FpsCounter = new FpsCounter(0.5f);
|
||||
}
|
||||
|
||||
private void Start()
|
||||
{
|
||||
RegisterDebuggerWindow("Console", m_ConsoleWindow);
|
||||
RegisterDebuggerWindow("Information/System", m_SystemInformationWindow);
|
||||
RegisterDebuggerWindow("Information/Environment", m_EnvironmentInformationWindow);
|
||||
RegisterDebuggerWindow("Information/Screen", m_ScreenInformationWindow);
|
||||
RegisterDebuggerWindow("Information/Graphics", m_GraphicsInformationWindow);
|
||||
RegisterDebuggerWindow("Information/Input/Summary", m_InputSummaryInformationWindow);
|
||||
RegisterDebuggerWindow("Information/Input/Touch", m_InputTouchInformationWindow);
|
||||
RegisterDebuggerWindow("Information/Input/Location", m_InputLocationInformationWindow);
|
||||
RegisterDebuggerWindow("Information/Input/Acceleration", m_InputAccelerationInformationWindow);
|
||||
RegisterDebuggerWindow("Information/Input/Gyroscope", m_InputGyroscopeInformationWindow);
|
||||
RegisterDebuggerWindow("Information/Input/Compass", m_InputCompassInformationWindow);
|
||||
RegisterDebuggerWindow("Information/Other/Scene", m_SceneInformationWindow);
|
||||
RegisterDebuggerWindow("Information/Other/Path", m_PathInformationWindow);
|
||||
RegisterDebuggerWindow("Information/Other/Time", m_TimeInformationWindow);
|
||||
RegisterDebuggerWindow("Information/Other/Quality", m_QualityInformationWindow);
|
||||
RegisterDebuggerWindow("Information/Other/Web Player", m_WebPlayerInformationWindow);
|
||||
RegisterDebuggerWindow("Profiler/Summary", m_ProfilerInformationWindow);
|
||||
RegisterDebuggerWindow("Profiler/Memory/Summary", m_RuntimeMemorySummaryWindow);
|
||||
RegisterDebuggerWindow("Profiler/Memory/All", m_RuntimeMemoryAllInformationWindow);
|
||||
RegisterDebuggerWindow("Profiler/Memory/Texture", m_RuntimeMemoryTextureInformationWindow);
|
||||
RegisterDebuggerWindow("Profiler/Memory/Mesh", m_RuntimeMemoryMeshInformationWindow);
|
||||
RegisterDebuggerWindow("Profiler/Memory/Material", m_RuntimeMemoryMaterialInformationWindow);
|
||||
RegisterDebuggerWindow("Profiler/Memory/Shader", m_RuntimeMemoryShaderInformationWindow);
|
||||
RegisterDebuggerWindow("Profiler/Memory/AnimationClip", m_RuntimeMemoryAnimationClipInformationWindow);
|
||||
RegisterDebuggerWindow("Profiler/Memory/AudioClip", m_RuntimeMemoryAudioClipInformationWindow);
|
||||
RegisterDebuggerWindow("Profiler/Memory/Font", m_RuntimeMemoryFontInformationWindow);
|
||||
RegisterDebuggerWindow("Profiler/Memory/TextAsset", m_RuntimeMemoryTextAssetInformationWindow);
|
||||
RegisterDebuggerWindow("Profiler/Memory/ScriptableObject", m_RuntimeMemoryScriptableObjectInformationWindow);
|
||||
RegisterDebuggerWindow("Profiler/Object Pool", m_ObjectPoolInformationWindow);
|
||||
RegisterDebuggerWindow("Profiler/Reference Pool", m_ReferencePoolInformationWindow);
|
||||
RegisterDebuggerWindow("Profiler/Network", m_NetworkInformationWindow);
|
||||
RegisterDebuggerWindow("Other/Settings", m_SettingsWindow);
|
||||
RegisterDebuggerWindow("Other/Operations", m_OperationsWindow);
|
||||
|
||||
switch (m_ActiveWindow)
|
||||
{
|
||||
case DebuggerActiveWindowType.AlwaysOpen:
|
||||
ActiveWindow = true;
|
||||
break;
|
||||
|
||||
case DebuggerActiveWindowType.OnlyOpenWhenDevelopment:
|
||||
ActiveWindow = Debug.isDebugBuild;
|
||||
break;
|
||||
|
||||
case DebuggerActiveWindowType.OnlyOpenInEditor:
|
||||
ActiveWindow = Application.isEditor;
|
||||
break;
|
||||
|
||||
default:
|
||||
ActiveWindow = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
m_FpsCounter.Update(Time.deltaTime, Time.unscaledDeltaTime);
|
||||
}
|
||||
|
||||
private void OnGUI()
|
||||
{
|
||||
if (m_DebuggerManager == null || !m_DebuggerManager.ActiveWindow)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
GUISkin cachedGuiSkin = GUI.skin;
|
||||
Matrix4x4 cachedMatrix = GUI.matrix;
|
||||
|
||||
GUI.skin = m_Skin;
|
||||
GUI.matrix = Matrix4x4.Scale(new Vector3(m_WindowScale, m_WindowScale, 1f));
|
||||
|
||||
if (m_ShowFullWindow)
|
||||
{
|
||||
m_WindowRect = GUILayout.Window(0, m_WindowRect, DrawWindow, "<b>GAME FRAMEWORK DEBUGGER</b>");
|
||||
}
|
||||
else
|
||||
{
|
||||
m_IconRect = GUILayout.Window(0, m_IconRect, DrawDebuggerWindowIcon, "<b>DEBUGGER</b>");
|
||||
}
|
||||
|
||||
GUI.matrix = cachedMatrix;
|
||||
GUI.skin = cachedGuiSkin;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 注册调试器窗口。
|
||||
/// </summary>
|
||||
/// <param name="path">调试器窗口路径。</param>
|
||||
/// <param name="debuggerWindow">要注册的调试器窗口。</param>
|
||||
/// <param name="args">初始化调试器窗口参数。</param>
|
||||
public void RegisterDebuggerWindow(string path, IDebuggerWindow debuggerWindow, params object[] args)
|
||||
{
|
||||
m_DebuggerManager.RegisterDebuggerWindow(path, debuggerWindow, args);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 解除注册调试器窗口。
|
||||
/// </summary>
|
||||
/// <param name="path">调试器窗口路径。</param>
|
||||
/// <returns>是否解除注册调试器窗口成功。</returns>
|
||||
public bool UnregisterDebuggerWindow(string path)
|
||||
{
|
||||
return m_DebuggerManager.UnregisterDebuggerWindow(path);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取调试器窗口。
|
||||
/// </summary>
|
||||
/// <param name="path">调试器窗口路径。</param>
|
||||
/// <returns>要获取的调试器窗口。</returns>
|
||||
public IDebuggerWindow GetDebuggerWindow(string path)
|
||||
{
|
||||
return m_DebuggerManager.GetDebuggerWindow(path);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 选中调试器窗口。
|
||||
/// </summary>
|
||||
/// <param name="path">调试器窗口路径。</param>
|
||||
/// <returns>是否成功选中调试器窗口。</returns>
|
||||
public bool SelectDebuggerWindow(string path)
|
||||
{
|
||||
return m_DebuggerManager.SelectDebuggerWindow(path);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 还原调试器窗口布局。
|
||||
/// </summary>
|
||||
public void ResetLayout()
|
||||
{
|
||||
IconRect = DefaultIconRect;
|
||||
WindowRect = DefaultWindowRect;
|
||||
WindowScale = DefaultWindowScale;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取记录的所有日志。
|
||||
/// </summary>
|
||||
/// <param name="results">要获取的日志。</param>
|
||||
public void GetRecentLogs(List<LogNode> results)
|
||||
{
|
||||
m_ConsoleWindow.GetRecentLogs(results);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取记录的最近日志。
|
||||
/// </summary>
|
||||
/// <param name="results">要获取的日志。</param>
|
||||
/// <param name="count">要获取最近日志的数量。</param>
|
||||
public void GetRecentLogs(List<LogNode> results, int count)
|
||||
{
|
||||
m_ConsoleWindow.GetRecentLogs(results, count);
|
||||
}
|
||||
|
||||
private void DrawWindow(int windowId)
|
||||
{
|
||||
GUI.DragWindow(m_DragRect);
|
||||
DrawDebuggerWindowGroup(m_DebuggerManager.DebuggerWindowRoot);
|
||||
}
|
||||
|
||||
private void DrawDebuggerWindowGroup(IDebuggerWindowGroup debuggerWindowGroup)
|
||||
{
|
||||
if (debuggerWindowGroup == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
List<string> names = new List<string>();
|
||||
string[] debuggerWindowNames = debuggerWindowGroup.GetDebuggerWindowNames();
|
||||
for (int i = 0; i < debuggerWindowNames.Length; i++)
|
||||
{
|
||||
names.Add(Utility.Text.Format("<b>{0}</b>", debuggerWindowNames[i]));
|
||||
}
|
||||
|
||||
if (debuggerWindowGroup == m_DebuggerManager.DebuggerWindowRoot)
|
||||
{
|
||||
names.Add("<b>Close</b>");
|
||||
}
|
||||
|
||||
int toolbarIndex = GUILayout.Toolbar(debuggerWindowGroup.SelectedIndex, names.ToArray(), GUILayout.Height(30f), GUILayout.MaxWidth(Screen.width));
|
||||
if (toolbarIndex >= debuggerWindowGroup.DebuggerWindowCount)
|
||||
{
|
||||
m_ShowFullWindow = false;
|
||||
return;
|
||||
}
|
||||
|
||||
if (debuggerWindowGroup.SelectedWindow == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (debuggerWindowGroup.SelectedIndex != toolbarIndex)
|
||||
{
|
||||
debuggerWindowGroup.SelectedWindow.OnLeave();
|
||||
debuggerWindowGroup.SelectedIndex = toolbarIndex;
|
||||
debuggerWindowGroup.SelectedWindow.OnEnter();
|
||||
}
|
||||
|
||||
IDebuggerWindowGroup subDebuggerWindowGroup = debuggerWindowGroup.SelectedWindow as IDebuggerWindowGroup;
|
||||
if (subDebuggerWindowGroup != null)
|
||||
{
|
||||
DrawDebuggerWindowGroup(subDebuggerWindowGroup);
|
||||
}
|
||||
|
||||
debuggerWindowGroup.SelectedWindow.OnDraw();
|
||||
}
|
||||
|
||||
private void DrawDebuggerWindowIcon(int windowId)
|
||||
{
|
||||
GUI.DragWindow(m_DragRect);
|
||||
GUILayout.Space(5);
|
||||
Color32 color = Color.white;
|
||||
m_ConsoleWindow.RefreshCount();
|
||||
if (m_ConsoleWindow.FatalCount > 0)
|
||||
{
|
||||
color = m_ConsoleWindow.GetLogStringColor(LogType.Exception);
|
||||
}
|
||||
else if (m_ConsoleWindow.ErrorCount > 0)
|
||||
{
|
||||
color = m_ConsoleWindow.GetLogStringColor(LogType.Error);
|
||||
}
|
||||
else if (m_ConsoleWindow.WarningCount > 0)
|
||||
{
|
||||
color = m_ConsoleWindow.GetLogStringColor(LogType.Warning);
|
||||
}
|
||||
else
|
||||
{
|
||||
color = m_ConsoleWindow.GetLogStringColor(LogType.Log);
|
||||
}
|
||||
|
||||
string title = Utility.Text.Format("<color=#{0:x2}{1:x2}{2:x2}{3:x2}><b>FPS: {4:F2}</b></color>", color.r, color.g, color.b, color.a, m_FpsCounter.CurrentFps);
|
||||
if (GUILayout.Button(title, GUILayout.Width(100f), GUILayout.Height(40f)))
|
||||
{
|
||||
m_ShowFullWindow = true;
|
||||
}
|
||||
}
|
||||
|
||||
private static void CopyToClipboard(string content)
|
||||
{
|
||||
s_TextEditor.text = content;
|
||||
s_TextEditor.OnFocus();
|
||||
s_TextEditor.Copy();
|
||||
s_TextEditor.text = string.Empty;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f05eaceeebe870a4595e51f998ed518b
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user