com.alicizax.unity.network/Editor/NetworkComponentInspector.cs

35 lines
1017 B
C#
Raw Normal View History

2025-03-20 20:47:48 +08:00
using System;
using AlicizaX.Editor;
2025-02-24 17:35:48 +08:00
using AlicizaX.Network.Runtime;
using UnityEditor;
namespace AlicizaX.Network.Editor
{
[CustomEditor(typeof(NetworkComponent))]
2025-03-20 20:47:48 +08:00
internal sealed class NetworkComponentInspector : GameFrameworkInspector
2025-02-24 17:35:48 +08:00
{
2025-03-18 19:41:26 +08:00
private SerializedProperty m_HeartInterval = null;
2025-03-20 20:47:48 +08:00
private void OnEnable()
2025-03-18 19:41:26 +08:00
{
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();
}
2025-02-24 17:35:48 +08:00
}
}