mirror of
https://github.com/FunkinCrew/Funkin.git
synced 2024-11-27 01:55:52 -05:00
Registries now get added to the Flixel console (and get lazy instantiated so they don't start before the game does)
This commit is contained in:
parent
11426e5177
commit
d50ff73d3c
8 changed files with 65 additions and 9 deletions
|
@ -55,6 +55,13 @@ abstract class BaseRegistry<T:(IRegistryEntry<J> & Constructible<EntryConstructo
|
||||||
|
|
||||||
this.entries = new Map<String, T>();
|
this.entries = new Map<String, T>();
|
||||||
this.scriptedEntryIds = [];
|
this.scriptedEntryIds = [];
|
||||||
|
|
||||||
|
// Lazy initialization of singletons should let this get called,
|
||||||
|
// but we have this check just in case.
|
||||||
|
if (FlxG.game != null)
|
||||||
|
{
|
||||||
|
FlxG.console.registerObject('registry$registryId', this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -15,7 +15,14 @@ class ConversationRegistry extends BaseRegistry<Conversation, ConversationData>
|
||||||
|
|
||||||
public static final CONVERSATION_DATA_VERSION_RULE:thx.semver.VersionRule = "1.0.x";
|
public static final CONVERSATION_DATA_VERSION_RULE:thx.semver.VersionRule = "1.0.x";
|
||||||
|
|
||||||
public static final instance:ConversationRegistry = new ConversationRegistry();
|
public static var instance(get, never):ConversationRegistry;
|
||||||
|
static var _instance:Null<ConversationRegistry> = null;
|
||||||
|
|
||||||
|
static function get_instance():ConversationRegistry
|
||||||
|
{
|
||||||
|
if (_instance == null) _instance = new ConversationRegistry();
|
||||||
|
return _instance;
|
||||||
|
}
|
||||||
|
|
||||||
public function new()
|
public function new()
|
||||||
{
|
{
|
||||||
|
|
|
@ -15,7 +15,14 @@ class DialogueBoxRegistry extends BaseRegistry<DialogueBox, DialogueBoxData>
|
||||||
|
|
||||||
public static final DIALOGUEBOX_DATA_VERSION_RULE:thx.semver.VersionRule = "1.1.x";
|
public static final DIALOGUEBOX_DATA_VERSION_RULE:thx.semver.VersionRule = "1.1.x";
|
||||||
|
|
||||||
public static final instance:DialogueBoxRegistry = new DialogueBoxRegistry();
|
public static var instance(get, never):DialogueBoxRegistry;
|
||||||
|
static var _instance:Null<DialogueBoxRegistry> = null;
|
||||||
|
|
||||||
|
static function get_instance():DialogueBoxRegistry
|
||||||
|
{
|
||||||
|
if (_instance == null) _instance = new DialogueBoxRegistry();
|
||||||
|
return _instance;
|
||||||
|
}
|
||||||
|
|
||||||
public function new()
|
public function new()
|
||||||
{
|
{
|
||||||
|
|
|
@ -15,7 +15,14 @@ class SpeakerRegistry extends BaseRegistry<Speaker, SpeakerData>
|
||||||
|
|
||||||
public static final SPEAKER_DATA_VERSION_RULE:thx.semver.VersionRule = "1.0.x";
|
public static final SPEAKER_DATA_VERSION_RULE:thx.semver.VersionRule = "1.0.x";
|
||||||
|
|
||||||
public static final instance:SpeakerRegistry = new SpeakerRegistry();
|
public static var instance(get, never):SpeakerRegistry;
|
||||||
|
static var _instance:Null<SpeakerRegistry> = null;
|
||||||
|
|
||||||
|
static function get_instance():SpeakerRegistry
|
||||||
|
{
|
||||||
|
if (_instance == null) _instance = new SpeakerRegistry();
|
||||||
|
return _instance;
|
||||||
|
}
|
||||||
|
|
||||||
public function new()
|
public function new()
|
||||||
{
|
{
|
||||||
|
|
|
@ -15,7 +15,14 @@ class LevelRegistry extends BaseRegistry<Level, LevelData>
|
||||||
|
|
||||||
public static final LEVEL_DATA_VERSION_RULE:thx.semver.VersionRule = "1.0.x";
|
public static final LEVEL_DATA_VERSION_RULE:thx.semver.VersionRule = "1.0.x";
|
||||||
|
|
||||||
public static final instance:LevelRegistry = new LevelRegistry();
|
public static var instance(get, never):LevelRegistry;
|
||||||
|
static var _instance:Null<LevelRegistry> = null;
|
||||||
|
|
||||||
|
static function get_instance():LevelRegistry
|
||||||
|
{
|
||||||
|
if (_instance == null) _instance = new LevelRegistry();
|
||||||
|
return _instance;
|
||||||
|
}
|
||||||
|
|
||||||
public function new()
|
public function new()
|
||||||
{
|
{
|
||||||
|
|
|
@ -15,7 +15,14 @@ class NoteStyleRegistry extends BaseRegistry<NoteStyle, NoteStyleData>
|
||||||
|
|
||||||
public static final NOTE_STYLE_DATA_VERSION_RULE:thx.semver.VersionRule = "1.0.x";
|
public static final NOTE_STYLE_DATA_VERSION_RULE:thx.semver.VersionRule = "1.0.x";
|
||||||
|
|
||||||
public static final instance:NoteStyleRegistry = new NoteStyleRegistry();
|
public static var instance(get, never):NoteStyleRegistry;
|
||||||
|
static var _instance:Null<NoteStyleRegistry> = null;
|
||||||
|
|
||||||
|
static function get_instance():NoteStyleRegistry
|
||||||
|
{
|
||||||
|
if (_instance == null) _instance = new NoteStyleRegistry();
|
||||||
|
return _instance;
|
||||||
|
}
|
||||||
|
|
||||||
public function new()
|
public function new()
|
||||||
{
|
{
|
||||||
|
|
|
@ -40,10 +40,17 @@ class SongRegistry extends BaseRegistry<Song, SongMetadata>
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO: What if there was a Singleton macro which created static functions
|
* TODO: What if there was a Singleton macro which automatically created the property for us?
|
||||||
* that redirected to the instance?
|
|
||||||
*/
|
*/
|
||||||
public static final instance:SongRegistry = new SongRegistry();
|
public static var instance(get, never):SongRegistry;
|
||||||
|
|
||||||
|
static var _instance:Null<SongRegistry> = null;
|
||||||
|
|
||||||
|
static function get_instance():SongRegistry
|
||||||
|
{
|
||||||
|
if (_instance == null) _instance = new SongRegistry();
|
||||||
|
return _instance;
|
||||||
|
}
|
||||||
|
|
||||||
public function new()
|
public function new()
|
||||||
{
|
{
|
||||||
|
|
|
@ -15,7 +15,14 @@ class StageRegistry extends BaseRegistry<Stage, StageData>
|
||||||
|
|
||||||
public static final STAGE_DATA_VERSION_RULE:thx.semver.VersionRule = "1.0.x";
|
public static final STAGE_DATA_VERSION_RULE:thx.semver.VersionRule = "1.0.x";
|
||||||
|
|
||||||
public static final instance:StageRegistry = new StageRegistry();
|
public static var instance(get, never):StageRegistry;
|
||||||
|
static var _instance:Null<StageRegistry> = null;
|
||||||
|
|
||||||
|
static function get_instance():StageRegistry
|
||||||
|
{
|
||||||
|
if (_instance == null) _instance = new StageRegistry();
|
||||||
|
return _instance;
|
||||||
|
}
|
||||||
|
|
||||||
public function new()
|
public function new()
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue