浏览地图时可楼传

This commit is contained in:
ckcz123 2021-08-07 11:56:41 +08:00
parent 4dc01bb07e
commit 3c05ab3ba9
4 changed files with 20 additions and 5 deletions

View File

@ -1442,6 +1442,10 @@ actions.prototype._keyUpViewMaps = function (keycode) {
}
return;
}
if (keycode == 71 && !core.isReplaying()) {
core.useFly(false);
return;
}
return;
}

View File

@ -2707,6 +2707,17 @@ events.prototype.openBook = function (fromUserAction) {
////// 点击楼层传送器时的打开操作 //////
events.prototype.useFly = function (fromUserAction) {
if (core.isReplaying()) return;
// 从“浏览地图”页面:尝试直接传送到该层
if (core.status.event.id == 'viewMaps') {
if (!core.hasItem('fly')) {
core.drawTip('你没有' + core.material.items['fly'].name, 'fly');
} else if (!core.canUseItem('fly')) {
core.drawTip('无法传送到当前层', 'fly');
}
core.flyTo(core.status.event.data.floorId);
return;
}
if (!this._checkStatus('fly', fromUserAction, true)) return;
if (core.flags.flyNearStair && !core.nearStair()) {
core.playSound('操作失败');

View File

@ -2480,10 +2480,10 @@ ui.prototype._drawViewMaps = function (index, x, y) {
core.lockControl();
core.status.event.id = 'viewMaps';
this.clearUI();
if (index == null) return this._drawMaps_drawHint();
if (index == null) return this._drawViewMaps_drawHint();
core.animateFrame.tip = null;
core.status.checkBlock.cache = {};
var data = this._drawMaps_buildData(index, x, y);
var data = this._drawViewMaps_buildData(index, x, y);
core.fillRect('ui', 0, 0, this.PIXEL, this.PIXEL, '#000000');
core.drawThumbnail(data.floorId, null, {damage: data.damage, ctx: 'ui', centerX: data.x, centerY: data.y, all: data.all});
core.clearMap('data');
@ -2499,7 +2499,7 @@ ui.prototype._drawViewMaps = function (index, x, y) {
core.fillText('data', text, textX + 5, textY + 15, 'rgba(255,255,255,0.6)');
}
ui.prototype._drawMaps_drawHint = function () {
ui.prototype._drawViewMaps_drawHint = function () {
core.playSound('打开界面');
core.fillRect('ui', 0, 0, this.PIXEL, this.PIXEL, 'rgba(0,0,0,0.4)');
core.setTextAlign('ui', 'center');
@ -2539,7 +2539,7 @@ ui.prototype._drawMaps_drawHint = function () {
core.setTextBaseline('ui', 'alphabetic');
}
ui.prototype._drawMaps_buildData = function (index, x, y) {
ui.prototype._drawViewMaps_buildData = function (index, x, y) {
var damage = (core.status.event.data||{}).damage;
var all = (core.status.event.data||{all: true}).all;
if (index.damage != null) damage=index.damage;

View File

@ -322,7 +322,7 @@ var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a =
"hideInReplay": true,
"hideInToolbox": true,
"useItemEffect": "core.ui.drawFly(core.floorIds.indexOf(core.status.floorId));",
"canUseItemEffect": "(function () {\n\treturn core.status.maps[core.status.floorId].canFlyFrom;\n})();"
"canUseItemEffect": "(function () {\n\tif (core.flags.flyNearStair && !core.nearStair()) return false;\n\treturn core.status.maps[core.status.floorId].canFlyFrom;\n})();"
},
"coin": {
"cls": "constants",