mirror of
https://github.com/Alex-Rachel/TEngine.git
synced 2025-08-14 16:51:28 +00:00
DebugerComponent
This commit is contained in:
@@ -0,0 +1,61 @@
|
|||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace TEngine.Runtime
|
||||||
|
{
|
||||||
|
public sealed partial class DebuggerComponent
|
||||||
|
{
|
||||||
|
private sealed class NetworkInformationWindow : ScrollableDebuggerWindowBase
|
||||||
|
{
|
||||||
|
private Network m_NetworkComponent = null;
|
||||||
|
|
||||||
|
public override void Initialize(params object[] args)
|
||||||
|
{
|
||||||
|
m_NetworkComponent = Network.Instance;
|
||||||
|
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.ToString(), networkChannel.SentPacketCount.ToString()));
|
||||||
|
DrawItem("Receive Packet", Utility.Text.Format("{0} / {1}", networkChannel.ReceivePacketCount.ToString(), networkChannel.ReceivedPacketCount.ToString()));
|
||||||
|
DrawItem("Miss Heart Beat Count", networkChannel.MissHeartBeatCount.ToString());
|
||||||
|
DrawItem("Heart Beat", Utility.Text.Format("{0} / {1}", networkChannel.HeartBeatElapseSeconds.ToString("F2"), networkChannel.HeartBeatInterval.ToString("F2")));
|
||||||
|
if (networkChannel.Connected)
|
||||||
|
{
|
||||||
|
if (GUILayout.Button("Disconnect", GUILayout.Height(30f)))
|
||||||
|
{
|
||||||
|
networkChannel.Close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
GUILayout.EndVertical();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: d9234c66fc6c4421ad762cf70fe9e0a0
|
||||||
|
timeCreated: 1661828316
|
@@ -189,6 +189,7 @@ namespace TEngine.Runtime
|
|||||||
private RuntimeMemoryInformationWindow<ScriptableObject> m_RuntimeMemoryScriptableObjectInformationWindow = new RuntimeMemoryInformationWindow<ScriptableObject>();
|
private RuntimeMemoryInformationWindow<ScriptableObject> m_RuntimeMemoryScriptableObjectInformationWindow = new RuntimeMemoryInformationWindow<ScriptableObject>();
|
||||||
|
|
||||||
private MemoryPoolInformationWindow m_MemoryPoolInformationWindow = new MemoryPoolInformationWindow();
|
private MemoryPoolInformationWindow m_MemoryPoolInformationWindow = new MemoryPoolInformationWindow();
|
||||||
|
private NetworkInformationWindow m_NetworkInformationWindow = new NetworkInformationWindow();
|
||||||
|
|
||||||
private SettingsWindow m_SettingsWindow = new SettingsWindow();
|
private SettingsWindow m_SettingsWindow = new SettingsWindow();
|
||||||
#endregion
|
#endregion
|
||||||
@@ -228,6 +229,7 @@ namespace TEngine.Runtime
|
|||||||
RegisterDebuggerWindow("Profiler/Memory/ScriptableObject", m_RuntimeMemoryScriptableObjectInformationWindow);
|
RegisterDebuggerWindow("Profiler/Memory/ScriptableObject", m_RuntimeMemoryScriptableObjectInformationWindow);
|
||||||
|
|
||||||
RegisterDebuggerWindow("Profiler/Memory Pool", m_MemoryPoolInformationWindow);
|
RegisterDebuggerWindow("Profiler/Memory Pool", m_MemoryPoolInformationWindow);
|
||||||
|
RegisterDebuggerWindow("Profiler/Network", m_NetworkInformationWindow);
|
||||||
|
|
||||||
RegisterDebuggerWindow("Other/Settings", m_SettingsWindow);
|
RegisterDebuggerWindow("Other/Settings", m_SettingsWindow);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user