浏览地图时进行标记;数据统计部分楼层

This commit is contained in:
ckcz123 2020-06-15 12:03:31 +08:00
parent 11d1e18a37
commit 68fd076b06
5 changed files with 23 additions and 7 deletions

View File

@ -2015,9 +2015,6 @@ var terndefs_f6783a0a_522d_417e_8407_94c67b692e50 = [
"number2Block": {
"!doc": "数字到图块对象的对应关系"
},
"openingDoor": {
"!doc": "正在开关的门"
},
"played": {
"!type": "bool",
"!doc": "当前是否游戏中(不包括标题画面和录像回放)"

View File

@ -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();

View File

@ -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 = {};
}

View File

@ -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) {

1
runtime.d.ts vendored
View File

@ -225,7 +225,6 @@ type gameStatus = {
font: string
}
curtainColor: null
openingDoor: null
// 动画
globalAnimateObjs: []