using System;
using XGame.Framework;

namespace FL
{
    public class EventSingle : TSingleton<EventSingle>
    {
        private EventModule _eventModule = new EventModule();
        public void Notify(EventDefine eventId)
        {
            _eventModule.Notify((int)eventId);
        }

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

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

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

