修复偶数样板

This commit is contained in:
ckcz123 2021-09-03 15:31:42 +08:00
parent 9a3923a934
commit 1db6e1ad28
3 changed files with 66 additions and 58 deletions

2
.gitignore vendored
View File

@ -56,3 +56,5 @@ fabric.properties
node_modules node_modules
package-lock.json package-lock.json
_saves

View File

@ -601,7 +601,7 @@ actions.prototype.onmove = function (loc) {
this.doRegisteredAction('onmove', x, y, px, py); this.doRegisteredAction('onmove', x, y, px, py);
} }
actions.prototype._sys_onmove_choices = function (x, y) { actions.prototype._sys_onmove_choices = function (x, y, px, py) {
if (!core.status.lockControl) return false; if (!core.status.lockControl) return false;
switch (core.status.event.id) { switch (core.status.event.id) {
@ -611,7 +611,7 @@ actions.prototype._sys_onmove_choices = function (x, y) {
return true; return true;
} }
if (core.status.event.data.type == 'confirm') { if (core.status.event.data.type == 'confirm') {
this._onMoveConfirmBox(x, y); this._onMoveConfirmBox(x, y, px, py);
return true; return true;
} }
break; break;
@ -631,7 +631,7 @@ actions.prototype._sys_onmove_choices = function (x, y) {
this._onMoveChoices(x, y); this._onMoveChoices(x, y);
return true; return true;
case 'confirmBox': case 'confirmBox':
this._onMoveConfirmBox(x, y); this._onMoveConfirmBox(x, y, px, py);
return true; return true;
default: default:
break; break;
@ -793,8 +793,8 @@ actions.prototype._sys_onmousewheel = function (direct) {
// 浏览地图 // 浏览地图
if (core.status.lockControl && core.status.event.id == 'viewMaps') { if (core.status.lockControl && core.status.event.id == 'viewMaps') {
if (direct == 1) this._clickViewMaps(this.HSIZE, this.HSIZE - 3); if (direct == 1) this._clickViewMaps(this.HSIZE, this.HSIZE - 3, core.__PIXELS__ / 2, core.__PIXELS__ / 5 * 1.5);
if (direct == -1) this._clickViewMaps(this.HSIZE, this.HSIZE + 3); if (direct == -1) this._clickViewMaps(this.HSIZE, this.HSIZE + 3, core.__PIXELS__ / 2, core.__PIXELS__ / 5 * 3.5);
return; return;
} }
@ -976,10 +976,12 @@ actions.prototype._keyUpCenterFly = function (keycode) {
} }
////// 点击确认框时 ////// ////// 点击确认框时 //////
actions.prototype._clickConfirmBox = function (x, y) { actions.prototype._clickConfirmBox = function (x, y, px, py) {
if ((x == this.HSIZE-2 || x == this.HSIZE-1) && y == this.HSIZE+1 && core.status.event.data.yes) if (px >= core.__PIXELS__ / 2 - 70 && px <= core.__PIXELS__ / 2 - 10
&& py >= core.__PIXELS__ / 2 && py <= core.__PIXELS__ / 2 + 64 && core.status.event.data.yes)
core.status.event.data.yes(); core.status.event.data.yes();
if ((x == this.HSIZE+2 || x == this.HSIZE+1) && y == this.HSIZE+1 && core.status.event.data.no) if (px >= core.__PIXELS__ / 2 + 10 && px <= core.__PIXELS__ / 2 + 70
&& py >= core.__PIXELS__ / 2 && py <= core.__PIXELS__ / 2 + 64 && core.status.event.data.no)
core.status.event.data.no(); core.status.event.data.no();
} }
@ -1008,9 +1010,9 @@ actions.prototype._keyUpConfirmBox = function (keycode) {
} }
////// 鼠标在确认框上移动时 ////// ////// 鼠标在确认框上移动时 //////
actions.prototype._onMoveConfirmBox = function (x, y) { actions.prototype._onMoveConfirmBox = function (x, y, px, py) {
if (y == this.HSIZE + 1) { if (py >= core.__PIXELS__ / 2 && py <= core.__PIXELS__ / 2 + 64) {
if (x == this.HSIZE - 2 || x == this.HSIZE - 1) { if (px >= core.__PIXELS__ / 2 - 70 && px <= core.__PIXELS__ / 2 - 10) {
if (core.status.event.selection != 0) { if (core.status.event.selection != 0) {
core.status.event.selection = 0; core.status.event.selection = 0;
core.playSound('光标移动'); core.playSound('光标移动');
@ -1022,7 +1024,7 @@ actions.prototype._onMoveConfirmBox = function (x, y) {
} }
return; return;
} }
if (x == this.HSIZE + 2 || x == this.HSIZE + 1) { if (px >= core.__PIXELS__ / 2 + 10 && px <= core.__PIXELS__ / 2 + 70) {
if (core.status.event.selection != 1) { if (core.status.event.selection != 1) {
core.status.event.selection = 1; core.status.event.selection = 1;
core.playSound('光标移动'); core.playSound('光标移动');
@ -1332,7 +1334,7 @@ actions.prototype._keyUpFly = function (keycode) {
} }
////// 查看地图界面时的点击操作 ////// ////// 查看地图界面时的点击操作 //////
actions.prototype._clickViewMaps = function (x, y) { actions.prototype._clickViewMaps = function (x, y, px, py) {
if (core.status.event.data == null) { if (core.status.event.data == null) {
core.ui._drawViewMaps(core.floorIds.indexOf(core.status.floorId)); core.ui._drawViewMaps(core.floorIds.indexOf(core.status.floorId));
return; return;
@ -1341,50 +1343,50 @@ actions.prototype._clickViewMaps = function (x, y) {
var index = core.status.event.data.index; var index = core.status.event.data.index;
var cx = core.status.event.data.x, cy = core.status.event.data.y; var cx = core.status.event.data.x, cy = core.status.event.data.y;
var floorId = core.floorIds[index], mw = core.floors[floorId].width, mh = core.floors[floorId].height; var floorId = core.floorIds[index], mw = core.floors[floorId].width, mh = core.floors[floorId].height;
var per = this.HSIZE - 4; var perpx = core.__PIXELS__ / 5, cornerpx = perpx * 3 / 4;
if (x <= per - 2 && y <= per - 2) { if (px <= cornerpx && py <= cornerpx) {
core.status.event.data.damage = !core.status.event.data.damage; core.status.event.data.damage = !core.status.event.data.damage;
core.playSound('光标移动'); core.playSound('光标移动');
core.ui._drawViewMaps(index, cx, cy); core.ui._drawViewMaps(index, cx, cy);
return; return;
} }
if (x <= per - 2 && y >= this.SIZE + 1 - per) { if (px <= cornerpx && py >= core.__PIXELS__ - cornerpx) {
if (core.markedFloorIds[floorId]) delete core.markedFloorIds[floorId]; if (core.markedFloorIds[floorId]) delete core.markedFloorIds[floorId];
else core.markedFloorIds[floorId] = true; else core.markedFloorIds[floorId] = true;
core.playSound('光标移动'); core.playSound('光标移动');
core.ui._drawViewMaps(index, cx, cy); core.ui._drawViewMaps(index, cx, cy);
return; return;
} }
if (x >= this.SIZE + 1 - per && y <= per - 2) { if (px >= core.__PIXELS__ - cornerpx && py <= cornerpx) {
core.status.event.data.all = !core.status.event.data.all; core.status.event.data.all = !core.status.event.data.all;
core.playSound('光标移动'); core.playSound('光标移动');
core.ui._drawViewMaps(index, cx, cy); core.ui._drawViewMaps(index, cx, cy);
return; return;
} }
if (x >= per && x <= this.LAST - per && y <= per - 1 && (!core.status.event.data.all && mh > this.SIZE)) { if (px >= perpx && px <= core.__PIXELS__ - perpx && py <= perpx && (!core.status.event.data.all && mh > this.SIZE)) {
core.playSound('光标移动'); core.playSound('光标移动');
core.ui._drawViewMaps(index, cx, cy - 1); core.ui._drawViewMaps(index, cx, cy - 1);
return; return;
} }
if (x >= per && x <= this.LAST - per && y >= this.SIZE - per && (!core.status.event.data.all && mh > this.SIZE)) { if (px >= perpx && px <= core.__PIXELS__ - perpx && py >= core.__PIXELS__ - perpx && (!core.status.event.data.all && mh > this.SIZE)) {
core.playSound('光标移动'); core.playSound('光标移动');
core.ui._drawViewMaps(index, cx, cy + 1); core.ui._drawViewMaps(index, cx, cy + 1);
return; return;
} }
if (x <= per - 1 && y >= per && y <= this.LAST - per) { if (px <= perpx && py >= perpx && py <= core.__PIXELS__ - perpx) {
core.playSound('光标移动'); core.playSound('光标移动');
core.ui._drawViewMaps(index, cx - 1, cy); core.ui._drawViewMaps(index, cx - 1, cy);
return; return;
} }
if (x >= this.SIZE - per && y >= per && y <= this.LAST - per) { if (px >= core.__PIXELS__ - perpx && py >= perpx && py <= core.__PIXELS__ - perpx) {
core.playSound('光标移动'); core.playSound('光标移动');
core.ui._drawViewMaps(index, cx + 1, cy); core.ui._drawViewMaps(index, cx + 1, cy);
return; return;
} }
if (y <= this.HSIZE - 2 && (mh == this.SIZE || (x >= per && x <= this.LAST - per))) { if (py <= 2 * perpx && (mh == this.SIZE || (px >= perpx && px <= core.__PIXELS__ - perpx))) {
core.playSound('光标移动'); core.playSound('光标移动');
index++; index++;
while (index < core.floorIds.length && index != now && core.status.maps[core.floorIds[index]].cannotViewMap) while (index < core.floorIds.length && index != now && core.status.maps[core.floorIds[index]].cannotViewMap)
@ -1393,7 +1395,7 @@ actions.prototype._clickViewMaps = function (x, y) {
core.ui._drawViewMaps(index); core.ui._drawViewMaps(index);
return; return;
} }
if (y >= this.HSIZE + 2 && (mh == this.SIZE || (x >= per && x <= this.LAST - per))) { if (py >= 3 * perpx && (mh == this.SIZE || (px >= perpx && px <= core.__PIXELS__ - perpx))) {
core.playSound('光标移动'); core.playSound('光标移动');
index--; index--;
while (index >= 0 && index != now && core.status.maps[core.floorIds[index]].cannotViewMap) while (index >= 0 && index != now && core.status.maps[core.floorIds[index]].cannotViewMap)
@ -1402,7 +1404,7 @@ actions.prototype._clickViewMaps = function (x, y) {
core.ui._drawViewMaps(index); core.ui._drawViewMaps(index);
return; return;
} }
if (x >= per && x <= this.LAST - per && y >= this.HSIZE - 1 && y <= this.HSIZE + 1) { if (px >= perpx && px <= core.__PIXELS__ - perpx && py >= perpx * 2 && py <= perpx * 3) {
core.clearMap('data'); core.clearMap('data');
core.playSound('取消'); core.playSound('取消');
core.ui.closePanel(); core.ui.closePanel();
@ -1416,12 +1418,12 @@ actions.prototype._keyDownViewMaps = function (keycode) {
var floorId = core.floorIds[core.status.event.data.index], mh = core.floors[floorId].height; var floorId = core.floorIds[core.status.event.data.index], mh = core.floors[floorId].height;
if (keycode == 38 || keycode == 33) this._clickViewMaps(this.HSIZE, this.HSIZE - 3); if (keycode == 38 || keycode == 33) this._clickViewMaps(this.HSIZE, this.HSIZE - 3, core.__PIXELS__ / 2, core.__PIXELS__ / 5 * 1.5);
if (keycode == 40 || keycode == 34) this._clickViewMaps(this.HSIZE, this.HSIZE + 3); if (keycode == 40 || keycode == 34) this._clickViewMaps(this.HSIZE, this.HSIZE + 3, core.__PIXELS__ / 2, core.__PIXELS__ / 5 * 3.5);
if (keycode == 87 && mh > this.SIZE) this._clickViewMaps(this.HSIZE, 0); if (keycode == 87 && mh > this.SIZE) this._clickViewMaps(this.HSIZE, 0, core.__PIXELS__ / 2, 1);
if (keycode == 65) this._clickViewMaps(0, this.HSIZE); if (keycode == 65) this._clickViewMaps(0, this.HSIZE, 1, core.__PIXELS__ / 2);
if (keycode == 83 && mh > this.SIZE) this._clickViewMaps(this.HSIZE, this.LAST); if (keycode == 83 && mh > this.SIZE) this._clickViewMaps(this.HSIZE, this.LAST, core.__PIXELS__ / 2, core.__PIXELS__ - 1);
if (keycode == 68) this._clickViewMaps(this.LAST, this.HSIZE); if (keycode == 68) this._clickViewMaps(this.LAST, this.HSIZE, core.__PIXELS__, core.__PIXELS__ / 2 - 1);
return; return;
} }

View File

@ -2587,34 +2587,35 @@ ui.prototype._drawViewMaps_drawHint = function () {
core.fillRect('ui', 0, 0, this.PIXEL, this.PIXEL, 'rgba(0,0,0,0.7)'); core.fillRect('ui', 0, 0, this.PIXEL, this.PIXEL, 'rgba(0,0,0,0.7)');
core.setTextAlign('ui', 'center'); core.setTextAlign('ui', 'center');
var stroke = function (left, top, width, height, fillStyle, lineWidth) { var stroke = function (left, top, width, height, fillStyle, lineWidth) {
core.strokeRect('ui', left*32+2, top*32+2, width*32-4, height*32-4, fillStyle, lineWidth); core.strokeRect('ui', left+2, top+2, width-4, height-4, fillStyle, lineWidth);
} }
var per = this.HSIZE - 4;
stroke(per, 0, 9, per, core.status.globalAttribute.selectColor, 4); // up var perpx = this.PIXEL / 5, cornerpx = perpx * 3 / 4;
stroke(0, per, per, 9); // left stroke(perpx, 0, 3 * perpx, perpx, core.status.globalAttribute.selectColor, 4); // up
stroke(per, this.SIZE - per, 9, per); // down stroke(0, perpx, perpx, 3 * perpx); // left
stroke(this.SIZE - per, per, per, 9); // right stroke(perpx, 4 * perpx, 3 * perpx, perpx); // down
stroke(per, per, 9, 3); // prev stroke(4 * perpx, perpx, perpx, 3 * perpx); // right
stroke(per, this.SIZE - per - 3, 9, 3); // next stroke(perpx, perpx, 3 * perpx, perpx); // prev
stroke(0, 0, per-1, per-1); // left top stroke(perpx, 3 * perpx, 3 * perpx, perpx); // next
stroke(this.SIZE-(per - 1), 0, per-1, per-1); // right top stroke(0, 0, cornerpx, cornerpx); // left top
stroke(0, this.SIZE-(per-1), per-1, per-1); // left bottom stroke(this.PIXEL - cornerpx, 0, cornerpx, cornerpx); // right top
stroke(0, this.PIXEL - cornerpx, cornerpx, cornerpx); // left bottom;
core.setTextBaseline('ui', 'middle'); core.setTextBaseline('ui', 'middle');
core.fillText('ui', "上移地图 [W]", this.HPIXEL, per * 16, core.status.globalAttribute.selectColor, '20px Arial'); core.fillText('ui', "上移地图 [W]", this.HPIXEL, perpx / 2, core.status.globalAttribute.selectColor, '20px Arial');
core.fillText('ui', "下移地图 [S]", this.HPIXEL, this.PIXEL - per * 16); core.fillText('ui', "下移地图 [S]", this.HPIXEL, this.PIXEL - perpx / 2);
core.fillText('ui', 'V', (per-1)*16, (per-1)*16); core.fillText('ui', 'V', cornerpx / 2, cornerpx / 2);
core.fillText('ui', 'Z', this.PIXEL - (per-1)*16, (per-1)*16); core.fillText('ui', 'Z', this.PIXEL - cornerpx / 2, cornerpx / 2);
core.fillText('ui', 'B', (per-1)*16, this.PIXEL - (per-1)*16); core.fillText('ui', 'B', cornerpx / 2, this.PIXEL - cornerpx / 2);
var top = this.HPIXEL - 66, left = per * 16, right = this.PIXEL - left; var top = this.HPIXEL - 66, left = perpx / 2, right = this.PIXEL - left;
var lt = ["左", "移", "地", "图", "[A]"], rt = ["右", "移", "地", "图", "[D]"]; var lt = ["左", "移", "地", "图", "[A]"], rt = ["右", "移", "地", "图", "[D]"];
for (var i = 0; i < 5; ++i) { for (var i = 0; i < 5; ++i) {
core.fillText("ui", lt[i], left, top + 32 * i); core.fillText("ui", lt[i], left, top + 32 * i);
core.fillText("ui", rt[i], right, top + 32 * i); core.fillText("ui", rt[i], right, top + 32 * i);
} }
core.fillText('ui', "前张地图 [▲ / PGUP]", this.HPIXEL, 32 * per + 48); core.fillText('ui', "前张地图 [▲ / PGUP]", this.HPIXEL, perpx * 1.5);
core.fillText('ui', "后张地图 [▼ / PGDN]", this.HPIXEL, this.PIXEL - (32 * per + 48)); core.fillText('ui', "后张地图 [▼ / PGDN]", this.HPIXEL, this.PIXEL - perpx * 1.5);
core.fillText('ui', "退出 [ESC / ENTER]", this.HPIXEL, this.HPIXEL); core.fillText('ui', "退出 [ESC / ENTER]", this.HPIXEL, this.HPIXEL);
core.fillText('ui', "[X] 可查看" + core.material.items['book'].name + " [G] 可使用" + core.material.items.fly.name, this.HPIXEL, this.HPIXEL + 32, null, '12px Arial'); core.fillText('ui', "[X] 可查看" + core.material.items['book'].name + " [G] 可使用" + core.material.items.fly.name, this.HPIXEL, this.HPIXEL + 32, null, '12px Arial');
@ -3100,17 +3101,20 @@ ui.prototype._drawKeyBoard = function () {
core.clearUI(); core.clearUI();
core.playSound('打开界面'); core.playSound('打开界面');
var offset = this.SIZE % 2 == 0 ? 16 : 0;
var width = 384, height = 320; var width = 384, height = 320;
var left = (this.PIXEL - width) / 2, right = left + width; var left = (this.PIXEL - width) / 2 + offset, right = left + width;
var top = (this.PIXEL - height) / 2, bottom = top + height; var top = (this.PIXEL - height) / 2 + offset, bottom = top + height;
var isWindowSkin = this.drawBackground(left, top, right, bottom); var isWindowSkin = this.drawBackground(left, top, right, bottom);
core.setTextAlign('ui', 'center'); core.setTextAlign('ui', 'center');
core.setFillStyle('ui', core.arrayToRGBA(core.status.textAttribute.title)); core.setFillStyle('ui', core.arrayToRGBA(core.status.textAttribute.title));
core.fillText('ui', '虚拟键盘', this.HPIXEL, top + 35, null, this._buildFont(22, true)); core.fillText('ui', '虚拟键盘', this.HPIXEL + offset, top + 35, null, this._buildFont(22, true));
core.setFont('ui', this._buildFont(17, false)); core.setFont('ui', this._buildFont(17, false));
core.setFillStyle('ui', core.arrayToRGBA(core.status.textAttribute.text)); core.setFillStyle('ui', core.arrayToRGBA(core.status.textAttribute.text));
var offset = this.HPIXEL - 89; var now = this.HPIXEL - 89 + offset;
var lines = [ var lines = [
["F1","F2","F3","F4","F5","F6","F7","F8","F9","10","11"], ["F1","F2","F3","F4","F5","F6","F7","F8","F9","10","11"],
@ -3124,17 +3128,17 @@ ui.prototype._drawKeyBoard = function () {
lines.forEach(function (line) { lines.forEach(function (line) {
for (var i=0;i<line.length;i++) { for (var i=0;i<line.length;i++) {
core.fillText('ui', line[i], core.ui.HPIXEL + 32*(i-5), offset); core.fillText('ui', line[i], core.ui.HPIXEL + 32*(i-5) + offset, now);
} }
offset+=32; now+=32;
}); });
core.fillText("ui", "返回游戏", this.HPIXEL + 128, offset-3, '#FFFFFF', this._buildFont(15, true)); core.fillText("ui", "返回游戏", this.HPIXEL + 128 + offset, now-3, '#FFFFFF', this._buildFont(15, true));
if (isWindowSkin) if (isWindowSkin)
this._drawWindowSelector(core.status.textAttribute.background, this.HPIXEL + 92, offset - 22, 72, 27); this._drawWindowSelector(core.status.textAttribute.background, this.HPIXEL + 92 + offset, now - 22, 72, 27);
else else
core.strokeRoundRect('ui', this.HPIXEL + 92, offset - 22, 72, 27, 6, core.status.globalAttribute.selectColor, 2); core.strokeRoundRect('ui', this.HPIXEL + 92 + offset, now - 22, 72, 27, 6, core.status.globalAttribute.selectColor, 2);
} }
////// 绘制状态栏 ///// ////// 绘制状态栏 /////