AlicizaX/Client/Packages/com.alicizax.unity.event/Runtime/EventComponent.cs

42 lines
1003 B
C#
Raw Normal View History

2025-01-23 19:06:48 +08:00
using System;
2025-04-28 19:45:45 +08:00
using AlicizaX;
2025-01-23 19:06:48 +08:00
using UnityEngine;
namespace AlicizaX.Event.Runtime
{
/// <summary>
/// 事件组件。
/// </summary>
[DisallowMultipleComponent]
[AddComponentMenu("Game Framework/Event")]
[UnityEngine.Scripting.Preserve]
2025-04-28 19:45:45 +08:00
public sealed class EventComponent : MonoBehaviour
2025-01-23 19:06:48 +08:00
{
2025-04-28 19:45:45 +08:00
private IEventModule _mEventModule = null;
2025-01-23 19:06:48 +08:00
/// <summary>
/// 获取事件处理函数的数量。
/// </summary>
public int EventHandlerCount
{
2025-04-28 19:45:45 +08:00
get { return _mEventModule.EventHandlerCount; }
2025-01-23 19:06:48 +08:00
}
/// <summary>
/// 获取事件数量。
/// </summary>
public int EventCount
{
2025-04-28 19:45:45 +08:00
get { return _mEventModule.EventCount; }
2025-01-23 19:06:48 +08:00
}
/// <summary>
/// 游戏框架组件初始化。
/// </summary>
2025-04-28 19:45:45 +08:00
private void Awake()
2025-01-23 19:06:48 +08:00
{
2025-04-28 19:45:45 +08:00
_mEventModule = ModuleSystem.RegisterModule<IEventModule,EventModule>();
2025-01-23 19:06:48 +08:00
}
}
2025-04-28 19:45:45 +08:00
}