better fast load and sort customs by alphabetical

This commit is contained in:
RandomityGuy 2024-06-10 19:35:26 +05:30
parent 540515bfc3
commit 21bd713203
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) -> {
var misList = Json.parse(b.toString());
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.');
_requestSent = false;
}, (e) -> {

View file

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

View file

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

View file

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

View file

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