modify
This commit is contained in:
parent
f08ef131b3
commit
93cbb26c9a
@ -1,56 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace AlicizaX.Runtime
|
||||
{
|
||||
/// <summary>
|
||||
/// 游戏事件管理器。
|
||||
/// </summary>
|
||||
public class EventListenerProxy : IReference
|
||||
{
|
||||
private readonly bool _isInit = false;
|
||||
private readonly List<Action<Delegate>> clearHandlers;
|
||||
private readonly List<Delegate> actionCallBack;
|
||||
|
||||
/// <summary>
|
||||
/// 游戏事件管理器构造函数。
|
||||
/// </summary>
|
||||
public EventListenerProxy()
|
||||
{
|
||||
if (_isInit)
|
||||
{
|
||||
return;
|
||||
}
|
||||
_isInit = true;
|
||||
clearHandlers = new List<Action<Delegate>>();
|
||||
actionCallBack = new List<Delegate>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 清理内存对象回收入池。
|
||||
/// </summary>
|
||||
public void Clear()
|
||||
{
|
||||
if (!_isInit)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = 0; i < clearHandlers.Count; ++i)
|
||||
{
|
||||
var clearAction = clearHandlers[i];
|
||||
var handle = actionCallBack[i];
|
||||
clearAction(handle);
|
||||
}
|
||||
|
||||
clearHandlers.Clear();
|
||||
actionCallBack.Clear();
|
||||
}
|
||||
|
||||
public void AddEventImp(Action<Delegate> handler,Delegate action)
|
||||
{
|
||||
clearHandlers.Add(handler);
|
||||
actionCallBack.Add(action);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: eb346bc3be28f89468e2c071e7ab9594
|
||||
timeCreated: 1680273952
|
@ -1,7 +0,0 @@
|
||||
namespace AlicizaX.Runtime
|
||||
{
|
||||
public interface IEventListenerProxy
|
||||
{
|
||||
public EventListenerProxy EventListener { get; }
|
||||
}
|
||||
}
|
@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4798c5e2685443cd96fc39a7dc5e9df3
|
||||
timeCreated: 1730786771
|
Loading…
Reference in New Issue
Block a user