mirror of
https://github.com/RandomityGuy/MBHaxe.git
synced 2026-04-27 13:11:42 +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
|
// Replay
|
||||||
public var replay:Replay;
|
public var replay:Replay;
|
||||||
public var isWatching:Bool = false;
|
public var isWatching:Bool = false;
|
||||||
|
public var wasRecording:Bool = false;
|
||||||
public var isRecording:Bool = false;
|
public var isRecording:Bool = false;
|
||||||
|
|
||||||
// Loading
|
// Loading
|
||||||
|
|
@ -155,7 +156,7 @@ class MarbleWorld extends Scheduler {
|
||||||
this.scene2d = scene2d;
|
this.scene2d = scene2d;
|
||||||
this.mission = mission;
|
this.mission = mission;
|
||||||
this.replay = new Replay(mission.path);
|
this.replay = new Replay(mission.path);
|
||||||
this.isRecording = record;
|
this.isRecording = this.wasRecording = record;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function init() {
|
public function init() {
|
||||||
|
|
@ -1231,7 +1232,8 @@ class MarbleWorld extends Scheduler {
|
||||||
this.finishYaw = this.marble.camera.CameraYaw;
|
this.finishYaw = this.marble.camera.CameraYaw;
|
||||||
this.finishPitch = this.marble.camera.CameraPitch;
|
this.finishPitch = this.marble.camera.CameraPitch;
|
||||||
displayAlert("Congratulations! You've finished!");
|
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
|
// Stop the ongoing sounds
|
||||||
if (timeTravelSound != null) {
|
if (timeTravelSound != null) {
|
||||||
timeTravelSound.stop();
|
timeTravelSound.stop();
|
||||||
|
|
@ -1241,15 +1243,16 @@ class MarbleWorld extends Scheduler {
|
||||||
}
|
}
|
||||||
|
|
||||||
function showFinishScreen() {
|
function showFinishScreen() {
|
||||||
|
if (this.isWatching)
|
||||||
|
return 0;
|
||||||
var egg:EndGameGui = null;
|
var egg:EndGameGui = null;
|
||||||
#if js
|
#if js
|
||||||
var pointercontainer = js.Browser.document.querySelector("#pointercontainer");
|
var pointercontainer = js.Browser.document.querySelector("#pointercontainer");
|
||||||
pointercontainer.hidden = false;
|
pointercontainer.hidden = false;
|
||||||
#end
|
#end
|
||||||
if (this.isRecording) {
|
this.schedule(this.timeState.currentAttemptTime + 3, () -> {
|
||||||
this.isRecording = false; // Stop recording here
|
this.isRecording = false; // Stop recording here
|
||||||
this.saveReplay();
|
}, "stopRecordingTimeout");
|
||||||
}
|
|
||||||
if (Util.isTouchDevice()) {
|
if (Util.isTouchDevice()) {
|
||||||
MarbleGame.instance.touchInput.setControlsEnabled(false);
|
MarbleGame.instance.touchInput.setControlsEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
@ -1257,6 +1260,13 @@ class MarbleWorld extends Scheduler {
|
||||||
if (Util.isTouchDevice()) {
|
if (Util.isTouchDevice()) {
|
||||||
MarbleGame.instance.touchInput.hideControls(@:privateAccess this.playGui.playGuiCtrl);
|
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();
|
this.dispose();
|
||||||
var pmg = new PlayMissionGui();
|
var pmg = new PlayMissionGui();
|
||||||
PlayMissionGui.currentSelectionStatic = mission.index + 1;
|
PlayMissionGui.currentSelectionStatic = mission.index + 1;
|
||||||
|
|
@ -1266,6 +1276,13 @@ class MarbleWorld extends Scheduler {
|
||||||
#end
|
#end
|
||||||
}, (sender) -> {
|
}, (sender) -> {
|
||||||
MarbleGame.canvas.popDialog(egg);
|
MarbleGame.canvas.popDialog(egg);
|
||||||
|
if (this.isRecording) {
|
||||||
|
this.clearScheduleId("stopRecordingTimeout");
|
||||||
|
}
|
||||||
|
if (this.wasRecording) {
|
||||||
|
this.saveReplay();
|
||||||
|
this.isRecording = true;
|
||||||
|
}
|
||||||
this.setCursorLock(true);
|
this.setCursorLock(true);
|
||||||
this.restart();
|
this.restart();
|
||||||
#if js
|
#if js
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue