1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2024-11-05 22:34:36 +00:00
Funkin/source/funkin/play/event/SongEvent.hx

55 lines
1.2 KiB
Haxe
Raw Normal View History

2022-09-24 19:02:10 +00:00
package funkin.play.event;
2023-01-23 00:55:30 +00:00
import funkin.play.song.SongData.SongEventData;
2023-06-02 18:35:28 +00:00
import funkin.play.event.SongEventData.SongEventSchema;
2023-01-23 00:55:30 +00:00
/**
* This class represents a handler for a type of song event.
* It is used by the ScriptedSongEvent class to handle user-defined events.
*/
class SongEvent
2022-09-24 19:02:10 +00:00
{
/**
* The internal song event ID that this handler is responsible for.
*/
2023-01-23 00:55:30 +00:00
public var id:String;
public function new(id:String)
{
this.id = id;
}
/**
* Handles a song event that matches this handler's ID.
* @param data The data associated with the event.
*/
public function handleEvent(data:SongEventData):Void
2023-01-23 00:55:30 +00:00
{
throw 'SongEvent.handleEvent() must be overridden!';
}
/**
* Retrieves the chart editor schema for this song event type.
* @return The schema, or null if this event type does not have a schema.
*/
2023-01-23 00:55:30 +00:00
public function getEventSchema():SongEventSchema
{
return null;
}
/**
* Retrieves the human readable title of this song event type.
* Used for the chart editor.
* @return The title.
*/
2023-01-23 00:55:30 +00:00
public function getTitle():String
{
return this.id.toTitleCase();
}
public function toString():String
{
return 'SongEvent(${this.id})';
}
2022-09-24 19:02:10 +00:00
}