mirror of
https://github.com/RandomityGuy/MBHaxe.git
synced 2026-03-07 20:41:09 +00:00
More natual replay saving system
This commit is contained in:
parent
7059a63ab8
commit
ed0d4fa9c1
1 changed files with 22 additions and 5 deletions
|
|
@ -132,6 +132,7 @@ class MarbleWorld extends Scheduler {
|
|||
// Replay
|
||||
public var replay:Replay;
|
||||
public var isWatching:Bool = false;
|
||||
public var wasRecording:Bool = false;
|
||||
public var isRecording:Bool = false;
|
||||
|
||||
// Loading
|
||||
|
|
@ -155,7 +156,7 @@ class MarbleWorld extends Scheduler {
|
|||
this.scene2d = scene2d;
|
||||
this.mission = mission;
|
||||
this.replay = new Replay(mission.path);
|
||||
this.isRecording = record;
|
||||
this.isRecording = this.wasRecording = record;
|
||||
}
|
||||
|
||||
public function init() {
|
||||
|
|
@ -1231,7 +1232,8 @@ class MarbleWorld extends Scheduler {
|
|||
this.finishYaw = this.marble.camera.CameraYaw;
|
||||
this.finishPitch = this.marble.camera.CameraPitch;
|
||||
displayAlert("Congratulations! You've finished!");
|
||||
this.schedule(this.timeState.currentAttemptTime + 2, () -> cast showFinishScreen());
|
||||
if (!this.isWatching)
|
||||
this.schedule(this.timeState.currentAttemptTime + 2, () -> cast showFinishScreen());
|
||||
// Stop the ongoing sounds
|
||||
if (timeTravelSound != null) {
|
||||
timeTravelSound.stop();
|
||||
|
|
@ -1241,15 +1243,16 @@ class MarbleWorld extends Scheduler {
|
|||
}
|
||||
|
||||
function showFinishScreen() {
|
||||
if (this.isWatching)
|
||||
return 0;
|
||||
var egg:EndGameGui = null;
|
||||
#if js
|
||||
var pointercontainer = js.Browser.document.querySelector("#pointercontainer");
|
||||
pointercontainer.hidden = false;
|
||||
#end
|
||||
if (this.isRecording) {
|
||||
this.schedule(this.timeState.currentAttemptTime + 3, () -> {
|
||||
this.isRecording = false; // Stop recording here
|
||||
this.saveReplay();
|
||||
}
|
||||
}, "stopRecordingTimeout");
|
||||
if (Util.isTouchDevice()) {
|
||||
MarbleGame.instance.touchInput.setControlsEnabled(false);
|
||||
}
|
||||
|
|
@ -1257,6 +1260,13 @@ 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");
|
||||
}
|
||||
if (this.wasRecording) {
|
||||
this.saveReplay();
|
||||
}
|
||||
this.dispose();
|
||||
var pmg = new PlayMissionGui();
|
||||
PlayMissionGui.currentSelectionStatic = mission.index + 1;
|
||||
|
|
@ -1266,6 +1276,13 @@ class MarbleWorld extends Scheduler {
|
|||
#end
|
||||
}, (sender) -> {
|
||||
MarbleGame.canvas.popDialog(egg);
|
||||
if (this.isRecording) {
|
||||
this.clearScheduleId("stopRecordingTimeout");
|
||||
}
|
||||
if (this.wasRecording) {
|
||||
this.saveReplay();
|
||||
this.isRecording = true;
|
||||
}
|
||||
this.setCursorLock(true);
|
||||
this.restart();
|
||||
#if js
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue