mirror of
https://github.com/RandomityGuy/MBHaxe.git
synced 2026-03-02 18:11:01 +00:00
android fixes finish
This commit is contained in:
parent
971d74b187
commit
1d15cb25a6
2 changed files with 28 additions and 36 deletions
|
|
@ -248,17 +248,16 @@ class MarbleWorld extends Scheduler {
|
|||
|
||||
public function postInit() {
|
||||
// Add the sky at the last so that cubemap reflections work
|
||||
this.playGui.init(this.scene2d, this.mission.game.toLowerCase(), () -> {
|
||||
// this.scene.addChild(this.sky); TODO FIX ANDROID
|
||||
this._ready = true;
|
||||
var musicFileName = 'data/sound/music/' + this.mission.missionInfo.music;
|
||||
AudioManager.playMusic(ResourceLoader.getResource(musicFileName, ResourceLoader.getAudio, this.soundResources), this.mission.missionInfo.music);
|
||||
MarbleGame.canvas.clearContent();
|
||||
if (this.endPad != null)
|
||||
this.endPad.generateCollider();
|
||||
this.playGui.formatGemCounter(this.gemCount, this.totalGems);
|
||||
start();
|
||||
});
|
||||
this.playGui.init(this.scene2d, this.mission.game.toLowerCase());
|
||||
this.scene.addChild(this.sky);
|
||||
this._ready = true;
|
||||
var musicFileName = 'data/sound/music/' + this.mission.missionInfo.music;
|
||||
AudioManager.playMusic(ResourceLoader.getResource(musicFileName, ResourceLoader.getAudio, this.soundResources), this.mission.missionInfo.music);
|
||||
MarbleGame.canvas.clearContent();
|
||||
if (this.endPad != null)
|
||||
this.endPad.generateCollider();
|
||||
this.playGui.formatGemCounter(this.gemCount, this.totalGems);
|
||||
start();
|
||||
}
|
||||
|
||||
public function initScene(onFinish:Void->Void) {
|
||||
|
|
@ -1235,7 +1234,7 @@ class MarbleWorld extends Scheduler {
|
|||
asyncLoadResources();
|
||||
if (this.playGui != null && _ready)
|
||||
this.playGui.render(e);
|
||||
if (this.marble != null && this.marble.cubemapRenderer != null) {
|
||||
if (this.marble != null && this.marble.cubemapRenderer != null && _ready) {
|
||||
this.marble.cubemapRenderer.position.load(this.marble.getAbsPos().getPosition());
|
||||
this.marble.cubemapRenderer.render(e, 0.002);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -108,7 +108,7 @@ class PlayGui {
|
|||
}
|
||||
}
|
||||
|
||||
public function init(scene2d:h2d.Scene, game:String, onFinish:Void->Void) {
|
||||
public function init(scene2d:h2d.Scene, game:String) {
|
||||
this.scene2d = scene2d;
|
||||
this._init = true;
|
||||
|
||||
|
|
@ -149,9 +149,7 @@ class PlayGui {
|
|||
|
||||
powerupBox = new GuiImage(ResourceLoader.getResource('data/ui/game/powerup.png', ResourceLoader.getImage, this.imageResources).toTile());
|
||||
initTimer();
|
||||
initGemCounter(() -> {
|
||||
onFinish();
|
||||
});
|
||||
initGemCounter();
|
||||
initCenterText();
|
||||
initPowerupBox();
|
||||
if (game == 'ultra')
|
||||
|
|
@ -269,7 +267,7 @@ class PlayGui {
|
|||
}
|
||||
}
|
||||
|
||||
public function initGemCounter(onFinish:Void->Void) {
|
||||
public function initGemCounter() {
|
||||
gemCountNumbers[0].position = new Vector(30, 0);
|
||||
gemCountNumbers[0].extent = new Vector(43, 55);
|
||||
|
||||
|
|
@ -316,27 +314,22 @@ class PlayGui {
|
|||
// gemImageObject.matNameOverride.set("base.gem", "base.gem.");
|
||||
gemImageObject.ambientSpinFactor /= -2;
|
||||
// ["base.gem"] = color + ".gem";
|
||||
ResourceLoader.load("shapes/items/gem.dts").entry.load(() -> {
|
||||
ResourceLoader.load("shapes/items/" + gemColor + ".gem.png").entry.load(() -> {
|
||||
gemImageObject.init(null, () -> {
|
||||
for (mat in gemImageObject.materials) {
|
||||
mat.mainPass.enableLights = false;
|
||||
gemImageObject.init(null, () -> {});
|
||||
|
||||
// Huge hacks
|
||||
if (mat.blendMode != Add) {
|
||||
var alphaShader = new h3d.shader.AlphaChannel();
|
||||
mat.mainPass.addShader(alphaShader);
|
||||
}
|
||||
}
|
||||
gemImageScene.addChild(gemImageObject);
|
||||
var gemImageCenter = gemImageObject.getBounds().getCenter();
|
||||
for (mat in gemImageObject.materials) {
|
||||
mat.mainPass.enableLights = false;
|
||||
|
||||
gemImageScene.camera.pos = new Vector(0, 3, gemImageCenter.z);
|
||||
gemImageScene.camera.target = new Vector(gemImageCenter.x, gemImageCenter.y, gemImageCenter.z);
|
||||
onFinish();
|
||||
});
|
||||
});
|
||||
});
|
||||
// Huge hacks
|
||||
if (mat.blendMode != Add) {
|
||||
var alphaShader = new h3d.shader.AlphaChannel();
|
||||
mat.mainPass.addShader(alphaShader);
|
||||
}
|
||||
}
|
||||
gemImageScene.addChild(gemImageObject);
|
||||
var gemImageCenter = gemImageObject.getBounds().getCenter();
|
||||
|
||||
gemImageScene.camera.pos = new Vector(0, 3, gemImageCenter.z);
|
||||
gemImageScene.camera.target = new Vector(gemImageCenter.x, gemImageCenter.y, gemImageCenter.z);
|
||||
}
|
||||
|
||||
function initPowerupBox() {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue