onUpdate, etc. works now too

This commit is contained in:
lemz 2024-05-31 17:49:25 +02:00 committed by EliteMasterEric
parent 606d9d4af4
commit c83e505f5b
2 changed files with 13 additions and 1 deletions

View file

@ -1178,12 +1178,16 @@ class PlayState extends MusicBeatSubState
// Dispatch event to conversation script.
ScriptEventDispatcher.callEvent(currentConversation, event);
// Dispatch event to note script
// Dispatch event to only the specific note script
if (Std.isOfType(event, NoteScriptEvent))
{
var noteEvent:NoteScriptEvent = cast(event, NoteScriptEvent);
NoteKindManager.callEvent(noteEvent.note.noteData.kind, noteEvent);
}
else // Dispatch event to all note scripts
{
NoteKindManager.callEventForAll(event);
}
}
/**

View file

@ -43,4 +43,12 @@ class NoteKindManager
ScriptEventDispatcher.callEvent(noteKind, event);
}
public static function callEventForAll(event:ScriptEvent):Void
{
for (noteKind in noteKinds.iterator())
{
ScriptEventDispatcher.callEvent(noteKind, event);
}
}
}