Funkin/source/funkin/play/song/Song.hx
Eric Myllyoja f790cd8fd6 WIP
2022-09-06 00:59:54 -04:00

38 lines
977 B
Haxe

package funkin.play.song;
/**
* This is a data structure managing information about the current song.
* This structure is created when the game starts, and includes all the data
* from the `metadata.json` file.
* It also includes the chart data, but only when this is the currently loaded song.
*
* It also receives script events; scripted classes which extend this class
* can be used to perform custom gameplay behaviors only on specific songs.
*/
class Song implements IPlayStateScriptedClass
{
public var songId(default, null):String;
public var songName(get, null):String;
final _metadata:SongMetadata;
final _chartData:SongChartData;
public function new(id:String)
{
this.songId = songId;
_metadata = SongDataParser.parseSongMetadata(this.songId);
if (_metadata == null)
{
throw 'Could not find song data for songId: $songId';
}
}
function get_songName():String
{
if (_metadata == null)
return null;
return _metadata.name;
}
}