diff --git a/libs/core.js b/libs/core.js index 0acf5b6f..58c47c54 100644 --- a/libs/core.js +++ b/libs/core.js @@ -3936,6 +3936,20 @@ core.prototype.isset = function (val) { return true } +////// 下载文件 ////// +core.prototype.download = function (filename, content) { + + // 检测是否浏览器 + + var aLink = document.createElement('a'); + var blob = new Blob([content]); + var evt = document.createEvent("HTMLEvents"); + evt.initEvent("click", false, false); + aLink.download = fileName; + aLink.href = URL.createObjectURL(blob); + aLink.dispatchEvent(evt); +} + ////// 播放背景音乐 ////// core.prototype.playBgm = function (bgm) { diff --git a/libs/events.js b/libs/events.js index 75b872d6..a1e31d9e 100644 --- a/libs/events.js +++ b/libs/events.js @@ -119,7 +119,7 @@ events.prototype.win = function(reason) { core.drawText([ "\t[结局2]恭喜通关!你的分数是${status:hp}。" ], function () { - core.restart(); + core.events.gameOver(); }) }); } @@ -130,11 +130,38 @@ events.prototype.lose = function(reason) { core.drawText([ "\t[结局1]你死了。\n如题。" ], function () { - core.restart(); + core.events.gameOver(); }); }) } +////// 游戏结束 ////// +events.prototype.gameOver = function () { + + // 上传成绩 + var confirmUpload = function () { + + + + } + + // 下载录像 + var confirmDownload = function () { + core.drawConfirmBox("你想下载录像吗?", function () { + + // 检测是否微信浏览器 + if () + + + }, function () { + confirmUpload(); + }) + } + + confirmDownload(); + +} + ////// 转换楼层结束的事件 ////// events.prototype.afterChangeFloor = function (floorId) { if (core.isset(core.status.event.id)) return; // 当前存在事件