com.alicizax.unity.network/Editor/NetworkComponentInspector.cs
2025-03-18 19:41:26 +08:00

40 lines
1.2 KiB
C#

using AlicizaX.Editor;
using AlicizaX.Network.Runtime;
using UnityEditor;
namespace AlicizaX.Network.Editor
{
[CustomEditor(typeof(NetworkComponent))]
internal sealed class NetworkComponentInspector : ComponentTypeComponentInspector
{
private SerializedProperty m_HeartInterval = null;
protected override void Enable()
{
base.Enable();
m_HeartInterval = serializedObject.FindProperty("m_HeartInterval");
}
public override void OnInspectorGUI()
{
base.OnInspectorGUI();
EditorGUI.BeginDisabledGroup(EditorApplication.isPlayingOrWillChangePlaymode);
{
int heartInterval = EditorGUILayout.IntField("心跳间隔时间/ms", m_HeartInterval.intValue);
if (heartInterval != m_HeartInterval.intValue)
{
m_HeartInterval.intValue = heartInterval;
}
}
EditorGUI.EndDisabledGroup();
Repaint();
}
protected override void RefreshTypeNames()
{
RefreshComponentTypeNames(typeof(INetworkManager));
}
}
}