事件系统开发中
This commit is contained in:
27
Assets/GameFramework/Runtime/EventSystem/IEvent.cs
Normal file
27
Assets/GameFramework/Runtime/EventSystem/IEvent.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
public interface IEvent { }
|
||||
|
||||
public interface IEventHandler<TEvent> where TEvent : IEvent
|
||||
{
|
||||
void HandleEvent(TEvent eventData);
|
||||
}
|
||||
|
||||
public struct ApplicationFocusEvent : IEvent
|
||||
{
|
||||
public bool HasFocus;
|
||||
}
|
||||
|
||||
public struct SceneLoadEvent : IEvent
|
||||
{
|
||||
public string SceneName;
|
||||
public float Progress;
|
||||
}
|
||||
|
||||
public abstract class EventHandler<TEvent> : IEventHandler<TEvent> where TEvent : IEvent
|
||||
{
|
||||
public void HandleEvent(TEvent eventData)
|
||||
{
|
||||
OnEvent(eventData);
|
||||
}
|
||||
|
||||
protected abstract void OnEvent(TEvent eventData);
|
||||
}
|
||||
Reference in New Issue
Block a user