1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2025-01-13 15:47:51 +00:00

Merge remote-tracking branch 'origin/master' into feature/chart-editor-performance-revamp

This commit is contained in:
EliteMasterEric 2023-09-20 19:41:17 -04:00
commit dc728133d1
6 changed files with 26 additions and 15 deletions

View file

@ -49,8 +49,8 @@
"name": "haxeui-core",
"type": "git",
"dir": null,
"ref": "f5daafe93bdfa957538f199294a54e0476c805b7",
"url": "https://github.com/haxeui/haxeui-core/"
"ref": "e92d5cfac847943fac84696b103670d55c2c774f",
"url": "https://github.com/haxeui/haxeui-core"
},
{
"name": "haxeui-flixel",

View file

@ -64,7 +64,7 @@ class DataParse
return switch (json.value)
{
case JString(s): s;
case JNumber(n): n;
case JNumber(n): Std.parseInt(n);
case JBool(b): b;
case JNull: null;
case JObject(fields): jsonFieldsToDynamicObject(fields);
@ -82,7 +82,7 @@ class DataParse
var result:Dynamic = {};
for (field in fields)
{
Reflect.setField(result, field.name, field.value);
Reflect.setField(result, field.name, jsonToDynamic(field.value));
}
return result;
}

View file

@ -203,37 +203,46 @@ class SongRegistry extends BaseRegistry<Song, SongMetadata>
return ScriptedSong.listScriptClasses();
}
function loadEntryMetadataFile(id:String, variation:String = ''):BaseRegistry.JsonFile
function loadEntryMetadataFile(id:String, variation:String = ''):Null<BaseRegistry.JsonFile>
{
var entryFilePath:String = Paths.json('$dataFilePath/$id/$id${variation == '' ? '' : '-$variation'}-metadata');
var rawJson:String = openfl.Assets.getText(entryFilePath).trim();
if (!openfl.Assets.exists(entryFilePath)) return null;
var rawJson:Null<String> = openfl.Assets.getText(entryFilePath);
if (rawJson == null) return null;
rawJson = rawJson.trim();
return {fileName: entryFilePath, contents: rawJson};
}
function loadMusicDataFile(id:String, variation:String = ''):BaseRegistry.JsonFile
function loadMusicDataFile(id:String, variation:String = ''):Null<BaseRegistry.JsonFile>
{
var entryFilePath:String = Paths.file('music/$id/$id${variation == '' ? '' : '-$variation'}-metadata.json');
var rawJson:String = openfl.Assets.getText(entryFilePath).trim();
if (!openfl.Assets.exists(entryFilePath)) return null;
var rawJson:String = openfl.Assets.getText(entryFilePath);
if (rawJson == null) return null;
rawJson = rawJson.trim();
return {fileName: entryFilePath, contents: rawJson};
}
function loadEntryChartFile(id:String, variation:String = ''):BaseRegistry.JsonFile
function loadEntryChartFile(id:String, variation:String = ''):Null<BaseRegistry.JsonFile>
{
var entryFilePath:String = Paths.json('$dataFilePath/$id/$id${variation == '' ? '' : '-$variation'}-chart');
var rawJson:String = openfl.Assets.getText(entryFilePath).trim();
if (!openfl.Assets.exists(entryFilePath)) return null;
var rawJson:String = openfl.Assets.getText(entryFilePath);
if (rawJson == null) return null;
rawJson = rawJson.trim();
return {fileName: entryFilePath, contents: rawJson};
}
public function fetchEntryMetadataVersion(id:String, variation:String = ''):Null<thx.semver.Version>
{
var entryStr:String = loadEntryMetadataFile(id, variation).contents;
var entryStr:Null<String> = loadEntryMetadataFile(id, variation)?.contents;
var entryVersion:thx.semver.Version = VersionUtil.getVersionFromJSON(entryStr);
return entryVersion;
}
public function fetchEntryChartVersion(id:String, variation:String = ''):Null<thx.semver.Version>
{
var entryStr:String = loadEntryChartFile(id, variation).contents;
var entryStr:Null<String> = loadEntryChartFile(id, variation)?.contents;
var entryVersion:thx.semver.Version = VersionUtil.getVersionFromJSON(entryStr);
return entryVersion;
}

View file

@ -207,7 +207,7 @@ class Song implements IPlayStateScriptedClass implements IRegistryEntry<SongMeta
{
var version:Null<thx.semver.Version> = SongRegistry.instance.fetchEntryChartVersion(id, variation);
if (version == null) continue;
var chart:Null<SongChartData> = SongRegistry.instance.parseEntryChartDataWithMigration(id, version, variation);
var chart:Null<SongChartData> = SongRegistry.instance.parseEntryChartDataWithMigration(id, variation, version);
if (chart == null) continue;
applyChartData(chart, variation);
}

View file

@ -2931,6 +2931,7 @@ class ChartEditorState extends HaxeUIState
// If this gets too big, something needs to be optimized somewhere! -Eric
FlxG.watch.addQuick("tapNotesRendered", renderedNotes.members.length);
FlxG.watch.addQuick("holdNotesRendered", renderedHoldNotes.members.length);
FlxG.watch.addQuick("eventsRendered", renderedEvents.members.length);
}
/**
@ -3010,7 +3011,7 @@ class ChartEditorState extends HaxeUIState
}
// CTRL + O = Open Chart
if (FlxG.keys.pressed.CONTROL && FlxG.keys.justPressed.N)
if (FlxG.keys.pressed.CONTROL && FlxG.keys.justPressed.O)
{
ChartEditorDialogHandler.openBrowseWizard(this, true);
}

View file

@ -51,8 +51,9 @@ class VersionUtil
* @param input The JSON string to parse.
* @return The semantic version, or null if it could not be parsed.
*/
public static function getVersionFromJSON(input:String):Null<thx.semver.Version>
public static function getVersionFromJSON(input:Null<String>):Null<thx.semver.Version>
{
if (input == null) return null;
var parsed = SerializerUtil.fromJSON(input);
if (parsed == null) return null;
if (parsed.version == null) return null;