mirror of
https://github.com/RandomityGuy/MBHaxe.git
synced 2026-04-28 05:31:37 +00:00
some fixes
This commit is contained in:
parent
97f9e7dbad
commit
8f3e7e4946
6 changed files with 82 additions and 11 deletions
|
|
@ -69,7 +69,6 @@ class MarbleGame {
|
||||||
if (!paused && world != null) {
|
if (!paused && world != null) {
|
||||||
if (world.finishTime == null && world._ready) {
|
if (world.finishTime == null && world._ready) {
|
||||||
if (js.Browser.document.pointerLockElement != @:privateAccess Window.getInstance().canvas) {
|
if (js.Browser.document.pointerLockElement != @:privateAccess Window.getInstance().canvas) {
|
||||||
paused = true;
|
|
||||||
handlePauseGame();
|
handlePauseGame();
|
||||||
// Focus the shit again
|
// Focus the shit again
|
||||||
var jsCanvas = @:privateAccess Window.getInstance().canvas;
|
var jsCanvas = @:privateAccess Window.getInstance().canvas;
|
||||||
|
|
|
||||||
|
|
@ -1455,8 +1455,8 @@ class MarbleWorld extends Scheduler {
|
||||||
}
|
}
|
||||||
var endGameCode = () -> {
|
var endGameCode = () -> {
|
||||||
this.dispose();
|
this.dispose();
|
||||||
var pmg = new LevelSelectGui(["beginner", "intermediate", "advanced", "multiplayer"][mission.difficultyIndex]);
|
|
||||||
LevelSelectGui.currentSelectionStatic = mission.index + 1;
|
LevelSelectGui.currentSelectionStatic = mission.index + 1;
|
||||||
|
var pmg = new LevelSelectGui(["beginner", "intermediate", "advanced", "multiplayer"][mission.difficultyIndex]);
|
||||||
MarbleGame.canvas.setContent(pmg);
|
MarbleGame.canvas.setContent(pmg);
|
||||||
#if js
|
#if js
|
||||||
pointercontainer.hidden = false;
|
pointercontainer.hidden = false;
|
||||||
|
|
|
||||||
|
|
@ -83,7 +83,7 @@ class ExitGameDlg extends GuiImage {
|
||||||
MarbleGame.canvas.popDialog(this);
|
MarbleGame.canvas.popDialog(this);
|
||||||
MarbleGame.canvas.pushDialog(new OptionsListGui(true));
|
MarbleGame.canvas.pushDialog(new OptionsListGui(true));
|
||||||
}, 20);
|
}, 20);
|
||||||
btnList.addButton(2, "Leaderboards", (evt) -> {});
|
// btnList.addButton(2, "Leaderboards", (evt) -> {});
|
||||||
btnList.addButton(2, "Achievements", (evt) -> {
|
btnList.addButton(2, "Achievements", (evt) -> {
|
||||||
MarbleGame.canvas.popDialog(this);
|
MarbleGame.canvas.popDialog(this);
|
||||||
MarbleGame.canvas.pushDialog(new AchievementsGui(true));
|
MarbleGame.canvas.pushDialog(new AchievementsGui(true));
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,8 @@ class LevelSelectGui extends GuiImage {
|
||||||
return arial14;
|
return arial14;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MarbleGame.instance.toRecord = false;
|
||||||
|
|
||||||
var fadeEdge = new GuiImage(ResourceLoader.getResource("data/ui/xbox/BG_fadeOutSoftEdge.png", ResourceLoader.getImage, this.imageResources).toTile());
|
var fadeEdge = new GuiImage(ResourceLoader.getResource("data/ui/xbox/BG_fadeOutSoftEdge.png", ResourceLoader.getImage, this.imageResources).toTile());
|
||||||
fadeEdge.position = new Vector(0, 0);
|
fadeEdge.position = new Vector(0, 0);
|
||||||
fadeEdge.extent = new Vector(640, 480);
|
fadeEdge.extent = new Vector(640, 480);
|
||||||
|
|
@ -69,6 +71,8 @@ class LevelSelectGui extends GuiImage {
|
||||||
currentDifficultyStatic = difficulty;
|
currentDifficultyStatic = difficulty;
|
||||||
|
|
||||||
var difficultyMissions = MissionList.missionList['ultra'][currentDifficultyStatic];
|
var difficultyMissions = MissionList.missionList['ultra'][currentDifficultyStatic];
|
||||||
|
if (currentSelectionStatic >= difficultyMissions.length)
|
||||||
|
currentSelectionStatic = 0;
|
||||||
var curMission = difficultyMissions[currentSelectionStatic];
|
var curMission = difficultyMissions[currentSelectionStatic];
|
||||||
|
|
||||||
var lock = true;
|
var lock = true;
|
||||||
|
|
@ -151,11 +155,11 @@ class LevelSelectGui extends GuiImage {
|
||||||
}
|
}
|
||||||
bottomBar.addChild(recordButton);
|
bottomBar.addChild(recordButton);
|
||||||
|
|
||||||
var lbButton = new GuiXboxButton("Leaderboard", 220);
|
// var lbButton = new GuiXboxButton("Leaderboard", 220);
|
||||||
lbButton.position = new Vector(750, 0);
|
// lbButton.position = new Vector(750, 0);
|
||||||
lbButton.vertSizing = Bottom;
|
// lbButton.vertSizing = Bottom;
|
||||||
lbButton.horizSizing = Right;
|
// lbButton.horizSizing = Right;
|
||||||
bottomBar.addChild(lbButton);
|
// bottomBar.addChild(lbButton);
|
||||||
|
|
||||||
var nextButton = new GuiXboxButton("Play", 160);
|
var nextButton = new GuiXboxButton("Play", 160);
|
||||||
nextButton.position = new Vector(960, 0);
|
nextButton.position = new Vector(960, 0);
|
||||||
|
|
|
||||||
|
|
@ -63,7 +63,7 @@ class MainMenuGui extends GuiImage {
|
||||||
btnList.addButton(0, "Single Player Game", (sender) -> {
|
btnList.addButton(0, "Single Player Game", (sender) -> {
|
||||||
cast(this.parent, Canvas).setContent(new DifficultySelectGui());
|
cast(this.parent, Canvas).setContent(new DifficultySelectGui());
|
||||||
});
|
});
|
||||||
btnList.addButton(2, "Leaderboards", (e) -> {}, 20);
|
// btnList.addButton(2, "Leaderboards", (e) -> {}, 20);
|
||||||
btnList.addButton(2, "Achievements", (e) -> {
|
btnList.addButton(2, "Achievements", (e) -> {
|
||||||
cast(this.parent, Canvas).setContent(new AchievementsGui());
|
cast(this.parent, Canvas).setContent(new AchievementsGui());
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -72,6 +72,7 @@ class PlayGui {
|
||||||
var playGuiCtrl:GuiControl;
|
var playGuiCtrl:GuiControl;
|
||||||
|
|
||||||
var resizeEv:Void->Void;
|
var resizeEv:Void->Void;
|
||||||
|
var resizeControlEvents:Array<Void->Void> = [];
|
||||||
|
|
||||||
var _init:Bool;
|
var _init:Bool;
|
||||||
|
|
||||||
|
|
@ -153,14 +154,28 @@ class PlayGui {
|
||||||
playGuiCtrlOuter.render(scene2d);
|
playGuiCtrlOuter.render(scene2d);
|
||||||
|
|
||||||
resizeEv = () -> {
|
resizeEv = () -> {
|
||||||
var wnd = Window.getInstance();
|
var safeVerMargin = 1 + (scene2d.height * 0.15) / 2;
|
||||||
powerupBox.position.x = wnd.width * 469.0 / 640.0;
|
var safeHorMargin = 1 + (scene2d.width * 0.15) / 2;
|
||||||
|
playGuiCtrl.position = new Vector(safeHorMargin, safeVerMargin);
|
||||||
|
|
||||||
|
var subX = 640 - (scene2d.width - safeHorMargin * 2) * 640 / scene2d.width;
|
||||||
|
var subY = 480 - (scene2d.height - safeVerMargin * 2) * 480 / scene2d.height;
|
||||||
|
|
||||||
|
playGuiCtrl.extent = new Vector(640 - subX, 480 - subY);
|
||||||
|
resizeControls();
|
||||||
|
|
||||||
playGuiCtrlOuter.render(MarbleGame.canvas.scene2d);
|
playGuiCtrlOuter.render(MarbleGame.canvas.scene2d);
|
||||||
};
|
};
|
||||||
|
|
||||||
Window.getInstance().addResizeEvent(resizeEv);
|
Window.getInstance().addResizeEvent(resizeEv);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function resizeControls() {
|
||||||
|
for (resizeControl in resizeControlEvents) {
|
||||||
|
resizeControl();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public function initTimer() {
|
public function initTimer() {
|
||||||
var safeVerMargin = 1 + (scene2d.height * 0.15) / 2;
|
var safeVerMargin = 1 + (scene2d.height * 0.15) / 2;
|
||||||
|
|
||||||
|
|
@ -237,6 +252,21 @@ class PlayGui {
|
||||||
innerCtrl.addChild(timerNumbers[5]);
|
innerCtrl.addChild(timerNumbers[5]);
|
||||||
// innerCtrl.addChild(timerNumbers[6]);
|
// innerCtrl.addChild(timerNumbers[6]);
|
||||||
|
|
||||||
|
resizeControlEvents.push(() -> {
|
||||||
|
var safeVerMargin = 1 + (scene2d.height * 0.15) / 2;
|
||||||
|
innerCtrl.xScale = (scene2d.height - safeVerMargin * 2) / 480;
|
||||||
|
innerCtrl.yScale = (scene2d.height - safeVerMargin * 2) / 480;
|
||||||
|
for (i in 0...6) {
|
||||||
|
timerNumbers[i].xScale = (scene2d.height - safeVerMargin * 2) / 480;
|
||||||
|
timerNumbers[i].yScale = (scene2d.height - safeVerMargin * 2) / 480;
|
||||||
|
}
|
||||||
|
timerColon.xScale = (scene2d.height - safeVerMargin * 2) / 480;
|
||||||
|
timerColon.yScale = (scene2d.height - safeVerMargin * 2) / 480;
|
||||||
|
|
||||||
|
timerPoint.xScale = (scene2d.height - safeVerMargin * 2) / 480;
|
||||||
|
timerPoint.yScale = (scene2d.height - safeVerMargin * 2) / 480;
|
||||||
|
});
|
||||||
|
|
||||||
playGuiCtrl.addChild(timerCtrl);
|
playGuiCtrl.addChild(timerCtrl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -318,6 +348,20 @@ class PlayGui {
|
||||||
innerCtrl.addChild(gemCountNumbers[5]);
|
innerCtrl.addChild(gemCountNumbers[5]);
|
||||||
innerCtrl.addChild(gemHUD);
|
innerCtrl.addChild(gemHUD);
|
||||||
|
|
||||||
|
resizeControlEvents.push(() -> {
|
||||||
|
var safeVerMargin = 1 + (scene2d.height * 0.15) / 2;
|
||||||
|
gemBox.xScale = (scene2d.height - safeVerMargin * 2) / 480;
|
||||||
|
gemBox.yScale = (scene2d.height - safeVerMargin * 2) / 480;
|
||||||
|
innerCtrl.xScale = (scene2d.height - safeVerMargin * 2) / 480;
|
||||||
|
innerCtrl.yScale = (scene2d.height - safeVerMargin * 2) / 480;
|
||||||
|
for (i in 0...6) {
|
||||||
|
gemCountNumbers[i].xScale = (scene2d.height - safeVerMargin * 2) / 480;
|
||||||
|
gemCountNumbers[i].yScale = (scene2d.height - safeVerMargin * 2) / 480;
|
||||||
|
}
|
||||||
|
gemHUD.xScale = (scene2d.height - safeVerMargin * 2) / 480;
|
||||||
|
gemHUD.yScale = (scene2d.height - safeVerMargin * 2) / 480;
|
||||||
|
});
|
||||||
|
|
||||||
playGuiCtrl.addChild(gemBox);
|
playGuiCtrl.addChild(gemBox);
|
||||||
// gemImageSceneTargetBitmap.blendMode = None;
|
// gemImageSceneTargetBitmap.blendMode = None;
|
||||||
// gemImageSceneTargetBitmap.addShader(new ColorKey());
|
// gemImageSceneTargetBitmap.addShader(new ColorKey());
|
||||||
|
|
@ -343,6 +387,13 @@ class PlayGui {
|
||||||
powerupBox.xScale = (scene2d.height - safeVerMargin * 2) / 480;
|
powerupBox.xScale = (scene2d.height - safeVerMargin * 2) / 480;
|
||||||
powerupBox.yScale = (scene2d.height - safeVerMargin * 2) / 480;
|
powerupBox.yScale = (scene2d.height - safeVerMargin * 2) / 480;
|
||||||
|
|
||||||
|
resizeControlEvents.push(() -> {
|
||||||
|
var safeVerMargin = 1 + (scene2d.height * 0.15) / 2;
|
||||||
|
powerupBox.position = new Vector(playGuiCtrl.extent.x - 171, 0);
|
||||||
|
powerupBox.xScale = (scene2d.height - safeVerMargin * 2) / 480;
|
||||||
|
powerupBox.yScale = (scene2d.height - safeVerMargin * 2) / 480;
|
||||||
|
});
|
||||||
|
|
||||||
playGuiCtrl.addChild(powerupBox);
|
playGuiCtrl.addChild(powerupBox);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -436,6 +487,11 @@ class PlayGui {
|
||||||
|
|
||||||
playGuiCtrlOuter.addChild(helpTextCtrl);
|
playGuiCtrlOuter.addChild(helpTextCtrl);
|
||||||
playGuiCtrlOuter.addChild(alertTextCtrl);
|
playGuiCtrlOuter.addChild(alertTextCtrl);
|
||||||
|
|
||||||
|
resizeControlEvents.push(() -> {
|
||||||
|
helpTextCtrl.position = new Vector(0, playGuiCtrl.extent.y * 190 / 480);
|
||||||
|
alertTextCtrl.position = new Vector(0, playGuiCtrl.extent.y * 375 / 480);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function initFPSMeter() {
|
function initFPSMeter() {
|
||||||
|
|
@ -501,6 +557,18 @@ class PlayGui {
|
||||||
blastFrame.xScale = (scene2d.height - safeVerMargin * 2) / 480;
|
blastFrame.xScale = (scene2d.height - safeVerMargin * 2) / 480;
|
||||||
blastFrame.yScale = (scene2d.height - safeVerMargin * 2) / 480;
|
blastFrame.yScale = (scene2d.height - safeVerMargin * 2) / 480;
|
||||||
blastBar.addChild(blastFrame);
|
blastBar.addChild(blastFrame);
|
||||||
|
|
||||||
|
resizeControlEvents.push(() -> {
|
||||||
|
var safeVerMargin = 1 + (scene2d.height * 0.15) / 2;
|
||||||
|
blastBar.xScale = (scene2d.height - safeVerMargin * 2) / 480;
|
||||||
|
blastBar.yScale = (scene2d.height - safeVerMargin * 2) / 480;
|
||||||
|
blastFill.xScale = (scene2d.height - safeVerMargin * 2) / 480;
|
||||||
|
blastFill.yScale = (scene2d.height - safeVerMargin * 2) / 480;
|
||||||
|
blastFillUltra.xScale = (scene2d.height - safeVerMargin * 2) / 480;
|
||||||
|
blastFillUltra.yScale = (scene2d.height - safeVerMargin * 2) / 480;
|
||||||
|
blastFrame.xScale = (scene2d.height - safeVerMargin * 2) / 480;
|
||||||
|
blastFrame.yScale = (scene2d.height - safeVerMargin * 2) / 480;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
var blastValue:Float = 0;
|
var blastValue:Float = 0;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue