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:
parent
14771e72de
commit
b6eda8e498
|
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue