Download
This commit is contained in:
parent
290f2ddb1a
commit
c3da5c5e1c
14
libs/core.js
14
libs/core.js
@ -3936,6 +3936,20 @@ core.prototype.isset = function (val) {
|
|||||||
return true
|
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) {
|
core.prototype.playBgm = function (bgm) {
|
||||||
|
|
||||||
|
|||||||
@ -119,7 +119,7 @@ events.prototype.win = function(reason) {
|
|||||||
core.drawText([
|
core.drawText([
|
||||||
"\t[结局2]恭喜通关!你的分数是${status:hp}。"
|
"\t[结局2]恭喜通关!你的分数是${status:hp}。"
|
||||||
], function () {
|
], function () {
|
||||||
core.restart();
|
core.events.gameOver();
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -130,11 +130,38 @@ events.prototype.lose = function(reason) {
|
|||||||
core.drawText([
|
core.drawText([
|
||||||
"\t[结局1]你死了。\n如题。"
|
"\t[结局1]你死了。\n如题。"
|
||||||
], function () {
|
], 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) {
|
events.prototype.afterChangeFloor = function (floorId) {
|
||||||
if (core.isset(core.status.event.id)) return; // 当前存在事件
|
if (core.isset(core.status.event.id)) return; // 当前存在事件
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user