better fast load and sort customs by alphabetical

This commit is contained in:
RandomityGuy 2024-06-10 19:35:26 +05:30
parent 085110b490
commit c31e3b0442
5 changed files with 54 additions and 18 deletions

View file

@ -26,6 +26,11 @@ class MPCustoms {
Http.get("https://marbleblastultra.randomityguy.me/data/ultraCustom.json", (b) -> { Http.get("https://marbleblastultra.randomityguy.me/data/ultraCustom.json", (b) -> {
var misList = Json.parse(b.toString()); var misList = Json.parse(b.toString());
missionList = misList; missionList = misList;
missionList.sort((a, b) -> {
var a1 = a.title.toLowerCase();
var b1 = b.title.toLowerCase();
return a1 < b1 ? -1 : (a1 > b1 ? 1 : 0);
});
Console.log('Loaded ${misList.length} custom missions.'); Console.log('Loaded ${misList.length} custom missions.');
_requestSent = false; _requestSent = false;
}, (e) -> { }, (e) -> {

View file

@ -40,7 +40,7 @@ class MarbleGame {
static var canvas:Canvas; static var canvas:Canvas;
static var instance:MarbleGame; static var instance:MarbleGame;
static var currentVersion = "1.0.2"; static var currentVersion = "1.1.0";
var world:MarbleWorld; var world:MarbleWorld;
var previewWorld:PreviewWorld; var previewWorld:PreviewWorld;

View file

@ -1778,20 +1778,51 @@ class MarbleWorld extends Scheduler {
if (lock) if (lock)
return; return;
var func = this.resourceLoadFuncs.shift(); if (Settings.optionsSettings.fastLoad) {
lock = true; #if hl
#if hl while (this.resourceLoadFuncs.length != 0) {
func(() -> { var func = this.resourceLoadFuncs.shift();
lock = false; lock = true;
this._resourcesLoaded++; func(() -> {
}); lock = false;
#end this._resourcesLoaded++;
#if js });
func(() -> { }
lock = false; #end
this._resourcesLoaded++; #if js
}); lock = true;
#end
var func = this.resourceLoadFuncs.shift();
var consumeFn;
consumeFn = () -> {
this._resourcesLoaded++;
if (this.resourceLoadFuncs.length != 0) {
var fn = this.resourceLoadFuncs.shift();
fn(consumeFn);
} else {
lock = false;
}
}
func(consumeFn);
#end
} else {
var func = this.resourceLoadFuncs.shift();
lock = true;
#if hl
func(() -> {
lock = false;
this._resourcesLoaded++;
});
#end
#if js
func(() -> {
lock = false;
this._resourcesLoaded++;
});
#end
}
} else { } else {
if (!this._loadBegin || lock) if (!this._loadBegin || lock)
return; return;

View file

@ -135,7 +135,7 @@ class Settings {
rewindTimescale: 1, rewindTimescale: 1,
reflectionDetail: 2, reflectionDetail: 2,
maxPixelRatio: 1, maxPixelRatio: 1,
vsync: true, vsync: false,
huntRandom: false, huntRandom: false,
fastLoad: false fastLoad: false
}; };

View file

@ -88,13 +88,13 @@ class MiscOptionsGui extends GuiImage {
}, 0.5, 118); }, 0.5, 118);
sgOpt.setCurrentOption(Settings.optionsSettings.huntRandom ? 0 : 1); sgOpt.setCurrentOption(Settings.optionsSettings.huntRandom ? 0 : 1);
#if hl // #if hl
var flOpt = optionCollection.addOption(1, "Fast Loading", ["Disabled", "Enabled"], (idx) -> { var flOpt = optionCollection.addOption(1, "Fast Loading", ["Disabled", "Enabled"], (idx) -> {
Settings.optionsSettings.fastLoad = (idx == 1); Settings.optionsSettings.fastLoad = (idx == 1);
return true; return true;
}, 0.5, 118); }, 0.5, 118);
flOpt.setCurrentOption(Settings.optionsSettings.fastLoad ? 1 : 0); flOpt.setCurrentOption(Settings.optionsSettings.fastLoad ? 1 : 0);
#end // #end
var bottomBar = new GuiControl(); var bottomBar = new GuiControl();
bottomBar.position = new Vector(0, 590); bottomBar.position = new Vector(0, 590);