actions choices HSIZE

This commit is contained in:
oc 2019-03-24 16:45:48 +08:00
parent 018dbe8332
commit 38c8b81f48
3 changed files with 128 additions and 122 deletions

View File

@ -7,6 +7,11 @@ actions.js用户交互的事件的处理
function actions() { function actions() {
this._init(); this._init();
this.SIZE = core.__SIZE__;
this.HSIZE = core.__HALF_SIZE__;
this.LAST = this.SIZE - 1;
this.CHOICES_LEFT = 5; // choices
this.CHOICES_RIGHT = this.LAST - this.CHOICES_LEFT;
} }
actions.prototype._init = function () { actions.prototype._init = function () {
@ -109,7 +114,7 @@ actions.prototype.checkReplaying = function () {
////// 检查是否在录像播放中,如果是,则停止交互 ////// 检查是否在录像播放中,如果是,则停止交互
actions.prototype._sys_checkReplay = function () { actions.prototype._sys_checkReplay = function () {
if (core.actions.checkReplaying()) return true; if (this.checkReplaying()) return true;
} }
////// 按下某个键时 ////// ////// 按下某个键时 //////
@ -127,10 +132,10 @@ actions.prototype._sys_onkeyDown = function (e) {
} }
} }
core.status.holdingKeys.push(e.keyCode); core.status.holdingKeys.push(e.keyCode);
core.actions.pressKey(e.keyCode); this.pressKey(e.keyCode);
} else { } else {
if (e.keyCode == 17) core.status.ctrlDown = true; if (e.keyCode == 17) core.status.ctrlDown = true;
core.actions.keyDown(e.keyCode); this.keyDown(e.keyCode);
} }
} }
@ -140,7 +145,7 @@ actions.prototype.onkeyUp = function (e) {
} }
actions.prototype._sys_onkeyUp_replay = function (e) { actions.prototype._sys_onkeyUp_replay = function (e) {
if (core.actions.checkReplaying()) { if (this.checkReplaying()) {
if (e.keyCode == 27) // ESCAPE if (e.keyCode == 27) // ESCAPE
core.stopReplay(); core.stopReplay();
else if (e.keyCode == 90) // Z else if (e.keyCode == 90) // Z
@ -179,10 +184,10 @@ actions.prototype._sys_onkeyUp = function (e) {
break; break;
} }
} }
core.actions.keyUp(e.keyCode, e.altKey); this.keyUp(e.keyCode, e.altKey);
} else { } else {
if (e.keyCode == 17) core.status.ctrlDown = false; if (e.keyCode == 17) core.status.ctrlDown = false;
core.actions.keyUp(e.keyCode, e.altKey); this.keyUp(e.keyCode, e.altKey);
} }
} }
@ -209,32 +214,32 @@ actions.prototype._sys_keyDown_lockControl = function (keyCode) {
if (!core.status.lockControl) return false; if (!core.status.lockControl) return false;
// Ctrl跳过对话 // Ctrl跳过对话
if (keyCode == 17) { if (keyCode == 17) {
core.actions.keyDownCtrl(); this.keyDownCtrl();
return true; return true;
} }
switch (core.status.event.id) { switch (core.status.event.id) {
case 'action': case 'action':
core.actions._keyDownAction(keyCode); this._keyDownAction(keyCode);
break; break;
case 'book': case 'book':
core.actions._keyDownBook(keyCode); this._keyDownBook(keyCode);
break; break;
case 'fly': case 'fly':
core.actions._keyDownFly(keyCode); this._keyDownFly(keyCode);
break; break;
case 'viewMaps': case 'viewMaps':
core.actions._keyDownViewMaps(keyCode); this._keyDownViewMaps(keyCode);
break; break;
case 'equipbox': case 'equipbox':
core.actions._keyDownEquipbox(keyCode); this._keyDownEquipbox(keyCode);
break; break;
case 'toolbox': case 'toolbox':
core.actions._keyDownToolbox(keyCode); this._keyDownToolbox(keyCode);
break; break;
case 'save': case 'save':
case 'load': case 'load':
case 'replayLoad': case 'replayLoad':
core.actions._keyDownSL(keyCode); this._keyDownSL(keyCode);
break; break;
case 'shop': case 'shop':
case 'selectShop': case 'selectShop':
@ -246,10 +251,10 @@ actions.prototype._sys_keyDown_lockControl = function (keyCode) {
case 'storageRemove': case 'storageRemove':
case 'replay': case 'replay':
case 'gameInfo': case 'gameInfo':
core.actions._keyDownChoices(keyCode); this._keyDownChoices(keyCode);
break; break;
case 'cursor': case 'cursor':
core.actions._keyDownCursor(keyCode); this._keyDownCursor(keyCode);
break; break;
} }
return true; return true;
@ -271,7 +276,6 @@ actions.prototype._sys_keyDown = function (keyCode) {
case 40: case 40:
core.moveHero('down'); core.moveHero('down');
break; break;
break;
} }
return true; return true;
} }
@ -282,7 +286,7 @@ actions.prototype.keyUp = function (keyCode, altKey, fromReplay) {
} }
actions.prototype._sys_keyUp_replay = function (keyCode, altKey, fromReplay) { actions.prototype._sys_keyUp_replay = function (keyCode, altKey, fromReplay) {
if (!fromReplay && core.actions.checkReplaying()) return true; if (!fromReplay && this.checkReplaying()) return true;
} }
actions.prototype._sys_keyUp_lockControl = function (keyCode, altKey) { actions.prototype._sys_keyUp_lockControl = function (keyCode, altKey) {
@ -298,81 +302,81 @@ actions.prototype._sys_keyUp_lockControl = function (keyCode, altKey) {
ok() && core.drawText(); ok() && core.drawText();
break; break;
case 'confirmBox': case 'confirmBox':
core.actions._keyUpConfirmBox(keyCode); this._keyUpConfirmBox(keyCode);
break; break;
case 'action': case 'action':
core.actions._keyUpAction(keyCode); this._keyUpAction(keyCode);
break; break;
case 'about': case 'about':
ok() && core.ui.closePanel(); ok() && core.closePanel();
break; break;
case 'help': case 'help':
ok() && core.ui.closePanel(); ok() && core.closePanel();
break; break;
case 'book': case 'book':
core.actions._keyUpBook(keyCode); this._keyUpBook(keyCode);
break; break;
case 'book-detail': case 'book-detail':
ok() && core.actions._clickBookDetail(); ok() && this._clickBookDetail();
break; break;
case 'fly': case 'fly':
this._keyUpFly(keyCode); this._keyUpFly(keyCode);
break; break;
case 'viewMaps': case 'viewMaps':
core.actions._keyUpViewMaps(keyCode); this._keyUpViewMaps(keyCode);
break; break;
case 'shop': case 'shop':
core.actions._keyUpShop(keyCode); this._keyUpShop(keyCode);
break; break;
case 'selectShop': case 'selectShop':
core.actions._keyUpQuickShop(keyCode); this._keyUpQuickShop(keyCode);
break; break;
case 'toolbox': case 'toolbox':
core.actions._keyUpToolbox(keyCode); this._keyUpToolbox(keyCode);
break; break;
case 'equipbox': case 'equipbox':
core.actions._keyUpEquipbox(keyCode, altKey); this._keyUpEquipbox(keyCode, altKey);
break; break;
case 'save': case 'save':
case 'load': case 'load':
case 'replayLoad': case 'replayLoad':
core.actions._keyUpSL(keyCode); this._keyUpSL(keyCode);
break; break;
case 'keyBoard': case 'keyBoard':
ok() && core.ui.closePanel(); ok() && core.closePanel();
break; break;
case 'switchs': case 'switchs':
core.actions._keyUpSwitchs(keyCode); this._keyUpSwitchs(keyCode);
break; break;
case 'settings': case 'settings':
core.actions._keyUpSettings(keyCode); this._keyUpSettings(keyCode);
break; break;
case 'syncSave': case 'syncSave':
core.actions._keyUpSyncSave(keyCode); this._keyUpSyncSave(keyCode);
break; break;
case 'syncSelect': case 'syncSelect':
core.actions._keyUpSyncSelect(keyCode); this._keyUpSyncSelect(keyCode);
break; break;
case 'localSaveSelect': case 'localSaveSelect':
core.actions._keyUpLocalSaveSelect(keyCode); this._keyUpLocalSaveSelect(keyCode);
break; break;
case 'storageRemove': case 'storageRemove':
core.actions._keyUpStorageRemove(keyCode); this._keyUpStorageRemove(keyCode);
break; break;
case 'cursor': case 'cursor':
core.actions._keyUpCursor(keyCode); this._keyUpCursor(keyCode);
break; break;
case 'replay': case 'replay':
core.actions._keyUpReplay(keyCode); this._keyUpReplay(keyCode);
break; break;
case 'gameInfo': case 'gameInfo':
core.actions._keyUpGameInfo(keyCode); this._keyUpGameInfo(keyCode);
break; break;
case 'centerFly': case 'centerFly':
core.actions._keyUpCenterFly(keyCode); this._keyUpCenterFly(keyCode);
break; break;
case 'paint': case 'paint':
core.actions._keyUpPaint(keyCode); this._keyUpPaint(keyCode);
break; break;
} }
return true; return true;
@ -399,7 +403,7 @@ actions.prototype.ondown = function (loc) {
actions.prototype._sys_ondown_paint = function (x, y, px, py) { actions.prototype._sys_ondown_paint = function (x, y, px, py) {
// 画板 // 画板
if (core.status.played && (core.status.event || {}).id == 'paint') { if (core.status.played && (core.status.event || {}).id == 'paint') {
core.actions._ondownPaint(px, py); this._ondownPaint(px, py);
return true; return true;
} }
} }
@ -492,7 +496,7 @@ actions.prototype.onup = function () {
actions.prototype._sys_onup_paint = function () { actions.prototype._sys_onup_paint = function () {
// 画板 // 画板
if (core.status.played && (core.status.event || {}).id == 'paint') { if (core.status.played && (core.status.event || {}).id == 'paint') {
core.actions._onupPaint(); this._onupPaint();
return true; return true;
} }
} }
@ -567,75 +571,75 @@ actions.prototype._sys_onclick_lockControl = function (x, y) {
if (!core.status.lockControl) return false; if (!core.status.lockControl) return false;
switch (core.status.event.id) { switch (core.status.event.id) {
case 'centerFly': case 'centerFly':
core.actions._clickCenterFly(x, y); this._clickCenterFly(x, y);
break; break;
case 'book': case 'book':
core.actions._clickBook(x, y); this._clickBook(x, y);
break; break;
case 'book-detail': case 'book-detail':
core.actions._clickBookDetail(x, y); this._clickBookDetail(x, y);
break; break;
case 'fly': case 'fly':
core.actions._clickFly(x, y); this._clickFly(x, y);
break; break;
case 'viewMaps': case 'viewMaps':
core.actions._clickViewMaps(x, y); this._clickViewMaps(x, y);
break; break;
case 'switchs': case 'switchs':
core.actions._clickSwitchs(x, y); this._clickSwitchs(x, y);
break; break;
case 'settings': case 'settings':
core.actions._clickSettings(x, y); this._clickSettings(x, y);
break; break;
case 'shop': case 'shop':
core.actions._clickShop(x, y); this._clickShop(x, y);
break; break;
case 'selectShop': case 'selectShop':
core.actions._clickQuickShop(x, y); this._clickQuickShop(x, y);
break; break;
case 'equipbox': case 'equipbox':
core.actions._clickEquipbox(x, y); this._clickEquipbox(x, y);
break; break;
case 'toolbox': case 'toolbox':
core.actions._clickToolbox(x, y); this._clickToolbox(x, y);
break; break;
case 'save': case 'save':
case 'load': case 'load':
case 'replayLoad': case 'replayLoad':
core.actions._clickSL(x, y); this._clickSL(x, y);
break; break;
case 'confirmBox': case 'confirmBox':
core.actions._clickConfirmBox(x, y); this._clickConfirmBox(x, y);
break; break;
case 'keyBoard': case 'keyBoard':
core.actions._clickKeyBoard(x, y); this._clickKeyBoard(x, y);
break; break;
case 'action': case 'action':
core.actions._clickAction(x, y); this._clickAction(x, y);
break; break;
case 'text': case 'text':
core.drawText(); core.drawText();
break; break;
case 'syncSave': case 'syncSave':
core.actions._clickSyncSave(x, y); this._clickSyncSave(x, y);
break; break;
case 'syncSelect': case 'syncSelect':
core.actions._clickSyncSelect(x, y); this._clickSyncSelect(x, y);
break; break;
case 'localSaveSelect': case 'localSaveSelect':
core.actions._clickLocalSaveSelect(x, y); this._clickLocalSaveSelect(x, y);
break; break;
case 'storageRemove': case 'storageRemove':
core.actions._clickStorageRemove(x, y); this._clickStorageRemove(x, y);
break; break;
case 'cursor': case 'cursor':
core.actions._clickCursor(x, y); this._clickCursor(x, y);
break; break;
case 'replay': case 'replay':
core.actions._clickReplay(x, y); this._clickReplay(x, y);
break; break;
case 'gameInfo': case 'gameInfo':
core.actions._clickGameInfo(x, y); this._clickGameInfo(x, y);
break; break;
case 'about': case 'about':
case 'help': case 'help':
@ -668,15 +672,15 @@ actions.prototype._sys_onmousewheel = function (direct) {
// 楼层飞行器 // 楼层飞行器
if (core.status.lockControl && core.status.event.id == 'fly') { if (core.status.lockControl && core.status.event.id == 'fly') {
if (direct == 1) core.ui.drawFly(core.actions._getNextFlyFloor(1)); if (direct == 1) core.ui.drawFly(this._getNextFlyFloor(1));
if (direct == -1) core.ui.drawFly(core.actions._getNextFlyFloor(-1)); if (direct == -1) core.ui.drawFly(this._getNextFlyFloor(-1));
return; return;
} }
// 怪物手册 // 怪物手册
if (core.status.lockControl && core.status.event.id == 'book') { if (core.status.lockControl && core.status.event.id == 'book') {
if (direct == 1) core.ui.drawBook(core.status.event.data - 6); if (direct == 1) core.ui.drawBook(core.status.event.data - this.HSIZE);
if (direct == -1) core.ui.drawBook(core.status.event.data + 6); if (direct == -1) core.ui.drawBook(core.status.event.data + this.HSIZE);
return; return;
} }
@ -689,8 +693,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) core.actions._clickViewMaps(6, 3); if (direct == 1) this._clickViewMaps(this.HSIZE, this.HSIZE - 3);
if (direct == -1) core.actions._clickViewMaps(6, 9); if (direct == -1) this._clickViewMaps(this.HSIZE, this.HSIZE + 3);
return; return;
} }
@ -740,7 +744,7 @@ actions.prototype._sys_longClick_lockControl = function (x, y) {
// 长按楼传器的箭头可以快速翻页 // 长按楼传器的箭头可以快速翻页
if (core.status.event.id == 'fly') { if (core.status.event.id == 'fly') {
if ((x == 10 || x == 11) && (y == 5 || y == 9)) { if ((x == 10 || x == 11) && (y == 5 || y == 9)) {
core.actions._clickFly(x, y); this._clickFly(x, y);
return true; return true;
} }
} }
@ -772,14 +776,14 @@ actions.prototype._sys_longClick = function (x, y, fromEvent) {
// 数字键快速选择选项 // 数字键快速选择选项
actions.prototype._selectChoices = function (length, keycode, callback) { actions.prototype._selectChoices = function (length, keycode, callback) {
var topIndex = 6 - parseInt((length - 1) / 2); var topIndex = this.HSIZE - parseInt((length - 1) / 2);
if (keycode == 13 || keycode == 32 || keycode == 67) { if (keycode == 13 || keycode == 32 || keycode == 67) {
callback.apply(this, [6, topIndex + core.status.event.selection]); callback.apply(this, [this.HSIZE, topIndex + core.status.event.selection]);
} }
if (keycode >= 49 && keycode <= 57) { if (keycode >= 49 && keycode <= 57) {
var index = keycode - 49; var index = keycode - 49;
if (index < length) { if (index < length) {
callback.apply(this, [6, topIndex + index]); callback.apply(this, [this.HSIZE, topIndex + index]);
} }
} }
} }
@ -824,9 +828,9 @@ actions.prototype._keyUpCenterFly = function (keycode) {
////// 点击确认框时 ////// ////// 点击确认框时 //////
actions.prototype._clickConfirmBox = function (x, y) { actions.prototype._clickConfirmBox = function (x, y) {
if ((x == 4 || x == 5) && y == 7 && core.status.event.data.yes) if ((x == this.HSIZE-2 || x == this.HSIZE-1) && y == this.HSIZE+1 && core.status.event.data.yes)
core.status.event.data.yes(); core.status.event.data.yes();
if ((x == 7 || x == 8) && y == 7 && core.status.event.data.no) if ((x == this.HSIZE+2 || x == this.HSIZE+1) && y == this.HSIZE+1 && core.status.event.data.no)
core.status.event.data.no(); core.status.event.data.no();
} }
@ -877,8 +881,8 @@ actions.prototype._clickAction = function (x, y) {
var data = core.status.event.data.current; var data = core.status.event.data.current;
var choices = data.choices; var choices = data.choices;
if (choices.length == 0) return; if (choices.length == 0) return;
if (x >= 5 && x <= 7) { if (x >= this.CHOICES_LEFT && x <= this.CHOICES_RIGHT) {
var topIndex = 6 - parseInt((choices.length - 1) / 2); var topIndex = this.HSIZE - parseInt((choices.length - 1) / 2);
if (y >= topIndex && y < topIndex + choices.length) { if (y >= topIndex && y < topIndex + choices.length) {
// 选择 // 选择
core.status.route.push("choices:" + (y - topIndex)); core.status.route.push("choices:" + (y - topIndex));
@ -925,17 +929,17 @@ actions.prototype._keyUpAction = function (keycode) {
////// 怪物手册界面的点击操作 ////// ////// 怪物手册界面的点击操作 //////
actions.prototype._clickBook = function (x, y) { actions.prototype._clickBook = function (x, y) {
// 上一页 // 上一页
if ((x == 3 || x == 4) && y == 12) { if ((x == this.HSIZE-2 || x == this.HSIZE-3) && y == this.LAST) {
core.ui.drawBook(core.status.event.data - 6); core.ui.drawBook(core.status.event.data - this.HSIZE);
return; return;
} }
// 下一页 // 下一页
if ((x == 8 || x == 9) && y == 12) { if ((x == this.HSIZE+2 || x == this.HSIZE+3) && y == this.LAST) {
core.ui.drawBook(core.status.event.data + 6); core.ui.drawBook(core.status.event.data + this.HSIZE);
return; return;
} }
// 返回 // 返回
if (x >= 10 && x <= 12 && y == 12) { if (x >= this.LAST-2 && y == this.LAST) {
if (core.events.recoverEvents(core.status.event.interval)) { if (core.events.recoverEvents(core.status.event.interval)) {
return; return;
} }
@ -948,9 +952,9 @@ actions.prototype._clickBook = function (x, y) {
} }
// 怪物信息 // 怪物信息
var data = core.status.event.data; var data = core.status.event.data;
if (data != null && y < 12) { if (data != null && y < this.LAST) {
var page = parseInt(data / 6); var page = parseInt(data / this.HSIZE);
var index = 6 * page + parseInt(y / 2); var index = this.HSIZE * page + parseInt(y / 2);
core.ui.drawBook(index); core.ui.drawBook(index);
core.ui.drawBookDetail(index); core.ui.drawBookDetail(index);
} }
@ -959,12 +963,12 @@ actions.prototype._clickBook = function (x, y) {
////// 怪物手册界面时,按下某个键的操作 ////// ////// 怪物手册界面时,按下某个键的操作 //////
actions.prototype._keyDownBook = function (keycode) { actions.prototype._keyDownBook = function (keycode) {
if (keycode == 37) core.ui.drawBook(core.status.event.data - 6); if (keycode == 37) core.ui.drawBook(core.status.event.data - this.HSIZE);
if (keycode == 38) core.ui.drawBook(core.status.event.data - 1); if (keycode == 38) core.ui.drawBook(core.status.event.data - 1);
if (keycode == 39) core.ui.drawBook(core.status.event.data + 6); if (keycode == 39) core.ui.drawBook(core.status.event.data + this.HSIZE);
if (keycode == 40) core.ui.drawBook(core.status.event.data + 1); if (keycode == 40) core.ui.drawBook(core.status.event.data + 1);
if (keycode == 33) core.ui.drawBook(core.status.event.data - 6); if (keycode == 33) core.ui.drawBook(core.status.event.data - this.HSIZE);
if (keycode == 34) core.ui.drawBook(core.status.event.data + 6); if (keycode == 34) core.ui.drawBook(core.status.event.data + this.HSIZE);
return; return;
} }
@ -984,7 +988,7 @@ actions.prototype._keyUpBook = function (keycode) {
if (keycode == 13 || keycode == 32 || keycode == 67) { if (keycode == 13 || keycode == 32 || keycode == 67) {
var data = core.status.event.data; var data = core.status.event.data;
if (data != null) { if (data != null) {
this._clickBook(6, 2 * (data % 6)); this._clickBook(this.HSIZE, 2 * (data % this.HSIZE));
} }
return; return;
} }
@ -998,12 +1002,12 @@ actions.prototype._clickBookDetail = function () {
////// 楼层传送器界面时的点击操作 ////// ////// 楼层传送器界面时的点击操作 //////
actions.prototype._clickFly = function (x, y) { actions.prototype._clickFly = function (x, y) {
if ((x == 10 || x == 11) && y == 9) core.ui.drawFly(this._getNextFlyFloor(-1)); if ((x == this.SIZE-2 || x == this.SIZE-3) && y == this.HSIZE+3) core.ui.drawFly(this._getNextFlyFloor(-1));
if ((x == 10 || x == 11) && y == 5) core.ui.drawFly(this._getNextFlyFloor(1)); if ((x == this.SIZE-2 || x == this.SIZE-3) && y == this.HSIZE-1) core.ui.drawFly(this._getNextFlyFloor(1));
if ((x == 10 || x == 11) && y == 10) core.ui.drawFly(this._getNextFlyFloor(-10)); if ((x == this.SIZE-2 || x == this.SIZE-3) && y == this.HSIZE+4) core.ui.drawFly(this._getNextFlyFloor(-10));
if ((x == 10 || x == 11) && y == 4) core.ui.drawFly(this._getNextFlyFloor(10)); if ((x == this.SIZE-2 || x == this.SIZE-3) && y == this.HSIZE-2) core.ui.drawFly(this._getNextFlyFloor(10));
if (x >= 5 && x <= 7 && y == 12) core.ui.closePanel(); if (x >= this.HSIZE-1 && x <= this.HSIZE+1 && y == this.LAST) core.ui.closePanel();
if (x >= 0 && x <= 9 && y >= 3 && y <= 11) if (x >= 0 && x <= this.HSIZE+3 && y >= 3 && y <= this.LAST - 1)
core.flyTo(core.floorIds[core.status.event.data]); core.flyTo(core.floorIds[core.status.event.data]);
return; return;
} }
@ -1041,7 +1045,7 @@ actions.prototype._keyUpFly = function (keycode) {
if (keycode == 71 || keycode == 27 || keycode == 88) if (keycode == 71 || keycode == 27 || keycode == 88)
core.ui.closePanel(); core.ui.closePanel();
if (keycode == 13 || keycode == 32 || keycode == 67) if (keycode == 13 || keycode == 32 || keycode == 67)
this._clickFly(5, 5); this._clickFly(this.HSIZE-1, this.HSIZE-1);
return; return;
} }
@ -1167,8 +1171,8 @@ actions.prototype._keyUpViewMaps = function (keycode) {
actions.prototype._clickShop = function (x, y) { actions.prototype._clickShop = function (x, y) {
var shop = core.status.event.data.shop; var shop = core.status.event.data.shop;
var choices = shop.choices; var choices = shop.choices;
if (x >= 5 && x <= 7) { if (x >= this.CHOICES_LEFT && x <= this.CHOICES_RIGHT) {
var topIndex = 6 - parseInt(choices.length / 2); var topIndex = this.HSIZE - parseInt(choices.length / 2);
if (y >= topIndex && y < topIndex + choices.length) { if (y >= topIndex && y < topIndex + choices.length) {
return core.events._useShop(shop, y - topIndex); return core.events._useShop(shop, y - topIndex);
} }
@ -1196,8 +1200,8 @@ actions.prototype._clickQuickShop = function (x, y) {
var shopList = core.status.shops, keys = Object.keys(shopList).filter(function (shopId) { var shopList = core.status.shops, keys = Object.keys(shopList).filter(function (shopId) {
return shopList[shopId].visited || !shopList[shopId].mustEnable return shopList[shopId].visited || !shopList[shopId].mustEnable
}); });
if (x >= 5 && x <= 7) { if (x >= this.CHOICES_LEFT && x <= this.CHOICES_RIGHT) {
var topIndex = 6 - parseInt(keys.length / 2); var topIndex = this.HSIZE - parseInt(keys.length / 2);
if (y >= topIndex && y < topIndex + keys.length) { if (y >= topIndex && y < topIndex + keys.length) {
var reason = core.events.canUseQuickShop(keys[y - topIndex]); var reason = core.events.canUseQuickShop(keys[y - topIndex]);
if (!core.flags.enableDisabledShop && reason) { if (!core.flags.enableDisabledShop && reason) {
@ -1749,9 +1753,9 @@ actions.prototype._keyUpSL = function (keycode) {
////// 系统设置界面时的点击操作 ////// ////// 系统设置界面时的点击操作 //////
actions.prototype._clickSwitchs = function (x, y) { actions.prototype._clickSwitchs = function (x, y) {
if (x < 5 || x > 7) return; if (x < this.CHOICES_LEFT || x > this.CHOICES_RIGHT) return;
var choices = core.status.event.ui.choices; var choices = core.status.event.ui.choices;
var topIndex = 6 - parseInt((choices.length - 1) / 2); var topIndex = this.HSIZE - parseInt((choices.length - 1) / 2);
if (y >= topIndex && y < topIndex + choices.length) { if (y >= topIndex && y < topIndex + choices.length) {
var selection = y - topIndex; var selection = y - topIndex;
core.status.event.selection = selection; core.status.event.selection = selection;
@ -1844,11 +1848,11 @@ actions.prototype._keyUpSwitchs = function (keycode) {
this._selectChoices(core.status.event.ui.choices.length, keycode, this._clickSwitchs); this._selectChoices(core.status.event.ui.choices.length, keycode, this._clickSwitchs);
} }
////// 系统菜单栏界面时的点击事件 ////// ////// 系统菜单栏界面时的点击操作 //////
actions.prototype._clickSettings = function (x, y) { actions.prototype._clickSettings = function (x, y) {
if (x < 5 || x > 7) return; if (x < this.CHOICES_LEFT || x > this.CHOICES_RIGHT) return;
var choices = core.status.event.ui.choices; var choices = core.status.event.ui.choices;
var topIndex = 6 - parseInt((choices.length - 1) / 2); var topIndex = this.HSIZE - parseInt((choices.length - 1) / 2);
if (y >= topIndex && y < topIndex + choices.length) { if (y >= topIndex && y < topIndex + choices.length) {
var selection = y - topIndex; var selection = y - topIndex;
core.status.event.selection = selection; core.status.event.selection = selection;
@ -1897,9 +1901,9 @@ actions.prototype._keyUpSettings = function (keycode) {
////// 同步存档界面时的点击操作 ////// ////// 同步存档界面时的点击操作 //////
actions.prototype._clickSyncSave = function (x, y) { actions.prototype._clickSyncSave = function (x, y) {
if (x < 5 || x > 7) return; if (x < this.CHOICES_LEFT || x > this.CHOICES_RIGHT) return;
var choices = core.status.event.ui.choices; var choices = core.status.event.ui.choices;
var topIndex = 6 - parseInt((choices.length - 1) / 2); var topIndex = this.HSIZE - parseInt((choices.length - 1) / 2);
if (y >= topIndex && y < topIndex + choices.length) { if (y >= topIndex && y < topIndex + choices.length) {
var selection = y - topIndex; var selection = y - topIndex;
core.status.event.selection = selection; core.status.event.selection = selection;
@ -1979,10 +1983,10 @@ actions.prototype._keyUpSyncSave = function (keycode) {
////// 同步存档选择界面时的点击操作 ////// ////// 同步存档选择界面时的点击操作 //////
actions.prototype._clickSyncSelect = function (x, y) { actions.prototype._clickSyncSelect = function (x, y) {
if (x < 5 || x > 7) return; if (x < this.CHOICES_LEFT || x > this.CHOICES_RIGHT) return;
var choices = core.status.event.ui.choices; var choices = core.status.event.ui.choices;
var topIndex = 6 - parseInt((choices.length - 1) / 2); var topIndex = this.HSIZE - parseInt((choices.length - 1) / 2);
if (y >= topIndex && y < topIndex + choices.length) { if (y >= topIndex && y < topIndex + choices.length) {
var selection = y - topIndex; var selection = y - topIndex;
core.status.event.selection = selection; core.status.event.selection = selection;
@ -2013,10 +2017,10 @@ actions.prototype._keyUpSyncSelect = function (keycode) {
////// 存档下载界面时的点击操作 ////// ////// 存档下载界面时的点击操作 //////
actions.prototype._clickLocalSaveSelect = function (x, y) { actions.prototype._clickLocalSaveSelect = function (x, y) {
if (x < 5 || x > 7) return; if (x < this.CHOICES_LEFT || x > this.CHOICES_RIGHT) return;
var choices = core.status.event.ui.choices; var choices = core.status.event.ui.choices;
var topIndex = 6 - parseInt((choices.length - 1) / 2); var topIndex = this.HSIZE - parseInt((choices.length - 1) / 2);
if (y >= topIndex && y < topIndex + choices.length) { if (y >= topIndex && y < topIndex + choices.length) {
var selection = y - topIndex; var selection = y - topIndex;
@ -2051,10 +2055,10 @@ actions.prototype._keyUpLocalSaveSelect = function (keycode) {
////// 存档删除界面时的点击操作 ////// ////// 存档删除界面时的点击操作 //////
actions.prototype._clickStorageRemove = function (x, y) { actions.prototype._clickStorageRemove = function (x, y) {
if (x < 5 || x > 7) return; if (x < this.CHOICES_LEFT || x > this.CHOICES_RIGHT) return;
var choices = core.status.event.ui.choices; var choices = core.status.event.ui.choices;
var topIndex = 6 - parseInt((choices.length - 1) / 2); var topIndex = this.HSIZE - parseInt((choices.length - 1) / 2);
if (y >= topIndex && y < topIndex + choices.length) { if (y >= topIndex && y < topIndex + choices.length) {
var selection = y - topIndex; var selection = y - topIndex;
@ -2132,10 +2136,10 @@ actions.prototype._keyUpStorageRemove = function (keycode) {
////// 回放选择界面时的点击操作 ////// ////// 回放选择界面时的点击操作 //////
actions.prototype._clickReplay = function (x, y) { actions.prototype._clickReplay = function (x, y) {
if (x < 5 || x > 7) return; if (x < this.CHOICES_LEFT || x > this.CHOICES_RIGHT) return;
var choices = core.status.event.ui.choices; var choices = core.status.event.ui.choices;
var topIndex = 6 - parseInt((choices.length - 1) / 2); var topIndex = this.HSIZE - parseInt((choices.length - 1) / 2);
if (y >= topIndex && y < topIndex + choices.length) { if (y >= topIndex && y < topIndex + choices.length) {
var selection = y - topIndex; var selection = y - topIndex;
@ -2186,10 +2190,10 @@ actions.prototype._keyUpReplay = function (keycode) {
////// 游戏信息界面时的点击操作 ////// ////// 游戏信息界面时的点击操作 //////
actions.prototype._clickGameInfo = function (x, y) { actions.prototype._clickGameInfo = function (x, y) {
if (x < 5 || x > 7) return; if (x < this.CHOICES_LEFT || x > this.CHOICES_RIGHT) return;
var choices = core.status.event.ui.choices; var choices = core.status.event.ui.choices;
var topIndex = 6 - parseInt((choices.length - 1) / 2); var topIndex = this.HSIZE - parseInt((choices.length - 1) / 2);
if (y >= topIndex && y < topIndex + choices.length) { if (y >= topIndex && y < topIndex + choices.length) {
var selection = y - topIndex; var selection = y - topIndex;

View File

@ -625,6 +625,7 @@ control.prototype.moveAction = function (callback) {
} }
control.prototype._moveAction_noPass = function (canMove, callback) { control.prototype._moveAction_noPass = function (canMove, callback) {
core.status.route.push(core.getHeroLoc('direction'));
core.status.automaticRoute.moveStepBeforeStop = []; core.status.automaticRoute.moveStepBeforeStop = [];
core.status.automaticRoute.lastDirection = core.getHeroLoc('direction'); core.status.automaticRoute.lastDirection = core.getHeroLoc('direction');
if (canMove) core.events._trigger(core.nextX(), core.nextY()); if (canMove) core.events._trigger(core.nextX(), core.nextY());
@ -641,6 +642,7 @@ control.prototype._moveAction_moving = function (callback) {
core.setHeroMoveInterval(function () { core.setHeroMoveInterval(function () {
var direction = core.getHeroLoc('direction'); var direction = core.getHeroLoc('direction');
core.control._moveAction_popAutomaticRoute(); core.control._moveAction_popAutomaticRoute();
core.status.route.push(direction);
// 无事件的道具(如血瓶)需要优先于阻激夹域判定 // 无事件的道具(如血瓶)需要优先于阻激夹域判定
var nowx = core.getHeroLoc('x'), nowy = core.getHeroLoc('y'); var nowx = core.getHeroLoc('x'), nowy = core.getHeroLoc('y');

View File

@ -944,7 +944,7 @@ ui.prototype.drawChoices = function(content, choices) {
ui.prototype._drawChoices_getHorizontalPosition = function (titleInfo, choices) { ui.prototype._drawChoices_getHorizontalPosition = function (titleInfo, choices) {
// 宽度计算:考虑选项的长度 // 宽度计算:考虑选项的长度
var width = this.PIXEL - 2 * 85; var width = 246;
core.setFont('ui', "bold 17px "+core.status.globalAttribute.font); core.setFont('ui', "bold 17px "+core.status.globalAttribute.font);
for (var i = 0; i < choices.length; i++) { for (var i = 0; i < choices.length; i++) {
if (typeof choices[i] === 'string') if (typeof choices[i] === 'string')