mirror of
https://github.com/webxoss/webxoss-client.git
synced 2024-11-20 05:49:55 +01:00
add save-replay button when watch replay
This commit is contained in:
parent
5e3e853583
commit
50c2c50696
7 changed files with 29 additions and 9 deletions
2
DeckEditor/Deck.min.js
vendored
2
DeckEditor/Deck.min.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
2
ImageAndDetail.min.js
vendored
2
ImageAndDetail.min.js
vendored
File diff suppressed because one or more lines are too long
4
Localize.min.js
vendored
4
Localize.min.js
vendored
File diff suppressed because one or more lines are too long
|
@ -988,6 +988,7 @@ function playReplayContent (content) {
|
|||
if (i >= content.messagePacks.length) {
|
||||
$('button-replay-auto').onclick = null;
|
||||
$('button-replay-step').onclick = null;
|
||||
$('button-replay-save').onclick = null;
|
||||
if (content.surrender) {
|
||||
if (content.win) {
|
||||
game.win(true);
|
||||
|
@ -1014,6 +1015,23 @@ function playReplayContent (content) {
|
|||
}
|
||||
step();
|
||||
};
|
||||
$('button-replay-save').onclick = function (event) {
|
||||
event.preventDefault();
|
||||
var a = document.createElement('a');
|
||||
var blob = objToBlob(createReplayObj(
|
||||
content.messagePacks,
|
||||
content.win,
|
||||
content.surrender
|
||||
));
|
||||
var url = blobToUrl(blob);
|
||||
var time = (new Date()).toISOString().replace('T',' ').substr(0,19).replace(/:/g,'-');
|
||||
var filename = time + '.wxrep';
|
||||
a.href = url;
|
||||
a.download = filename;
|
||||
a.click();
|
||||
window.URL.revokeObjectURL(url);
|
||||
};
|
||||
|
||||
function step () {
|
||||
if (!idle) return;
|
||||
idle = false;
|
||||
|
|
|
@ -146,7 +146,9 @@
|
|||
<!-- <canvas id="BattleFieldCanvas" width="576" height="734"></canvas> -->
|
||||
</div>
|
||||
<div id="div-replay-controls" style="display: none;">
|
||||
<button id="button-replay-step">下一步</button> <button id="button-replay-auto">自动播放</button>
|
||||
<button id="button-replay-step">下一步</button>
|
||||
<button id="button-replay-auto">自动播放</button>
|
||||
<button id="button-replay-save">保存录像</button>
|
||||
</div>
|
||||
<div id="div-surrender">
|
||||
<span id="span-surrender">投降</span>
|
||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue