using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Cysharp.Threading.Tasks;

namespace KYFramework
{
    public interface IEvent
    {
        Type GetEventType();
    }

    public abstract class AEvent<A> : IEvent where A: struct
    {
        public Type GetEventType()
        {
            return typeof (A);
        }

        protected abstract UniTask Run( A a);

        public async UniTask Handle( A a)
        {
            try
            {
                await Run(a);
            }
            catch (Exception e)
            {
                Log.Error(e);
            }
        }
    }
   
}