全局商店X键退出

This commit is contained in:
ckcz123 2020-05-23 22:20:13 +08:00
parent 64433423e6
commit f6e313126a

View File

@ -124,7 +124,9 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
////// 将一个全局商店转变成可预览的公共事件 ////// ////// 将一个全局商店转变成可预览的公共事件 //////
this._convertShop = function (shop) { this._convertShop = function (shop) {
return [{ return [
{ "type": "function", "function": "function() {core.setFlag('@temp@shop', true);}" },
{
"type": "while", "type": "while",
"condition": "true", "condition": "true",
"data": [ "data": [
@ -155,7 +157,9 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
] ]
} }
] ]
}]; },
{ "type": "function", "function": "function() {core.removeFlag('@temp@shop');}" }
];
} }
this._convertShop_replaceChoices = function (shopId, previewMode) { this._convertShop_replaceChoices = function (shopId, previewMode) {
@ -220,6 +224,19 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
return null; return null;
} }
/// 允许商店X键退出
core.registerAction('keyUp', 'shops', function (keycode) {
if (!core.status.lockControl || !core.hasFlag("@temp@shop") || core.status.event.id != 'action') return false;
if (core.status.event.data.type != 'choices') return false;
var data = core.status.event.data.current;
var choices = data.choices;
var topIndex = core.actions.HSIZE - parseInt((choices.length - 1) / 2) + (core.status.event.ui.offset || 0);
if (keycode == 88) { // X
core.actions._clickAction(core.actions.HSIZE, topIndex + choices.length - 1);
return true;
}
}, 60);
}, },
"removeMap": function () { "removeMap": function () {
// 高层塔砍层插件,删除后不会存入存档,不可浏览地图也不可飞到。 // 高层塔砍层插件,删除后不会存入存档,不可浏览地图也不可飞到。