using System;
using AlicizaX.Editor;
using AlicizaX.Network.Runtime;
using UnityEditor;

namespace AlicizaX.Network.Editor
{
    [CustomEditor(typeof(NetworkComponent))]
    internal sealed class NetworkComponentInspector : GameFrameworkInspector
    {
        private SerializedProperty m_HeartInterval = null;

        private void OnEnable()
        {
            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();
        }
    }
}
