From 68fd076b06892ad4c71ab5c7f908759a88a0107d Mon Sep 17 00:00:00 2001 From: ckcz123 Date: Mon, 15 Jun 2020 12:03:31 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B5=8F=E8=A7=88=E5=9C=B0=E5=9B=BE=E6=97=B6?= =?UTF-8?q?=E8=BF=9B=E8=A1=8C=E6=A0=87=E8=AE=B0;=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E7=BB=9F=E8=AE=A1=E9=83=A8=E5=88=86=E6=A5=BC=E5=B1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- _server/CodeMirror/defs.js | 3 --- libs/actions.js | 13 +++++++++++++ libs/core.js | 3 ++- libs/ui.js | 10 ++++++++-- runtime.d.ts | 1 - 5 files changed, 23 insertions(+), 7 deletions(-) diff --git a/_server/CodeMirror/defs.js b/_server/CodeMirror/defs.js index de2c74fb..b1e7e7bc 100644 --- a/_server/CodeMirror/defs.js +++ b/_server/CodeMirror/defs.js @@ -2015,9 +2015,6 @@ var terndefs_f6783a0a_522d_417e_8407_94c67b692e50 = [ "number2Block": { "!doc": "数字到图块对象的对应关系" }, - "openingDoor": { - "!doc": "正在开关的门" - }, "played": { "!type": "bool", "!doc": "当前是否游戏中(不包括标题画面和录像回放)" diff --git a/libs/actions.js b/libs/actions.js index c942e3a3..ff02f1a2 100644 --- a/libs/actions.js +++ b/libs/actions.js @@ -1199,6 +1199,12 @@ actions.prototype._clickViewMaps = function (x, y) { core.ui.drawMaps(index, cx, cy); return; } + if (x <= per - 2 && y >= this.SIZE + 1 - per) { + if (core.markedFloorIds[floorId]) delete core.markedFloorIds[floorId]; + else core.markedFloorIds[floorId] = true; + core.ui.drawMaps(index, cx, cy); + return; + } if (x >= this.SIZE + 1 - per && y <= per - 2) { core.status.event.data.all = !core.status.event.data.all; core.ui.drawMaps(index, cx, cy); @@ -1266,6 +1272,7 @@ actions.prototype._keyUpViewMaps = function (keycode) { core.ui.drawMaps(core.floorIds.indexOf(core.status.floorId)); return; } + var floorId = core.floorIds[core.status.event.data.index]; if (keycode == 27 || keycode == 13 || keycode == 32 || (!core.isReplaying() && keycode == 67)) { core.clearMap('data'); @@ -1282,6 +1289,12 @@ actions.prototype._keyUpViewMaps = function (keycode) { core.ui.drawMaps(core.status.event.data); return; } + if (keycode == 66) { + if (core.markedFloorIds[floorId]) delete core.markedFloorIds[floorId]; + else core.markedFloorIds[floorId] = true; + core.ui.drawMaps(core.status.event.data); + return; + } if (keycode == 88 || (core.isReplaying() && keycode == 67)) { if (core.isReplaying()) { core.bookReplay(); diff --git a/libs/core.js b/libs/core.js index b9589f12..8d39c380 100644 --- a/libs/core.js +++ b/libs/core.js @@ -202,7 +202,6 @@ function core() { "font": main.styles.font || "Verdana" }, 'curtainColor': null, - 'openingDoor': null, // 动画 'globalAnimateObjs': [], @@ -212,6 +211,8 @@ function core() { "globalAnimateStatus": 0, 'animateObjs': [], }; + // 标记的楼层列表,用于数据统计 + this.markedFloorIds = {}; this.status = {}; this.dymCanvas = {}; } diff --git a/libs/ui.js b/libs/ui.js index 7e928af2..72837533 100644 --- a/libs/ui.js +++ b/libs/ui.js @@ -2282,6 +2282,8 @@ ui.prototype.drawMaps = function (index, x, y) { var text = core.status.maps[data.floorId].title; if (!data.all && (data.mw>this.SIZE || data.mh>this.SIZE)) text+=" ["+(data.x-this.HSIZE)+","+(data.y-this.HSIZE)+"]"; + if (core.markedFloorIds[data.floorId]) + text+=" (已标记)"; var textX = 16, textY = 18, width = textX + core.calWidth('data', text) + 16, height = 42; core.fillRect('data', 5, 5, width, height, 'rgba(0,0,0,0.4)'); core.fillText('data', text, textX + 5, textY + 15, 'rgba(255,255,255,0.6)'); @@ -2302,13 +2304,14 @@ ui.prototype._drawMaps_drawHint = function () { stroke(per, this.SIZE - per - 3, 9, 3); // next stroke(0, 0, per-1, per-1); // left top stroke(this.SIZE-(per - 1), 0, per-1, per-1); // right top - // stroke(0, this.SIZE-(per-1), per-1, per-1); // left bottom + stroke(0, this.SIZE-(per-1), per-1, per-1); // left bottom core.setTextBaseline('ui', 'middle'); core.fillText('ui', "上移地图 [W]", this.HPIXEL, per * 16, '#FFD700', '20px Arial'); core.fillText('ui', "下移地图 [S]", this.HPIXEL, this.PIXEL - per * 16); core.fillText('ui', 'V', (per-1)*16, (per-1)*16); core.fillText('ui', 'Z', this.PIXEL - (per-1)*16, (per-1)*16); + core.fillText('ui', 'B', (per-1)*16, this.PIXEL - (per-1)*16); var top = this.HPIXEL - 66, left = per * 16, right = this.PIXEL - left; var lt = ["左", "移", "地", "图", "[A]"], rt = ["右", "移", "地", "图", "[D]"]; @@ -2863,6 +2866,7 @@ ui.prototype.drawStatistics = function (floorIds) { core.drawText([ this._drawStatistics_generateText(obj, "全塔", obj.total), this._drawStatistics_generateText(obj, "当前", obj.current), + this._drawStatistics_generateText(obj, "标记(浏览地图时B键或左下角)", obj.marked), "当前总步数:"+core.status.hero.steps+",当前游戏时长:"+core.formatTime(statistics.currTime) +",总游戏时长"+core.formatTime(statistics.totalTime) +"。\n瞬间移动次数:"+statistics.moveDirectly+",共计少走"+statistics.ignoreSteps+"步。" @@ -2913,13 +2917,15 @@ ui.prototype._drawStatistics_buildObj = function () { 'hp': 0, 'atk': 0, 'def': 0, 'mdef': 0 } }; - return {ids: ids, cls: cls, ext: ext, total: core.clone(obj), current: core.clone(obj)}; + return {ids: ids, cls: cls, ext: ext, total: core.clone(obj), current: core.clone(obj), marked: core.clone(obj)}; } ui.prototype._drawStatistics_add = function (floorId, obj, x1, x2, value) { obj.total[x1][x2] += value || 0; if (floorId == core.status.floorId) obj.current[x1][x2] += value || 0; + if (core.markedFloorIds[floorId]) + obj.marked[x1][x2] += value || 0; } ui.prototype._drawStatistics_floorId = function (floorId, obj) { diff --git a/runtime.d.ts b/runtime.d.ts index 57781940..4c21dfa7 100644 --- a/runtime.d.ts +++ b/runtime.d.ts @@ -225,7 +225,6 @@ type gameStatus = { font: string } curtainColor: null - openingDoor: null // 动画 globalAnimateObjs: []