mirror of
https://github.com/RandomityGuy/MBHaxe.git
synced 2025-10-30 08:11:25 +00:00
add proper loading screen for js
This commit is contained in:
parent
2b9db80b38
commit
23322c66fc
2 changed files with 39 additions and 10 deletions
|
|
@ -187,21 +187,18 @@ class MarbleWorld extends Scheduler {
|
|||
this._loadingLength = resourceLoadFuncs.length;
|
||||
fwd();
|
||||
});
|
||||
this.resourceLoadFuncs.push(fwd -> {
|
||||
this.playGui.init(this.scene2d);
|
||||
var musicFileName = [
|
||||
'data/sound/groovepolice.ogg',
|
||||
'data/sound/classic vibe.ogg',
|
||||
'data/sound/beach party.ogg'
|
||||
][(mission.index + 1) % 3];
|
||||
AudioManager.playMusic(ResourceLoader.getResource(musicFileName, ResourceLoader.getAudio, this.soundResources));
|
||||
fwd();
|
||||
});
|
||||
this._loadingLength = resourceLoadFuncs.length;
|
||||
}
|
||||
|
||||
public function postInit() {
|
||||
this._ready = true;
|
||||
this.playGui.init(this.scene2d);
|
||||
var musicFileName = [
|
||||
'data/sound/groovepolice.ogg',
|
||||
'data/sound/classic vibe.ogg',
|
||||
'data/sound/beach party.ogg'
|
||||
][(mission.index + 1) % 3];
|
||||
AudioManager.playMusic(ResourceLoader.getResource(musicFileName, ResourceLoader.getAudio, this.soundResources));
|
||||
MarbleGame.canvas.clearContent();
|
||||
this.endPad.generateCollider();
|
||||
this.playGui.formatGemCounter(this.gemCount, this.totalGems);
|
||||
|
|
|
|||
|
|
@ -55,12 +55,44 @@ class ResourceLoader {
|
|||
}, scene2d);
|
||||
loader = mloader;
|
||||
fileSystem = mfileSystem;
|
||||
var loadg = new h2d.Text(hxd.res.DefaultFont.get());
|
||||
loadg.textAlign = Center;
|
||||
loadg.textColor = 0xffffff;
|
||||
loadg.y = scene2d.height / 2;
|
||||
loadg.x = scene2d.width / 2;
|
||||
loadg.scale(2.5);
|
||||
scene2d.addChild(loadg);
|
||||
|
||||
var worker = new ResourceLoaderWorker(onLoadedFunc);
|
||||
worker.addTask(fwd -> {
|
||||
loadg.text = "Loading UI..";
|
||||
fwd();
|
||||
});
|
||||
worker.addTask(fwd -> preloadUI(fwd));
|
||||
worker.addTask(fwd -> {
|
||||
loadg.text = "Loading Missions..";
|
||||
fwd();
|
||||
});
|
||||
worker.addTask(fwd -> preloadMisFiles(fwd));
|
||||
worker.addTask(fwd -> {
|
||||
loadg.text = "Loading Music..";
|
||||
fwd();
|
||||
});
|
||||
worker.addTask(fwd -> preloadMusic(fwd));
|
||||
worker.addTask(fwd -> {
|
||||
loadg.text = "Loading Sounds..";
|
||||
fwd();
|
||||
});
|
||||
worker.addTask(fwd -> preloadUISounds(fwd));
|
||||
worker.addTask(fwd -> {
|
||||
loadg.text = "Loading Shapes..";
|
||||
fwd();
|
||||
});
|
||||
worker.addTask(fwd -> preloadShapes(fwd));
|
||||
worker.addTask(fwd -> {
|
||||
scene2d.removeChild(loadg);
|
||||
fwd();
|
||||
});
|
||||
worker.run();
|
||||
// preloader.start();
|
||||
#end
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue