CTT/Unity/Assets/HotfixView/Entity/ClickActionComponent.cs

50 lines
1.0 KiB
C#
Raw Normal View History

2021-04-08 20:09:59 +08:00
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ET
{
2021-04-24 17:39:11 +08:00
public class ClickActionComponentAwakeSystem:AwakeSystem<ClickActionComponent>
{
public override void Awake(ClickActionComponent self)
{
}
}
public class ClickActionComponentDestorySystem:DestroySystem<ClickActionComponent>
{
public override void Destroy(ClickActionComponent self)
{
self.ClearAction();
}
}
2021-04-08 20:09:59 +08:00
public class ClickActionComponent:Entity
{
private event Action _onClick;
public event Action onClick
{
add
{
_onClick -= value;
_onClick += value;
}
remove
{
_onClick -= value;
}
}
public void Run()
{
_onClick?.Invoke();
}
public void ClearAction()
{
_onClick = null;
}
}
}