ysy no more broken song json shit

This commit is contained in:
ILikeWeewees 2023-06-02 20:13:50 -07:00
parent 0ac8487c30
commit 4b4a90185c
2 changed files with 11 additions and 3 deletions

View File

@ -4,6 +4,7 @@ import Section.SwagSection;
import haxe.Json;
import haxe.format.JsonParser;
import lime.utils.Assets;
import sys.FileSystem;
using StringTools;
@ -40,8 +41,15 @@ class Song
public static function loadFromJson(jsonInput:String, ?folder:String):SwagSong
{
var rawJson = Assets.getText(Paths.json(folder.toLowerCase() + '/' + jsonInput.toLowerCase())).trim();
var rawJson:String;
if (FileSystem.exists(Paths.json(folder.toLowerCase() + '/' + jsonInput.toLowerCase())))
{
rawJson = Assets.getText(Paths.json(folder.toLowerCase() + '/' + jsonInput.toLowerCase())).trim();
}
else
{
rawJson = '{"song": {"song": "' + jsonInput + '","bpm": 100.0,"needsVoices": true,"player1": "bf","player2": "dad","speed": 1.3,"notes": [{"lengthInSteps": 16,"mustHitSection": false,"sectionNotes": []},{"lengthInSteps": 16,"mustHitSection": false,"sectionNotes": []},{"lengthInSteps": 16,"mustHitSection": false,"sectionNotes": []},{"lengthInSteps": 16,"mustHitSection": false,"sectionNotes": []},{"lengthInSteps": 16,"mustHitSection": false,"sectionNotes": []},{"lengthInSteps": 16,"mustHitSection": false,"sectionNotes": []},{"lengthInSteps": 16,"mustHitSection": false,"sectionNotes": []},{"lengthInSteps": 16,"mustHitSection": false,"sectionNotes": []},{"lengthInSteps": 16,"mustHitSection": false,"sectionNotes": []}]},"generatedBy": "SNIFF ver.6"}';
}
while (!rawJson.endsWith("}"))
{
rawJson = rawJson.substr(0, rawJson.length - 1);

View File

@ -1,3 +1,3 @@
#automatically generated do not edit
#@date Fri Jun 02 2023 19:16:38 GMT-0700 (Pacific Daylight Time)
#@date Fri Jun 02 2023 19:52:08 GMT-0700 (Pacific Daylight Time)
-cp c:\users\bamst\appdata\local\temp\2def77e625d453c59a42a972450a0ad156c9aa14