12345678910111213141516171819202122232425262728293031323334353637 |
- 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);
- }
- }
- }
-
- }
|