mirror of
https://github.com/RandomityGuy/MBHaxe.git
synced 2025-10-30 08:11:25 +00:00
Slightly nicer name for replays
This commit is contained in:
parent
6b1fa90f85
commit
06200f1c22
1 changed files with 5 additions and 2 deletions
|
|
@ -1403,6 +1403,9 @@ class MarbleWorld extends Scheduler {
|
||||||
|
|
||||||
public function saveReplay() {
|
public function saveReplay() {
|
||||||
var replayBytes = this.replay.write();
|
var replayBytes = this.replay.write();
|
||||||
|
var defaultFilename = '${this.mission.title} ${
|
||||||
|
this.finishTime == null ? "Unfinished Run" : Std.string(this.finishTime.gameplayClock)
|
||||||
|
}.mbr';
|
||||||
#if hl
|
#if hl
|
||||||
hxd.File.saveAs(replayBytes, {
|
hxd.File.saveAs(replayBytes, {
|
||||||
title: 'Save Replay',
|
title: 'Save Replay',
|
||||||
|
|
@ -1412,7 +1415,7 @@ class MarbleWorld extends Scheduler {
|
||||||
extensions: ["mbr"]
|
extensions: ["mbr"]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
defaultPath: '${this.mission.title}${this.timeState.gameplayClock}.mbr'
|
defaultPath: defaultFilename
|
||||||
});
|
});
|
||||||
#end
|
#end
|
||||||
#if js
|
#if js
|
||||||
|
|
@ -1420,7 +1423,7 @@ class MarbleWorld extends Scheduler {
|
||||||
type: 'application/octet-stream'
|
type: 'application/octet-stream'
|
||||||
});
|
});
|
||||||
var url = js.html.URL.createObjectURL(blob);
|
var url = js.html.URL.createObjectURL(blob);
|
||||||
var fname = '${this.mission.title}${this.timeState.gameplayClock}.mbr';
|
var fname = defaultFilename;
|
||||||
var element = js.Browser.document.createElement('a');
|
var element = js.Browser.document.createElement('a');
|
||||||
element.setAttribute('href', url);
|
element.setAttribute('href', url);
|
||||||
element.setAttribute('download', fname);
|
element.setAttribute('download', fname);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue