diff --git a/Project.xml b/Project.xml
index b0d15bd9..beefe066 100644
--- a/Project.xml
+++ b/Project.xml
@@ -96,7 +96,7 @@
-
+
diff --git a/buildnumber.txt b/buildnumber.txt
index f083bc3c..9221efbe 100644
--- a/buildnumber.txt
+++ b/buildnumber.txt
@@ -1 +1 @@
-1516
\ No newline at end of file
+1523
\ No newline at end of file
diff --git a/source/funkin/menus/TitleState.hx b/source/funkin/menus/TitleState.hx
index b27f5d02..873e5798 100644
--- a/source/funkin/menus/TitleState.hx
+++ b/source/funkin/menus/TitleState.hx
@@ -178,7 +178,7 @@ class TitleState extends MusicBeatState
#if UPDATE_CHECKING
var report = funkin.updating.UpdateUtil.checkForUpdates();
if (report.newUpdate) {
- FlxG.switchState(new funkin.updating.UpdateScreen(report));
+ FlxG.switchState(new funkin.updating.UpdateAvailableScreen(report));
} else {
FlxG.switchState(new MainMenuState());
}
diff --git a/source/funkin/updating/AsyncUpdater.hx b/source/funkin/updating/AsyncUpdater.hx
index 68fb73fb..7db4bb69 100644
--- a/source/funkin/updating/AsyncUpdater.hx
+++ b/source/funkin/updating/AsyncUpdater.hx
@@ -47,8 +47,10 @@ class AsyncUpdater {
public function installFiles(files:Array) {
progress.step = INSTALLING;
- for(e in files) {
+ progress.files = files.length;
+ for(k=>e in files) {
var path = '$path$e';
+ progress.curFile = k+1;
trace('extracting file ${path}');
var reader = ZipUtils.openZip(path);
@@ -80,10 +82,10 @@ class AsyncUpdater {
progress.files = 1;
progress.step = DOWNLOADING_EXECUTABLE;
trace('starting exe download');
- // doFile([exePath], [executableName], function() {
+ doFile([exePath], [executableName], function() {
trace('done, starting installation');
installFiles(fileNames);
- // });
+ });
});
}
@@ -96,13 +98,14 @@ class AsyncUpdater {
var fn = fileNames.shift();
trace('downloading $f ($fn)');
progress.curFile++;
+ progress.bytesLoaded = 0;
+ progress.bytesTotal = 1;
downloadStream = new URLLoader();
downloadStream.dataFormat = BINARY;
downloadStream.addEventListener(ProgressEvent.PROGRESS, function(e) {
progress.bytesLoaded = e.bytesLoaded;
progress.bytesTotal = e.bytesTotal;
- trace('${progress.bytesLoaded} / ${progress.bytesTotal}');
});
downloadStream.addEventListener(Event.COMPLETE, function(e) {
var fileOutput:FileOutput = File.write('$path$fn', true);
@@ -138,7 +141,7 @@ class UpdaterProgress {
public var files:Int = 0;
public var bytesLoaded:Float = 0;
public var bytesTotal:Float = 0;
- public var curZipProgress:ZipProgress = null;
+ public var curZipProgress:ZipProgress = new ZipProgress();
public function new() {}
}
diff --git a/source/funkin/updating/UpdateAvailableScreen.hx b/source/funkin/updating/UpdateAvailableScreen.hx
index feb1e4c2..17819d35 100644
--- a/source/funkin/updating/UpdateAvailableScreen.hx
+++ b/source/funkin/updating/UpdateAvailableScreen.hx
@@ -112,7 +112,7 @@ class UpdateAvailableScreen extends MusicBeatState {
public override function update(elapsed:Float) {
super.update(elapsed);
- destY = FlxMath.bound(destY - (FlxG.mouse.wheel * 40), 0, Math.max(0, changeLogText.height - FlxG.height + versionCheckBG.height + 20 + optionsBG.height));
+ destY = FlxMath.bound(destY - (FlxG.mouse.wheel * 75), 0, Math.max(0, changeLogText.height - FlxG.height + versionCheckBG.height + 20 + optionsBG.height));
FlxG.camera.scroll.y = lerp(FlxG.camera.scroll.y, destY, 1/3);
if (controls.LEFT_P || controls.RIGHT_P) {
diff --git a/source/funkin/updating/UpdateScreen.hx b/source/funkin/updating/UpdateScreen.hx
index 5e9d49fc..68afaa6e 100644
--- a/source/funkin/updating/UpdateScreen.hx
+++ b/source/funkin/updating/UpdateScreen.hx
@@ -1,10 +1,14 @@
package funkin.updating;
+import flixel.FlxG;
+import flixel.ui.FlxBar;
import funkin.updating.UpdateUtil.UpdateCheckCallback;
class UpdateScreen extends MusicBeatState {
public var updater:AsyncUpdater;
+ public var progressBar:FlxBar;
+
public function new(check:UpdateCheckCallback) {
super(false);
updater = new AsyncUpdater(check.updates);
@@ -12,6 +16,28 @@ class UpdateScreen extends MusicBeatState {
public override function create() {
super.create();
+
+ progressBar = new FlxBar(0, FlxG.height - 150, LEFT_TO_RIGHT, FlxG.width, 150);
+ progressBar.createGradientBar([0xFF000000], [0xFF000000, 0xFF111111, 0xFF222222, 0xFF444444, 0xFF888888, -1], 1, 90);
+ progressBar.setRange(0, 4);
+ add(progressBar);
+
updater.execute();
}
+
+
+ public override function update(elapsed:Float) {
+ super.update(elapsed);
+ var prog = updater.progress;
+ switch(prog.step) {
+ case PREPARING:
+ progressBar.value = 0;
+ case DOWNLOADING_ASSETS:
+ progressBar.value = 1 + ((prog.curFile-1+(prog.bytesLoaded/prog.bytesTotal)) / prog.files);
+ case DOWNLOADING_EXECUTABLE:
+ progressBar.value = 2 + (prog.bytesLoaded/prog.bytesTotal);
+ case INSTALLING:
+ progressBar.value = 3 + ((prog.curFile-1+(prog.curZipProgress.curFile/prog.curZipProgress.fileCount))/prog.files);
+ }
+ }
}
\ No newline at end of file