update screen almost done

This commit is contained in:
Yoshman29
2022-12-20 02:22:39 +01:00
parent 546325d98b
commit 3de20d7e7b
5 changed files with 24 additions and 11 deletions
+1 -1
View File
@@ -1 +1 @@
1578
1582
+5 -2
View File
@@ -35,6 +35,7 @@ using StringTools;
class TitleState extends MusicBeatState
{
static var initialized:Bool = false;
static var hasCheckedUpdates:Bool = false;
public var curWacky:Array<String> = [];
@@ -176,8 +177,10 @@ class TitleState extends MusicBeatState
new FlxTimer().start(2, function(tmr:FlxTimer)
{
#if UPDATE_CHECKING
var report = funkin.updating.UpdateUtil.checkForUpdates();
if (report.newUpdate) {
var report = hasCheckedUpdates ? null : funkin.updating.UpdateUtil.checkForUpdates();
hasCheckedUpdates = true;
if (report != null && report.newUpdate) {
FlxG.switchState(new funkin.updating.UpdateAvailableScreen(report));
} else {
FlxG.switchState(new MainMenuState());
+5 -4
View File
@@ -28,12 +28,12 @@ class AsyncUpdater {
#if windows
public var executableGitHubName:String = "update-windows.exe";
public var executableName:String = "CodenameEngine.exe";
public static var executableGitHubName:String = "update-windows.exe";
public static var executableName:String = "CodenameEngine.exe";
#end
#if linux
public var executableGitHubName:String = "update-linux";
public var executableName:String = "CodenameEngine";
public static var executableGitHubName:String = "update-linux";
public static var executableName:String = "CodenameEngine";
#end
public var releases:Array<GitHubRelease>;
@@ -58,6 +58,7 @@ class AsyncUpdater {
progress.curZipProgress = new ZipProgress();
ZipUtils.uncompressZip(reader, './', null, progress.curZipProgress);
FileSystem.deleteFile(path);
}
if (executableReplaced = FileSystem.exists('$path$executableName')) {
var progPath = Sys.programPath();
+1 -1
View File
@@ -74,7 +74,7 @@ class UpdateScreen extends MusicBeatState {
FlxG.camera.fade(0xFF000000, overSound.length / 1000, false, function() {
if (updater.executableReplaced) {
// the executable has been replaced, restart the game entirely
Sys.command('start /B ${updater.executableName}');
Sys.command('start /B ${AsyncUpdater.executableName}');
openfl.system.System.exit(0);
} else {
// assets update, switch back to TitleState.
+12 -3
View File
@@ -64,10 +64,19 @@ class UpdateUtil {
var i = releases.length - 1 - index;
var release = releases[i];
if (release.tag_name == currentVersionTag) {
__curVersionPos = index;
var containsBinary = false;
for(asset in release.assets) {
if (asset.name.toLowerCase() == AsyncUpdater.executableGitHubName.toLowerCase()) {
containsBinary = true;
break;
}
}
if (containsBinary) {
if (release.tag_name == currentVersionTag) {
__curVersionPos = index;
}
newArray.push(release);
}
newArray.push(release);
}
return newArray.length <= 0 ? newArray : newArray.splice(__curVersionPos+1, newArray.length-(__curVersionPos+1));