From b04b45070f2ae8f88d4821ca0c052cbebd08fd3f Mon Sep 17 00:00:00 2001 From: oc Date: Sun, 6 May 2018 21:11:56 +0800 Subject: [PATCH] competition mode --- _server/editor.js | 2 ++ editor.html | 1 + libs/events.js | 17 ++++++++++++++--- main.js | 2 ++ 4 files changed, 19 insertions(+), 3 deletions(-) diff --git a/_server/editor.js b/_server/editor.js index 7abc4d7e..db7bf80b 100644 --- a/_server/editor.js +++ b/_server/editor.js @@ -193,6 +193,8 @@ editor.prototype.drawMapBg = function (img) { } } +editor.prototype + editor.prototype.updateMap = function () { var blocks = main.editor.mapIntoBlocks(editor.map.map(function (v) { return v.map(function (v) { diff --git a/editor.html b/editor.html index 2a0bf05c..58891068 100644 --- a/editor.html +++ b/editor.html @@ -203,6 +203,7 @@ +
diff --git a/libs/events.js b/libs/events.js index d1d82eee..cae460c5 100644 --- a/libs/events.js +++ b/libs/events.js @@ -189,7 +189,10 @@ events.prototype.gameOver = function (ending, fromReplay) { formData.append('seed', core.getFlag('seed')); formData.append('route', core.encodeRoute(core.status.route)); - core.http("POST", "/games/upload.php", formData); + if (main.isCompetition) + core.http("POST", "/games/competition/upload.php", formData); + else + core.http("POST", "/games/upload.php", formData); setTimeout(function() { confirmDownload(); @@ -197,9 +200,17 @@ events.prototype.gameOver = function (ending, fromReplay) { } core.ui.drawConfirmBox("你想记录你的ID和成绩吗?", function () { - doUpload(prompt("请输入你的ID:")); + if (main.isCompetition) { + doUpload(""); + } + else { + doUpload(prompt("请输入你的ID:")); + } }, function () { - doUpload(undefined); + if (main.isCompetition) + confirmDownload(); + else + doUpload(undefined); }) return; diff --git a/main.js b/main.js index 3fe630bc..6ca25046 100644 --- a/main.js +++ b/main.js @@ -12,6 +12,8 @@ function main() { this.bgmRemote = false; // 是否采用远程BGM this.bgmRemoteRoot = "https://gitee.com/ckcz123/h5music/raw/master/"; // 远程BGM的根目录 + this.isCompetition = false; // 是否是比赛模式 + //------------------------ 用户修改内容 END ------------------------// this.dom = {