mirror of
https://github.com/whoahq/whoa.git
synced 2026-03-18 05:31:07 +03:00
feat(ui): add FrameScript_Object::UnregisterScriptEvent
This commit is contained in:
parent
121f41d6b8
commit
17198939da
@ -193,6 +193,25 @@ int32_t FrameScript_Object::SetScript(lua_State* L) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
void FrameScript_Object::UnregisterScriptEvent(const char* name) {
|
||||
auto event = FrameScript::s_scriptEventsHash.Ptr(name);
|
||||
|
||||
if (!event) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (event->pendingSignalCount) {
|
||||
for (auto node = event->registerListeners.Head(); node; node = event->registerListeners.Next(node)) {
|
||||
if (node->listener == this) {
|
||||
event->registerListeners.DeleteNode(node);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FrameScript_UnregisterScriptEvent(this, event);
|
||||
}
|
||||
|
||||
void FrameScript_Object::UnregisterScriptObject(const char* name) {
|
||||
auto L = FrameScript_GetContext();
|
||||
|
||||
|
||||
@ -48,6 +48,7 @@ class FrameScript_Object {
|
||||
void RegisterScriptObject(const char* name);
|
||||
void RunScript(ScriptIx const& script, int32_t argCount, const char* a4);
|
||||
int32_t SetScript(lua_State* L);
|
||||
void UnregisterScriptEvent(const char* name);
|
||||
void UnregisterScriptObject(const char* name);
|
||||
};
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user