2024-10-11 10:12:15 +08:00
|
|
|
/********************************************************************
|
|
|
|
文件: ActionEvent.cs
|
|
|
|
作者: 梦语
|
|
|
|
邮箱: 1982614048@qq.com
|
|
|
|
创建时间: 2024/03/29 17:28:19
|
|
|
|
最后修改: 梦语
|
|
|
|
最后修改时间: 2024/04/03 16:06:42
|
|
|
|
功能: 自定义的事件处理类
|
|
|
|
*********************************************************************/
|
|
|
|
using System.Collections;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using UnityEngine;
|
|
|
|
using UnityEngine.Events;
|
|
|
|
|
|
|
|
namespace Ether
|
|
|
|
{
|
|
|
|
public class ActionEvent : UnityEvent
|
|
|
|
{
|
2024-10-29 15:14:02 +08:00
|
|
|
public int Count { get; private set; } = 0;
|
|
|
|
|
2024-10-11 10:12:15 +08:00
|
|
|
public object EventData { get; private set; }
|
|
|
|
|
|
|
|
public new void AddListener(UnityAction call)
|
|
|
|
{
|
|
|
|
base.AddListener(call);
|
2024-10-29 15:14:02 +08:00
|
|
|
Count++;
|
2024-10-11 10:12:15 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
public new void RemoveListener(UnityAction call)
|
|
|
|
{
|
|
|
|
base.RemoveListener(call);
|
2024-10-29 15:14:02 +08:00
|
|
|
Count--;
|
2024-10-11 10:12:15 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
public new void RemoveAllListeners()
|
|
|
|
{
|
|
|
|
base.RemoveAllListeners();
|
2024-10-29 15:14:02 +08:00
|
|
|
Count = 0;
|
2024-10-11 10:12:15 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public class ActionEvent<T> : UnityEvent<T>
|
|
|
|
{
|
2024-10-29 15:14:02 +08:00
|
|
|
public int Count { get; private set; } = 0;
|
|
|
|
|
2024-10-11 10:12:15 +08:00
|
|
|
public object EventData { get; private set; }
|
|
|
|
|
|
|
|
public new void AddListener(UnityAction<T> call)
|
|
|
|
{
|
|
|
|
base.AddListener(call);
|
2024-10-29 15:14:02 +08:00
|
|
|
Count++;
|
2024-10-11 10:12:15 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
public new void RemoveListener(UnityAction<T> call)
|
|
|
|
{
|
|
|
|
base.RemoveListener(call);
|
2024-10-29 15:14:02 +08:00
|
|
|
Count--;
|
2024-10-11 10:12:15 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
public new void RemoveAllListeners()
|
|
|
|
{
|
|
|
|
base.RemoveAllListeners();
|
2024-10-29 15:14:02 +08:00
|
|
|
Count = 0;
|
2024-10-11 10:12:15 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|