some lil update screen progress

This commit is contained in:
Yoshman29
2022-12-20 00:42:13 +01:00
parent ea24d91efa
commit da2226e183
7 changed files with 54 additions and 5 deletions
Binary file not shown.
Binary file not shown.

After

Width:  |  Height:  |  Size: 503 KiB

+12
View File
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<TextureAtlas imagePath="bf.png">
<!-- Created with Adobe Animate version 21.0.1.37179 -->
<!-- http://www.adobe.com/products/animate.html -->
<SubTexture name="load0000" x="561" y="565" width="407" height="413" pivotX="215.85" pivotY="278.8" frameX="-74" frameY="-72" frameWidth="553" frameHeight="557"/>
<SubTexture name="load0001" x="563" y="0" width="532" height="555" frameX="0" frameY="0" frameWidth="553" frameHeight="557"/>
<SubTexture name="load0002" x="563" y="0" width="532" height="555" frameX="0" frameY="0" frameWidth="553" frameHeight="557"/>
<SubTexture name="load0003" x="0" y="561" width="551" height="549" frameX="0" frameY="-8" frameWidth="553" frameHeight="557"/>
<SubTexture name="load0004" x="0" y="561" width="551" height="549" frameX="0" frameY="-8" frameWidth="553" frameHeight="557"/>
<SubTexture name="load0005" x="0" y="0" width="553" height="551" frameX="0" frameY="-6" frameWidth="553" frameHeight="557"/>
<SubTexture name="load0006" x="0" y="0" width="553" height="551" frameX="0" frameY="-6" frameWidth="553" frameHeight="557"/>
</TextureAtlas>
+1 -1
View File
@@ -1 +1 @@
1556
1565
+2 -3
View File
@@ -140,6 +140,8 @@ class FreeplayState extends MusicBeatState
changeSelection((controls.UP_P ? -1 : 0) + (controls.DOWN_P ? 1 : 0));
changeDiff((controls.LEFT_P ? -1 : 0) + (controls.RIGHT_P ? 1 : 0));
// putting it before so that its actually smooth
updateOptionsAlpha();
scoreText.text = "PERSONAL BEST:" + lerpScore;
scoreBG.scale.set(Math.max(diffText.width, scoreText.width) + 8, 66);
@@ -152,9 +154,6 @@ class FreeplayState extends MusicBeatState
bg.color = CoolUtil.lerpColor(bg.color, songs[curSelected].color, 0.0625);
// putting it before so that its actually smooth
updateOptionsAlpha();
var dontPlaySongThisFrame = false;
#if PRELOAD_ALL
autoplayElapsed += elapsed;
+2
View File
@@ -85,6 +85,7 @@ class AsyncUpdater {
doFile([exePath], [executableName], function() {
trace('done, starting installation');
installFiles(fileNames);
progress.done = true;
});
});
}
@@ -141,6 +142,7 @@ class UpdaterProgress {
public var files:Int = 0;
public var bytesLoaded:Float = 0;
public var bytesTotal:Float = 0;
public var done:Bool = false;
public var curZipProgress:ZipProgress = new ZipProgress();
public function new() {}
+37 -1
View File
@@ -1,5 +1,8 @@
package funkin.updating;
import flixel.math.FlxRect;
import flixel.system.FlxSound;
import flixel.FlxSprite;
import flixel.FlxG;
import flixel.ui.FlxBar;
import funkin.updating.UpdateUtil.UpdateCheckCallback;
@@ -8,6 +11,10 @@ class UpdateScreen extends MusicBeatState {
public var updater:AsyncUpdater;
public var progressBar:FlxBar;
public var bf:FlxSprite;
public var done:Bool = false;
public var overSound:FlxSound;
public function new(check:UpdateCheckCallback) {
super(false);
@@ -17,17 +24,29 @@ class UpdateScreen extends MusicBeatState {
public override function create() {
super.create();
progressBar = new FlxBar(0, FlxG.height - 150, LEFT_TO_RIGHT, FlxG.width, 150);
progressBar = new FlxBar(0, FlxG.height - 75, LEFT_TO_RIGHT, FlxG.width, 75);
progressBar.createGradientBar([0xFF000000], [0xFF000000, 0xFF111111, 0xFF222222, 0xFF444444, 0xFF888888, -1], 1, 90);
progressBar.setRange(0, 4);
add(progressBar);
bf = new FlxSprite();
bf.antialiasing = true;
bf.frames = Paths.getFrames("menus/update/bf");
bf.animation.addByPrefix("loading", "", 0, false);
bf.animation.addByPrefix("loading-anim", "", 24, false);
bf.animation.play("loading");
bf.screenCenter();
add(bf);
overSound = FlxG.sound.load(Paths.sound('gameOverEnd'));
updater.execute();
}
public override function update(elapsed:Float) {
super.update(elapsed);
if (done) return;
var prog = updater.progress;
switch(prog.step) {
case PREPARING:
@@ -39,5 +58,22 @@ class UpdateScreen extends MusicBeatState {
case INSTALLING:
progressBar.value = 3 + ((prog.curFile-1+(prog.curZipProgress.curFile/prog.curZipProgress.fileCount))/prog.files);
}
var rect = new FlxRect(0, (1 - (progressBar.value / 4)) * bf.frameHeight, bf.frameWidth, 0);
rect.height = bf.frameHeight - rect.y;
bf.clipRect = rect;
bf.alpha = (progressBar.value / 4) * FlxG.random.float(0.70, 0.80);
if (done = prog.done) {
// update is done, play bf's anim
FlxG.sound.music.stop();
overSound.play();
bf.animation.curAnim.frameRate = 24;
bf.animation.play("loading-anim");
bf.alpha = 1;
FlxG.camera.fade(0xFF000000, overSound.length / 1000, false, function() {
trace("crap");
});
bf.clipRect = null;
}
}
}