2024-03-23 19:34:37 +00:00
|
|
|
package funkin.data.story.level;
|
2023-05-17 02:09:53 +00:00
|
|
|
|
2024-05-02 01:51:33 +00:00
|
|
|
import funkin.util.SortUtil;
|
2023-05-17 02:09:53 +00:00
|
|
|
import funkin.ui.story.Level;
|
|
|
|
import funkin.ui.story.ScriptedLevel;
|
2025-04-12 22:16:04 +00:00
|
|
|
import funkin.util.tools.ISingleton;
|
|
|
|
import funkin.data.DefaultRegistryImpl;
|
2023-05-17 02:09:53 +00:00
|
|
|
|
2025-06-25 12:33:56 +00:00
|
|
|
@:nullSafety
|
2025-08-11 21:07:20 +00:00
|
|
|
class LevelRegistry extends BaseRegistry<Level, LevelData, LevelEntryParams> implements ISingleton implements DefaultRegistryImpl
|
2023-05-17 02:09:53 +00:00
|
|
|
{
|
|
|
|
/**
|
2024-01-16 21:49:15 +00:00
|
|
|
* The current version string for the level data format.
|
2023-05-17 02:09:53 +00:00
|
|
|
* Handle breaking changes by incrementing this value
|
2024-01-16 21:49:15 +00:00
|
|
|
* and adding migration to the `migrateLevelData()` function.
|
2023-05-17 02:09:53 +00:00
|
|
|
*/
|
2024-05-02 16:46:24 +00:00
|
|
|
public static final LEVEL_DATA_VERSION:thx.semver.Version = "1.0.1";
|
2023-08-22 08:27:30 +00:00
|
|
|
|
2025-02-21 05:45:02 +00:00
|
|
|
public static final LEVEL_DATA_VERSION_RULE:thx.semver.VersionRule = ">=1.0.0 <1.1.0";
|
2023-05-17 02:09:53 +00:00
|
|
|
|
|
|
|
public function new()
|
|
|
|
{
|
2023-08-22 08:27:30 +00:00
|
|
|
super('LEVEL', 'levels', LEVEL_DATA_VERSION_RULE);
|
2023-05-17 02:09:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2023-05-17 20:42:58 +00:00
|
|
|
* A list of all the story weeks from the base game, in order.
|
2025-04-13 07:39:31 +00:00
|
|
|
* @return Array<String>
|
2023-05-17 02:09:53 +00:00
|
|
|
*/
|
2025-04-13 07:39:31 +00:00
|
|
|
public function listBaseGameEntryIds():Array<String>
|
2024-05-02 01:51:33 +00:00
|
|
|
{
|
2025-04-13 07:39:31 +00:00
|
|
|
// This MUST be hard-coded (overriding the auto-generated method)
|
|
|
|
// because the auto-generated method spits out values in alphabetical order.
|
|
|
|
return [
|
|
|
|
'tutorial',
|
|
|
|
'week1',
|
|
|
|
'week2',
|
|
|
|
'week3',
|
|
|
|
'week4',
|
|
|
|
'week5',
|
|
|
|
'week6',
|
|
|
|
'week7',
|
|
|
|
'weekend1'
|
|
|
|
];
|
2024-05-02 01:51:33 +00:00
|
|
|
}
|
|
|
|
|
2023-05-17 20:42:58 +00:00
|
|
|
/**
|
2025-04-13 07:39:31 +00:00
|
|
|
* A list of all the story weeks in the game, in order.
|
|
|
|
* Modded levels are in alphabetical order at the end of the list.
|
|
|
|
* @return Array<String>
|
2023-05-17 20:42:58 +00:00
|
|
|
*/
|
2025-04-13 07:39:31 +00:00
|
|
|
public function listSortedLevelIds():Array<String>
|
2023-05-17 20:42:58 +00:00
|
|
|
{
|
2025-04-13 07:39:31 +00:00
|
|
|
var result:Array<String> = listEntryIds();
|
|
|
|
result.sort(SortUtil.defaultsThenAlphabetically.bind(listBaseGameEntryIds()));
|
|
|
|
return result;
|
2023-05-17 02:09:53 +00:00
|
|
|
}
|
|
|
|
}
|
2025-08-11 21:07:20 +00:00
|
|
|
|
|
|
|
typedef LevelEntryParams = {}
|