zxl
/
CTT
forked from Cal/CTT
1
0
Fork 0
CTT/Unity/Assets/HotfixView/Entity/ClickActionComponent.cs

50 lines
1.0 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ET
{
public class ClickActionComponentAwakeSystem:AwakeSystem<ClickActionComponent>
{
public override void Awake(ClickActionComponent self)
{
}
}
public class ClickActionComponentDestorySystem:DestroySystem<ClickActionComponent>
{
public override void Destroy(ClickActionComponent self)
{
self.ClearAction();
}
}
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;
}
}
}