1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2025-07-05 02:07:02 +00:00

remove note kind logic from playstate

This commit is contained in:
lemz 2024-06-01 18:25:46 +02:00 committed by EliteMasterEric
parent 14771e72de
commit b6eda8e498
2 changed files with 23 additions and 23 deletions

View file

@ -1178,16 +1178,8 @@ class PlayState extends MusicBeatSubState
// Dispatch event to conversation script.
ScriptEventDispatcher.callEvent(currentConversation, event);
// 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);
}
// Dispatch event to note kind scripts
NoteKindManager.callEvent(event);
}
/**

View file

@ -32,23 +32,31 @@ class NoteKindManager
}
}
public static function callEvent(noteKind:String, event:ScriptEvent):Void
/**
* Calls the given event for note kind scripts
* @param event The event
*/
public static function callEvent(event:ScriptEvent):Void
{
var noteKind:NoteKind = noteKinds.get(noteKind);
if (noteKind == null)
// if it is a note script event,
// then only call the event for the specific note kind script
if (Std.isOfType(event, NoteScriptEvent))
{
return;
var noteEvent:NoteScriptEvent = cast(event, NoteScriptEvent);
var noteKind:NoteKind = noteKinds.get(noteEvent.note.noteData.kind);
if (noteKind != null)
{
ScriptEventDispatcher.callEvent(noteKind, event);
}
}
ScriptEventDispatcher.callEvent(noteKind, event);
}
public static function callEventForAll(event:ScriptEvent):Void
{
for (noteKind in noteKinds.iterator())
else // call the event for all note kind scripts
{
ScriptEventDispatcher.callEvent(noteKind, event);
for (noteKind in noteKinds.iterator())
{
ScriptEventDispatcher.callEvent(noteKind, event);
}
}
}
}