com.alicizax.unity.network/Runtime/Network/NetworkComponent.cs
2025-03-24 13:17:26 +08:00

32 lines
825 B
C#

using AlicizaX;
using Cysharp.Threading.Tasks;
using Fantasy.Network;
using Fantasy.Network.Interface;
using UnityEngine;
using UnityEngine.Scripting;
namespace AlicizaX.Network.Runtime
{
[DisallowMultipleComponent]
[AddComponentMenu("Game Framework/Network")]
[Preserve]
public sealed class NetworkComponent : MonoBehaviour
{
private INetworkModule _networkModule;
[SerializeField] private int m_HeartInterval = 2000;
private void Awake()
{
_networkModule = ModuleSystem.RegisterModule<INetworkModule>(typeof(NetworkModule));
if (_networkModule == null)
{
Log.Error("Network Manager is invalid.");
return;
}
_networkModule.SetHeartInterval(m_HeartInterval);
}
}
}