Add next level button as well

This commit is contained in:
Terry Hearst 2023-02-05 21:56:47 -05:00
parent 73b70ab6ab
commit 7f000d8021
2 changed files with 14 additions and 14 deletions

View file

@ -1670,10 +1670,6 @@ class MarbleWorld extends Scheduler {
if (Util.isTouchDevice()) {
MarbleGame.instance.touchInput.hideControls(@:privateAccess this.playGui.playGuiCtrl);
}
if (this.isRecording) {
this.isRecording = false; // Stop recording here if we haven't already
this.clearScheduleId("stopRecordingTimeout");
}
var endGameCode = () -> {
this.dispose();
var pmg = new PlayMissionGui();
@ -1701,9 +1697,6 @@ class MarbleWorld extends Scheduler {
}
// @:privateAccess playGui.playGuiCtrl.render(scene2d);
}
if (this.isRecording) {
this.clearScheduleId("stopRecordingTimeout");
}
if (MarbleGame.instance.toRecord) {
MarbleGame.canvas.pushDialog(new ReplayNameDlg(() -> {
this.isRecording = true;
@ -1712,6 +1705,18 @@ class MarbleWorld extends Scheduler {
} else {
restartGameCode();
}
}, (sender) -> {
var nextLevelCode = () -> {
var nextMission = mission.getNextMission();
if (nextMission != null) {
MarbleGame.instance.playMission(nextMission);
}
}
if (MarbleGame.instance.toRecord) {
MarbleGame.canvas.pushDialog(new ReplayNameDlg(nextLevelCode));
} else {
nextLevelCode();
}
}, mission, finishTime);
MarbleGame.canvas.pushDialog(egg);
this.setCursorLock(false);

View file

@ -18,7 +18,7 @@ class EndGameGui extends GuiControl {
var scoreSubmitted:Bool = false;
public function new(continueFunc:GuiControl->Void, restartFunc:GuiControl->Void, mission:Mission, timeState:TimeState) {
public function new(continueFunc:GuiControl->Void, restartFunc:GuiControl->Void, nextLevelFunc:GuiControl->Void, mission:Mission, timeState:TimeState) {
super();
this.horizSizing = Width;
this.vertSizing = Height;
@ -77,12 +77,7 @@ class EndGameGui extends GuiControl {
nextLevelBtn.vertSizing = Height;
nextLevelBtn.position = new Vector(0, 0);
nextLevelBtn.extent = new Vector(130, 110);
nextLevelBtn.pressedAction = (e) -> {
var nextMission = mission.getNextMission();
if (nextMission != null) {
cast(this.parent, Canvas).marbleGame.playMission(nextMission);
}
};
nextLevelBtn.pressedAction = (e) -> nextLevelFunc(nextLevelBtn);
nextLevel.addChild(nextLevelBtn);
function setButtonStates(enabled:Bool) {