LegacyScriptEngine icon indicating copy to clipboard operation
LegacyScriptEngine copied to clipboard

[Feature]: 添加对事件监听器移除的支持

Open leoweyr opened this issue 6 months ago • 1 comments

Is your feature request related to a problem? Please describe.

在现有的机制上,只允许添加事件监听器,而不能移除事件监听器(除非重启服务端)。如果一个事件监听器的设计是有生命寿命的,在超出生命寿命后它仍然继续执行虽然可以加层判断阻拦但是在 Ticks 中还是会有执行帧,多多少少会有性能上的消耗(特别是量大的情况下)。

Describe the solution you'd like

在底层上对 Levilamina 事件监听器进一步封装,在 LegacyScriptEngine 使用上,每次添加一个事件监听器返回一个事件监听器的对象,该事件监听器存在一个方法可以对内存中的事件监听器(自身)进行销毁移除,来实现对事件监听器的精细控制。

Describe alternatives you've considered

No response

Additional context

No response

leoweyr avatar Jun 09 '25 03:06 leoweyr

也许你可以试试iListenAttentively-LseExport

zimuya4153 avatar Jun 09 '25 08:06 zimuya4153