diff --git a/src/MarbleWorld.hx b/src/MarbleWorld.hx index b8f3c281..3a5f67c6 100644 --- a/src/MarbleWorld.hx +++ b/src/MarbleWorld.hx @@ -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); diff --git a/src/gui/EndGameGui.hx b/src/gui/EndGameGui.hx index 4e82a844..67591c51 100644 --- a/src/gui/EndGameGui.hx +++ b/src/gui/EndGameGui.hx @@ -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) {