mirror of
https://github.com/RandomityGuy/MBHaxe.git
synced 2025-12-25 09:22:52 +00:00
fix slider and js settings
This commit is contained in:
parent
3cbd1066ad
commit
4cb5587ac5
4 changed files with 23 additions and 3 deletions
BIN
marblegame.hl
BIN
marblegame.hl
Binary file not shown.
|
|
@ -107,7 +107,8 @@ class MarbleGame {
|
|||
});
|
||||
canvas.pushDialog(exitGameDlg);
|
||||
} else {
|
||||
canvas.popDialog(exitGameDlg);
|
||||
if (exitGameDlg != null)
|
||||
canvas.popDialog(exitGameDlg);
|
||||
world.setCursorLock(true);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -112,13 +112,29 @@ class Settings {
|
|||
}
|
||||
|
||||
public static function save() {
|
||||
var outputData = {
|
||||
highScores: highScores,
|
||||
var outputData:Dynamic = {
|
||||
options: optionsSettings,
|
||||
controls: controlsSettings,
|
||||
progression: progression,
|
||||
highscoreName: highscoreName
|
||||
};
|
||||
var scoreCount = 0;
|
||||
for (key => value in highScores) {
|
||||
scoreCount++;
|
||||
}
|
||||
#if hl
|
||||
if (scoreCount != 0)
|
||||
outputData.highScores = highScores;
|
||||
else
|
||||
outputData.highScores = {};
|
||||
#end
|
||||
#if js
|
||||
var kvps:Array<Dynamic> = [];
|
||||
for (key => value in highScores)
|
||||
kvps.push([key, value]);
|
||||
var jobj = js.lib.Object.fromEntries(kvps);
|
||||
outputData.highScores = jobj;
|
||||
#end
|
||||
var json = Json.stringify(outputData);
|
||||
#if hl
|
||||
File.saveContent("settings.json", json);
|
||||
|
|
@ -158,6 +174,8 @@ class Settings {
|
|||
controlsSettings = json.controls;
|
||||
progression = json.progression;
|
||||
highscoreName = json.highscoreName;
|
||||
} else {
|
||||
save();
|
||||
}
|
||||
#if hl
|
||||
Window.getInstance().vsync = optionsSettings.vsync;
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ class GuiSlider extends GuiImage {
|
|||
slidingSound.pause = true;
|
||||
super.update(dt, mouseState);
|
||||
this.bmp.x = renderRect.position.x + renderRect.extent.x * sliderValue;
|
||||
this.bmp.x = Util.clamp(this.bmp.x, renderRect.position.x, renderRect.position.x + renderRect.extent.x - bmp.width / 2);
|
||||
this.bmp.width = this.bmp.tile.width;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue