mirror of
https://gitee.com/jisol/jisol-game/
synced 2025-06-26 19:34:47 +00:00
24 lines
487 B
C#
24 lines
487 B
C#
|
using System;
|
|||
|
|
|||
|
namespace GAS.Runtime
|
|||
|
{
|
|||
|
public class EventBase<T> where T : EventArgs
|
|||
|
{
|
|||
|
public event EventHandler<T> EventHandler;
|
|||
|
|
|||
|
public void Publish(T args)
|
|||
|
{
|
|||
|
EventHandler?.Invoke(this, args);
|
|||
|
}
|
|||
|
|
|||
|
public void Subscribe(EventHandler<T> handler)
|
|||
|
{
|
|||
|
EventHandler += handler;
|
|||
|
}
|
|||
|
|
|||
|
public void Unsubscribe(EventHandler<T> handler)
|
|||
|
{
|
|||
|
EventHandler -= handler;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|