com.alicizax.unity.network/Runtime/Network/NetworkComponent.cs
2025-03-20 20:47:48 +08:00

32 lines
833 B
C#

using AlicizaX.Runtime;
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.Fatal("Network Manager is invalid.");
return;
}
_networkModule.SetHeartInterval(m_HeartInterval);
}
}
}