mirror of
https://github.com/ninjamuffin99/Funkin.git
synced 2025-07-12 06:10:23 +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.
|
// Dispatch event to conversation script.
|
||||||
ScriptEventDispatcher.callEvent(currentConversation, event);
|
ScriptEventDispatcher.callEvent(currentConversation, event);
|
||||||
|
|
||||||
// Dispatch event to only the specific note script
|
// Dispatch event to note kind scripts
|
||||||
if (Std.isOfType(event, NoteScriptEvent))
|
NoteKindManager.callEvent(event);
|
||||||
{
|
|
||||||
var noteEvent:NoteScriptEvent = cast(event, NoteScriptEvent);
|
|
||||||
NoteKindManager.callEvent(noteEvent.note.noteData.kind, noteEvent);
|
|
||||||
}
|
|
||||||
else // Dispatch event to all note scripts
|
|
||||||
{
|
|
||||||
NoteKindManager.callEventForAll(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 it is a note script event,
|
||||||
|
// then only call the event for the specific note kind script
|
||||||
if (noteKind == null)
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
else // call the event for all note kind scripts
|
||||||
ScriptEventDispatcher.callEvent(noteKind, event);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function callEventForAll(event:ScriptEvent):Void
|
|
||||||
{
|
|
||||||
for (noteKind in noteKinds.iterator())
|
|
||||||
{
|
{
|
||||||
ScriptEventDispatcher.callEvent(noteKind, event);
|
for (noteKind in noteKinds.iterator())
|
||||||
|
{
|
||||||
|
ScriptEventDispatcher.callEvent(noteKind, event);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue