
using System;

namespace XGame.Framework
{
    /// <summary>
    /// 框架使用的事件系统 (业务不要用, 可自行使用EventSingle)
    /// </summary>
    public sealed class FrameworkEvent : TSingleton<FrameworkEvent>
    {
        private EventModule _eventModule = new EventModule();
        public void Notify(int eventId)
        {
            _eventModule.Notify(eventId);
        }

        public void Notify(int eventId, object args)
        {
            _eventModule.Notify(eventId, args);
        }
        public void AddListener(int eventId, EventDelegate handler)
        {
            _eventModule.AddListener(eventId, handler);
        }

        public void RemoveListener(int eventId, EventDelegate handler)
        {
            _eventModule.RemoveListener(eventId, handler);
        }

        protected override void OnDispose()
        {
            (_eventModule as IDisposable)?.Dispose();
        }
    }
}
