beta update option

This commit is contained in:
Yoshman29
2022-12-20 01:52:02 +01:00
parent d2eea7382c
commit 546325d98b
10 changed files with 66 additions and 32 deletions
+1 -1
View File
@@ -1 +1 @@
1571
1578
+1
View File
@@ -22,6 +22,7 @@ class Options
public static var autoPause:Bool = true;
public static var antialiasing:Bool = true;
public static var volume:Float = 1;
public static var betaUpdates:Bool = false;
/**
* PLAYER 1 CONTROLS
+2 -2
View File
@@ -37,9 +37,9 @@ class OptionsMenu extends MusicBeatState {
state: BehaviourOptions
},
{
name: 'Save Data',
name: 'Miscellaneous',
desc: 'Use this menu to reset save data or engine settings.',
state: SaveDataOptions
state: MiscOptions
},
{
name: 'Debug Options',
+5 -1
View File
@@ -118,7 +118,11 @@ class OptionsScreen extends MusicBeatState {
}
public function updateDesc() {
descText.text = '/ ${options[curSelected].desc} /';
updateDescText(options[curSelected].desc);
}
public function updateDescText(text:String) {
descText.text = '/ ${text} /';
@:privateAccess descText.regenGraphic(); //updates the thing
descDrop.loadFrame(descText.frame);
@@ -0,0 +1,35 @@
package funkin.options.categories;
import flixel.FlxG;
class MiscOptions extends OptionsScreen {
public override function create() {
options = [
#if UPDATE_CHECKING
new Checkbox(
"Enable Beta Updates",
"If checked, will also include beta (prereleases) updates in the update checking.",
"betaUpdates"),
new TextOption(
"Check for Updates",
"Select this option to check for new engine updates.",
function() {
var report = funkin.updating.UpdateUtil.checkForUpdates();
if (report.newUpdate) {
FlxG.switchState(new funkin.updating.UpdateAvailableScreen(report));
} else {
CoolUtil.playMenuSFX(2);
updateDescText("No update found.");
}
}),
#end
new TextOption(
"Reset Save Data",
"Select this option to reset save data. This will remove all of your highscores",
function() {
// TODO!!
})
];
super.create();
}
}
@@ -1,15 +0,0 @@
package funkin.options.categories;
class SaveDataOptions extends OptionsScreen {
public override function create() {
options = [
new TextOption(
"Reset Save Data",
"Select this option to reset save data. This will remove all of your highscores",
function() {
// TODO!!
})
];
super.create();
}
}
+2 -1
View File
@@ -188,7 +188,8 @@ class MusicBeatState extends FlxUIState implements IBeatReceiver
public override function destroy() {
super.destroy();
call("onDestroy");
stateScript.destroy();
if (stateScript != null)
stateScript.destroy();
}
public override function switchTo(nextState:FlxState) {
+9 -10
View File
@@ -40,6 +40,7 @@ class AsyncUpdater {
public var progress:UpdaterProgress = new UpdaterProgress();
public var path:String;
public var downloadStream:URLLoader;
public var executableReplaced:Bool = false;
public function installUpdates() {
prepareInstallationEnvironment();
@@ -58,16 +59,14 @@ class AsyncUpdater {
progress.curZipProgress = new ZipProgress();
ZipUtils.uncompressZip(reader, './', null, progress.curZipProgress);
}
var progPath = Sys.programPath();
var bakFile = '${Path.withoutExtension(progPath)}.bak';
if (FileSystem.exists(bakFile))
FileSystem.deleteFile(bakFile);
FileSystem.rename(progPath, bakFile);
FileSystem.rename('$path$executableName', progPath);
Sys.command('start /B $executableName');
openfl.system.System.exit(0);
if (executableReplaced = FileSystem.exists('$path$executableName')) {
var progPath = Sys.programPath();
var bakFile = '${Path.withoutExtension(progPath)}.bak';
if (FileSystem.exists(bakFile))
FileSystem.deleteFile(bakFile);
FileSystem.rename(progPath, bakFile);
FileSystem.rename('$path$executableName', progPath);
}
}
public function downloadFiles() {
+9 -1
View File
@@ -1,5 +1,6 @@
package funkin.updating;
import funkin.menus.TitleState;
import flixel.math.FlxRect;
import flixel.system.FlxSound;
import flixel.FlxSprite;
@@ -71,7 +72,14 @@ class UpdateScreen extends MusicBeatState {
bf.animation.play("loading-anim");
bf.alpha = 1;
FlxG.camera.fade(0xFF000000, overSound.length / 1000, false, function() {
trace("crap");
if (updater.executableReplaced) {
// the executable has been replaced, restart the game entirely
Sys.command('start /B ${updater.executableName}');
openfl.system.System.exit(0);
} else {
// assets update, switch back to TitleState.
FlxG.switchState(new TitleState());
}
});
bf.clipRect = null;
}
+2 -1
View File
@@ -1,5 +1,6 @@
package funkin.updating;
import funkin.options.Options;
import sys.FileSystem;
import haxe.io.Path;
import funkin.github.GitHubRelease;
@@ -53,7 +54,7 @@ class UpdateUtil {
static var __curVersionPos = 0;
static function __doReleaseFiltering(releases:Array<GitHubRelease>, currentVersionTag:String) {
releases = releases.filterReleases(false, false);
releases = releases.filterReleases(Options.betaUpdates, false);
if (releases.length <= 0)
return releases;