2022-09-24 15:02:10 -04:00
|
|
|
package funkin.play.event;
|
|
|
|
|
2023-09-08 17:46:44 -04:00
|
|
|
import funkin.data.song.SongData.SongEventData;
|
2024-01-03 21:10:14 -05:00
|
|
|
import funkin.data.event.SongEventSchema;
|
2023-01-22 19:55:30 -05: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 15:02:10 -04:00
|
|
|
{
|
2023-01-22 22:25:45 -05:00
|
|
|
/**
|
|
|
|
* The internal song event ID that this handler is responsible for.
|
|
|
|
*/
|
2023-01-22 19:55:30 -05:00
|
|
|
public var id:String;
|
|
|
|
|
|
|
|
public function new(id:String)
|
|
|
|
{
|
|
|
|
this.id = id;
|
|
|
|
}
|
|
|
|
|
2023-01-22 22:25:45 -05:00
|
|
|
/**
|
|
|
|
* 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-22 19:55:30 -05:00
|
|
|
{
|
|
|
|
throw 'SongEvent.handleEvent() must be overridden!';
|
|
|
|
}
|
|
|
|
|
2023-01-22 22:25:45 -05:00
|
|
|
/**
|
|
|
|
* 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-22 19:55:30 -05:00
|
|
|
public function getEventSchema():SongEventSchema
|
|
|
|
{
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2023-07-19 01:30:23 -04:00
|
|
|
/**
|
|
|
|
* Retrieves the asset path to the icon this event type should use in the chart editor.
|
|
|
|
* To customize this, override getIconPath().
|
|
|
|
*/
|
|
|
|
public function getIconPath():String
|
|
|
|
{
|
|
|
|
return 'ui/chart-editor/events/default';
|
|
|
|
}
|
|
|
|
|
2023-01-22 22:25:45 -05:00
|
|
|
/**
|
|
|
|
* Retrieves the human readable title of this song event type.
|
|
|
|
* Used for the chart editor.
|
|
|
|
* @return The title.
|
|
|
|
*/
|
2023-01-22 19:55:30 -05:00
|
|
|
public function getTitle():String
|
|
|
|
{
|
|
|
|
return this.id.toTitleCase();
|
|
|
|
}
|
|
|
|
|
|
|
|
public function toString():String
|
|
|
|
{
|
|
|
|
return 'SongEvent(${this.id})';
|
|
|
|
}
|
2022-09-24 15:02:10 -04:00
|
|
|
}
|