diff --git a/project/data.js b/project/data.js index 501fa42..4159062 100644 --- a/project/data.js +++ b/project/data.js @@ -1072,24 +1072,60 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d = }, { "id": "0fKey", - "item": true, - "textInList": "道具商店", - "use": "money", + "text": "我这里有一些钥匙,你需要么?", + "textInList": "0层钥匙商店", "mustEnable": false, + "disablePreview": false, "choices": [ { - "id": "yellowKey", - "money": "50" + "text": "黄钥匙[50金币]", + "need": "status:money>=50", + "action": [ + { + "type": "comment", + "text": "新版商店中需要手动扣减金币和增加访问次数" + }, + { + "type": "setValue", + "name": "status:money", + "operator": "-=", + "value": "50" + }, + { + "type": "setValue", + "name": "item:yellowKey", + "operator": "+=", + "value": "1" + } + ] }, { - "id": "blueKey", - "money": "100" + "text": "蓝钥匙[100金币]", + "need": "status:money>=100", + "action": [ + { + "type": "comment", + "text": "新版商店中需要手动扣减金币和增加访问次数" + }, + { + "type": "setValue", + "name": "status:money", + "operator": "-=", + "value": "100" + }, + { + "type": "setValue", + "name": "item:blueKey", + "operator": "+=", + "value": "1" + } + ] } ] }, { "id": "mdefShop", - "text": "\t[魔防商人]给我${flag:mdefShop}经验和${flag:mdefShop}金币我就给你${flag:mdefShop}点魔防", + "text": "给我${flag:mdefShop}枚金币和${flag:mdefShop}点经验,我就给你\n${flag:mdefShop}点魔防护甲。", "textInList": "魔防商人", "mustEnable": false, "disablePreview": false, diff --git a/project/floors/MT0.js b/project/floors/MT0.js index 139c24a..f98263f 100644 --- a/project/floors/MT0.js +++ b/project/floors/MT0.js @@ -44,6 +44,11 @@ main.floors.MT0= { "type": "function", "function": "function(){\ncore.addItem('fly',-1);\n}" + }, + { + "type": "setValue", + "name": "flag:isRMTitle", + "value": "false" } ], "events": { @@ -939,16 +944,25 @@ main.floors.MT0= "opacity": 1, "time": 0 }, - "\t[商人]我这里有一些钥匙,你需要么?", { - "type": "hideImage", - "code": 1, - "time": 0 + "type": "setValue", + "name": "flag:isRMshop", + "value": "true" }, { "type": "openShop", "id": "0fKey", "open": true + }, + { + "type": "setValue", + "name": "flag:isRMshop", + "value": "false" + }, + { + "type": "hideImage", + "code": 1, + "time": 0 } ], "false": [] @@ -970,10 +984,20 @@ main.floors.MT0= } ] }, + { + "type": "setValue", + "name": "flag:isRMshop", + "value": "true" + }, { "type": "openShop", "id": "mdefShop", "open": true + }, + { + "type": "setValue", + "name": "flag:isRMshop", + "value": "false" } ], "false": [] diff --git a/project/floors/MT11.js b/project/floors/MT11.js index 230ac08..90ddeee 100644 --- a/project/floors/MT11.js +++ b/project/floors/MT11.js @@ -11,10 +11,20 @@ main.floors.MT11= "firstArrive": [], "events": { "9,9": [ + { + "type": "setValue", + "name": "flag:isRMshop", + "value": "true" + }, { "type": "openShop", "id": "moneyShop1", "open": true + }, + { + "type": "setValue", + "name": "flag:isRMshop", + "value": "false" } ] }, diff --git a/project/floors/QISHI.js b/project/floors/QISHI.js index 607fad9..5fc6f23 100644 --- a/project/floors/QISHI.js +++ b/project/floors/QISHI.js @@ -132,7 +132,7 @@ main.floors.QISHI= "opacity": 1, "time": 500 }, - "\t[邵虎]公主下请不要再任性了。你看看你都跑多远了。", + "\t[邵虎]公主殿下请不要再任性了。你看看你都跑多远了。", "\t[公主]不用你管。", { "type": "function", diff --git a/project/floors/nandu.js b/project/floors/nandu.js index b97af76..d0863c2 100644 --- a/project/floors/nandu.js +++ b/project/floors/nandu.js @@ -38,6 +38,11 @@ main.floors.nandu= "4,3": null, "4,7": null, "1,0": [ + { + "type": "setValue", + "name": "flag:isRMTitle", + "value": "true" + }, { "type": "setGlobalAttribute", "name": "font", @@ -202,7 +207,7 @@ main.floors.nandu= "true": [ { "type": "function", - "function": "function(){\ncore.insertAction([{\n\t\"type\": \"choices\",\n\t\"text\": \"\\\\c[21] 是否选择\" + [\"\\u000d[#ffff80]作弊\", \"\\u000d[#80ff80]简单\", \"\\u000d[#8080ff]普通\", \"\\u000d[#ff80ff]困难\", \"\\u000d[#ff8080]噩梦\", \"\\u000d[#ffff80]作弊\"][flags.hard] + \"\\u000d难度?\",\n\t\"choices\": [{\n\t\t\t\"text\": \"是\",\n\t\t\t\"action\": [\n\t\t\t\t{ \"type\": \"break\" },\n\t\t\t]\n\t\t},\n\t\t{\n\t\t\t\"text\": \"否\",\n\t\t\t\"action\": [\n\t\t\t\t{ \"type\": \"setValue\", \"name\": \"fla\" + \"g:xuanzhong\", \"value\": \"0\" },\n\t\t\t]\n\t\t},\n\t]\n}, ])\n}" + "function": "function(){\ncore.insertAction([{\n\t\"type\": \"choices\",\n\t\"text\": \"\\\\\\c[21] 是否选择\" + [\"\\u000d[#ffff80]作弊\", \"\\u000d[#80ff80]简单\", \"\\u000d[#8080ff]普通\", \"\\u000d[#ff80ff]困难\", \"\\u000d[#ff8080]噩梦\", \"\\u000d[#ffff80]作弊\"][flags.hard] + \"\\u000d难度?\",\n\t\"choices\": [{\n\t\t\t\"text\": \"是\",\n\t\t\t\"action\": [\n\t\t\t\t{ \"type\": \"break\" },\n\t\t\t]\n\t\t},\n\t\t{\n\t\t\t\"text\": \"否\",\n\t\t\t\"action\": [\n\t\t\t\t{ \"type\": \"setValue\", \"name\": \"fla\" + \"g:xuanzhong\", \"value\": \"0\" },\n\t\t\t]\n\t\t},\n\t]\n}, ])\n}" } ], "false": [ @@ -254,7 +259,7 @@ main.floors.nandu= }, { "type": "function", - "function": "function(){\ncore.drawTextContent('shifoutiaoguo', '是否跳过开始剧情,直接进入游戏?', { \t\t\t\tleft: 150, \t\t\t\ttop: 180, \t\t\t\tmaxWidth: 400, \t\t\t\tfontSize: 20, \t\t\t\tlineHeight: 20, \t\t\t\tbold: false, \t\t\t});\n}" + "function": "function(){\ncore.drawTextContent('shifoutiaoguo', '是否跳过开始剧情,直接进入游戏?', { \t\t\t\tleft: 100, \t\t\t\ttop: 180, \t\t\t\tmaxWidth: 400, \t\t\t\tfontSize: 20, \t\t\t\tlineHeight: 20, \t\t\t\tbold: false, \t\t\t});\n}" }, { "type": "setText", diff --git a/project/plugins.js b/project/plugins.js index eb677d8..9dd5dd6 100644 --- a/project/plugins.js +++ b/project/plugins.js @@ -381,48 +381,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = core.setAutoHeroMove(); } - ui.prototype._drawChoices_drawChoices = function (choices, isWindowSkin, hPos, vPos, ctx) { - var hasCtx = ctx != null; - ctx = ctx || 'ui'; - // 选项 - core.setTextAlign(ctx, 'center'); - core.setFont(ctx, this._buildFont(17, true)); - for (var i = 0; i < choices.length; i++) { - var color = core.arrayToRGBA(choices[i].color || core.status.textAttribute.text); - if (main.mode == 'play' && choices[i].need != null && choices[i].need != '' && !core.calValue(choices[i].need)) color = '#999999'; - core.setFillStyle(ctx, color); - var offset = core._PX_ / 2; - if (choices[i].icon) { - var iconInfo = this._getDrawableIconInfo(choices[i].icon), - image = iconInfo[0], - icon = iconInfo[1]; - if (image != null) { - core.drawImage(ctx, image, 0, 32 * icon, 32, 32, - core._PX_ / 2 - choices[i].width / 2, vPos.choice_top + 32 * i - 17, 22, 22); - offset += 14; - } - } - core.fillText(ctx, choices[i].text, core.status.event.id != 'action' ? offset : offset - 55, vPos.choice_top + 32 * i, color, ui.prototype._buildFont(22, false)); - } - if (choices.length > 0 && core.status.event.selection != 'none') { - core.status.event.selection = core.status.event.selection || 0; - while (core.status.event.selection < 0) core.status.event.selection += choices.length; - while (core.status.event.selection >= choices.length) core.status.event.selection -= choices.length; - var len = choices[core.status.event.selection].width; - if (isWindowSkin) { - if (hasCtx) { - this._drawSelector(ctx, core.status.textAttribute.background, - len + 10, 28, core._PX_ / 2 - len / 2 - 5, vPos.choice_top + 32 * core.status.event.selection - 20); - } else { - this._drawWindowSelector(core.status.textAttribute.background, - core.status.event.id != 'action' ? (core._PX_ / 2 - len / 2 - 5 - 20) : (core._PX_ / 2 - len / 2 - 5 - 60), vPos.choice_top + 32 * core.status.event.selection - 20, core.status.event.id != 'action' ? (len + 10 + 30) : (len + 10 + 30), 28); - } - } else - core.strokeRoundRect(ctx, core._PX_ / 2 - len / 2 - 5, vPos.choice_top + 32 * core.status.event.selection - 20, - len + 10, 28, 6, core.status.globalAttribute.selectColor, 2); - } - } @@ -995,12 +954,12 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = } } core.actions.registerAction('keyDown', '_sys_keyDown_lockControl', core.actions._sys_keyDown_lockControl, 50); - core.actions.registerAction('keyUp', '_sys_keyUp_lockControl', core.actions._sys_keyUp_lockControl, 50); - core.actions.registerAction('ondown', '_sys_ondown_lockControl', core.actions._sys_ondown_lockControl, 30); - core.actions.registerAction('onmove', '_sys_onmove_choices', core.actions._sys_onmove_choices, 30); - main.dom.statusCanvas.onmousedown = main.dom.statusCanvas.onclick; + core.actions.registerAction('keyUp', '_sys_keyUp_lockControl', core.actions._sys_keyUp_lockControl, 50); + core.actions.registerAction('ondown', '_sys_ondown_lockControl', core.actions._sys_ondown_lockControl, 30); + core.actions.registerAction('onmove', '_sys_onmove_choices', core.actions._sys_onmove_choices, 30); + main.dom.statusCanvas.onmousedown = main.dom.statusCanvas.onclick; main.dom.statusCanvas.onclick = null; - main.dom.statusCanvas.onmousemove = function(e) { + main.dom.statusCanvas.onmousemove = function (e) { try { e.stopPropagation(); if (e == null) return; @@ -1025,7 +984,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = } } if (core.status.lockControl) return false; - + if (core.status.preview.dragging) { core.setViewport(core.bigmap.offsetX - px + core.status.preview.px, core.bigmap.offsetY - py + core.status.preview.py); core.status.preview.px = px; @@ -1037,15 +996,16 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = return true; else core.status.preview.prepareDragging = false; } - + clearTimeout(core.timeout.onDownTimeout); core.timeout.onDownTimeout = null; - + if ((core.status.stepPostfix || []).length > 0) { var pos = { 'x': parseInt((px + core.bigmap.offsetX) / 32), 'y': parseInt((py + core.bigmap.offsetY) / 32) }; var pos0 = core.status.stepPostfix[core.status.stepPostfix.length - 1]; var directionDistance = [pos.y - pos0.y, pos0.x - pos.x, pos0.y - pos.y, pos.x - pos0.x]; - var max = 0, index = 4; + var max = 0, + index = 4; for (var ii = 0; ii < 4; ii++) { if (directionDistance[ii] > max) { index = ii; @@ -4488,7 +4448,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = if (titleInfo.title) { let titlefont = core.status.textAttribute.titlefont, titleStyle = core.arrayToRGBA(core.status.textAttribute.title); - let tf = this._buildFont(titlefont, true), + let tf = this._buildFont(titlefont, false), ///取消加粗 width = this.calWidth(ctx, titleInfo.title, tf); this.drawBackground(hPos.left, vPos.top - titlefont - 12 - 10, hPos.left + width + 30, vPos.top, posInfo); ctx.save(); @@ -4574,5 +4534,334 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = } } +}, + "仿RM样式商店": function () { + ////// 绘制一个选项界面 ////// + ui.prototype.drawChoices = function (content, choices, width, ctx) { + choices = core.clone(choices || []); + + core.status.event.ui = { "text": content, "choices": choices, "width": width }; + this.clearUI(); + + content = core.replaceText(content || ""); + var titleInfo = this._getTitleAndIcon(content); + titleInfo.content = this._drawTextBox_drawImages(titleInfo.content, ctx); + var hPos = this._drawChoices_getHorizontalPosition(titleInfo, choices, width, ctx); + var vPos = this._drawChoices_getVerticalPosition(titleInfo, choices, hPos); + core.status.event.ui.offset = vPos.offset; + + var isWindowSkin = this.drawBackground(hPos.left, vPos.top, hPos.right, vPos.bottom, { ctx: ctx }); + //var isWindowSkin = this.drawBackground(hPos.left, vPos.top - titlefont - 12 - 10, hPos.left + width + 30, vPos.top, posInfo); + this._drawChoices_drawTitle(titleInfo, hPos, vPos, ctx); + this._drawChoices_drawChoices(choices, isWindowSkin, hPos, vPos, ctx); + } + + ui.prototype._drawChoices_getHorizontalPosition = function (titleInfo, choices, width, ctx) { + ctx = ctx || 'ui'; + // 宽度计算:考虑提示文字和选项的长度 + core.setFont(ctx, this._buildFont(22, false)); + var width = this._calTextBoxWidth(ctx, titleInfo.content || "", width || 246, core._PX_ - 20); + for (var i = 0; i < choices.length; i++) { + if (typeof choices[i] === 'string') + choices[i] = { "text": choices[i] }; + choices[i].text = core.replaceText(choices[i].text); + choices[i].width = core.calWidth(ctx, core.replaceText(choices[i].text)); + if (choices[i].icon != null) choices[i].width += 28; + width = Math.max(width, choices[i].width + 30); + } + var left = (core._PX_ - width) / 2, + right = left + width; + if (flags.isRMshop) { + left = 7 + 3 * (core._HALF_WIDTH_ - 6); + right = core._PX_ - left; + } + var content_left = left + (titleInfo.icon == null ? 15 : 60), + validWidth = right - content_left - 10; + + return { left: left, right: right, width: width, content_left: content_left, validWidth: validWidth }; + } + + ui.prototype._drawChoices_getVerticalPosition = function (titleInfo, choices, hPos) { + var length = choices.length; + var height = 32 * (length + 2), + bottom = core._PY_ / 2 + height / 2; + if (flags.isRMshop) + bottom += 160; + if (length % 2 == 0) bottom += 16; + var offset = 0; + var choice_top = bottom - height + 56; + if (titleInfo.content) { + var headHeight = 0; + if (titleInfo.title) headHeight += 25; + headHeight += this.getTextContentHeight(titleInfo.content, { + lineHeight: 20, + maxWidth: hPos.validWidth, + fontSize: 15, + bold: true + }); + height += headHeight; + if (bottom - height <= 32) { + offset = Math.floor(headHeight / 64); + bottom += 32 * offset; + choice_top += 32 * offset; + } + } + return { top: bottom - height, height: height, bottom: bottom, choice_top: choice_top, offset: offset }; + } + + ui.prototype._drawChoices_drawTitle = function (titleInfo, hPos, vPos, ctx) { + if (!titleInfo.content) return; + ctx = ctx || 'ui'; + var content_top = vPos.top + 21; + if (titleInfo.title != null) { + core.setTextAlign(ctx, 'center'); + + content_top = vPos.top + 41; + var title_offset = hPos.left + hPos.width / 2; + // 动画 + + if (titleInfo.icon != null) { + title_offset += 12; + core.strokeRect(ctx, hPos.left + 15 - 1, vPos.top + 30 - 1, 34, titleInfo.height + 2, '#DDDDDD', 2); + core.status.boxAnimateObjs = []; + if (titleInfo.bigImage) { + core.status.boxAnimateObjs.push({ + bigImage: titleInfo.bigImage, + face: titleInfo.face, + centerX: hPos.left + 15 + 16, + centerY: vPos.top + 30 + titleInfo.height / 2, + max_width: 50, + ctx: ctx + }); + } else { + core.status.boxAnimateObjs.push({ + 'bgx': hPos.left + 15, + 'bgy': vPos.top + 30, + 'bgWidth': 32, + 'bgHeight': titleInfo.height, + 'x': hPos.left + 15, + 'y': vPos.top + 30, + 'height': titleInfo.height, + 'animate': titleInfo.animate, + 'image': titleInfo.image, + 'pos': titleInfo.icon * titleInfo.height, + ctx: ctx + }); + } + core.drawBoxAnimate(); + }; + + core.fillText(ctx, titleInfo.title, title_offset, vPos.top + 27, + core.arrayToRGBA(core.status.textAttribute.title), this._buildFont(22, false)); + } + + core.setTextAlign(ctx, 'left'); + this.drawTextContent(ctx, titleInfo.content, { + left: hPos.content_left, + top: content_top, + maxWidth: hPos.validWidth, + fontSize: 22, + lineHeight: 20, + bold: false + }); + } + + ui.prototype._drawChoices_drawChoices = function (choices, isWindowSkin, hPos, vPos, ctx) { + var hasCtx = ctx != null; + ctx = ctx || 'ui'; + // 选项 + core.setTextAlign(ctx, 'center'); + core.setFont(ctx, this._buildFont(17, true)); + for (var i = 0; i < choices.length; i++) { + var color = core.arrayToRGBA(choices[i].color || core.status.textAttribute.text); + if (main.mode == 'play' && choices[i].need != null && choices[i].need != '' && !core.calValue(choices[i].need)) color = '#999999'; + core.setFillStyle(ctx, color); + var offset = core._PX_ / 2; + if (choices[i].icon) { + var iconInfo = this._getDrawableIconInfo(choices[i].icon), + image = iconInfo[0], + icon = iconInfo[1]; + if (image != null) { + core.drawImage(ctx, image, 0, 32 * icon, 32, 32, + core._PX_ / 2 - choices[i].width / 2, vPos.choice_top + 32 * i - 17, 22, 22); + offset += 14; + } + } + core.fillText(ctx, choices[i].text, core.status.event.id != 'action' ? offset : offset - 55, vPos.choice_top + 32 * i, color, ui.prototype._buildFont(22, false)); + } + + if (choices.length > 0 && core.status.event.selection != 'none') { + core.status.event.selection = core.status.event.selection || 0; + while (core.status.event.selection < 0) core.status.event.selection += choices.length; + while (core.status.event.selection >= choices.length) core.status.event.selection -= choices.length; + var len = choices[core.status.event.selection].width; + if (isWindowSkin) { + if (hasCtx) { + this._drawSelector(ctx, core.status.textAttribute.background, + len + 10, 28, core._PX_ / 2 - len / 2 - 5, vPos.choice_top + 32 * core.status.event.selection - 20); + } else { + this._drawWindowSelector(core.status.textAttribute.background, + core.status.event.id != 'action' ? (core._PX_ / 2 - len / 2 - 5 - 20) : (core._PX_ / 2 - len / 2 - 5 - 60), vPos.choice_top + 32 * core.status.event.selection - 20, core.status.event.id != 'action' ? (len + 10 + 30) : (len + 10 + 30), 28); + } + } else + core.strokeRoundRect(ctx, core._PX_ / 2 - len / 2 - 5, vPos.choice_top + 32 * core.status.event.selection - 20, + len + 10, 28, 6, core.status.globalAttribute.selectColor, 2); + } + } + + ui.prototype._drawChoices_drawChoices = function (choices, isWindowSkin, hPos, vPos, ctx) { + var hasCtx = ctx != null; + ctx = ctx || 'ui'; + // 选项 + core.setTextAlign(ctx, 'center'); + core.setFont(ctx, this._buildFont(17, true)); + if (flags.isRMshop || flags.isRMTitle) { + core.setTextAlign(ctx, 'left'); + core.setFont(ctx, this._buildFont(22, false)); + } + for (var i = 0; i < choices.length; i++) { + var color = core.arrayToRGBA(choices[i].color || core.status.textAttribute.text); + if (main.mode == 'play' && choices[i].need != null && choices[i].need != '' && !core.calValue(choices[i].need)) color = '#999999'; + core.setFillStyle(ctx, color); + var offset = core._PX_ / 2; + if (flags.isRMshop) + offset = 30; + if (flags.isRMTitle) + offset = 130; + if (choices[i].icon) { + var iconInfo = this._getDrawableIconInfo(choices[i].icon), + image = iconInfo[0], + icon = iconInfo[1]; + if (image != null) { + core.drawImage(ctx, image, 0, 32 * icon, 32, 32, + core._PX_ / 2 - choices[i].width / 2, vPos.choice_top + 32 * i - 17, 22, 22); + offset += 14; + } + } + core.fillText(ctx, choices[i].text, offset, vPos.choice_top + 32 * i, color); + } + + if (choices.length > 0 && core.status.event.selection != 'none') { + core.status.event.selection = core.status.event.selection || 0; + while (core.status.event.selection < 0) core.status.event.selection += choices.length; + while (core.status.event.selection >= choices.length) core.status.event.selection -= choices.length; + var len = choices[core.status.event.selection].width; + var rightX = core._PX_ / 2 - len / 2 - 5; + if (flags.isRMshop) + rightX = 30; + if (flags.isRMTitle) + rightX = 130; + if (isWindowSkin) { + if (hasCtx) { + this._drawSelector(ctx, core.status.textAttribute.background, + len + 10, 28, core._PX_ / 2 - len / 2 - 5, vPos.choice_top + 32 * core.status.event.selection - 20); + } else { + this._drawWindowSelector(core.status.textAttribute.background, + rightX, vPos.choice_top + 32 * core.status.event.selection - 20, len + 10, 28); + } + } else + core.strokeRoundRect(ctx, core._PX_ / 2 - len / 2 - 5, vPos.choice_top + 32 * core.status.event.selection - 20, + len + 10, 28, 6, core.status.globalAttribute.selectColor, 2); + } + } + actions.prototype._getChoicesTopIndex = function (length) { + if (flags.isRMshop) + return this._HY_ - parseInt((length - 1) / 2) + (core.status.event.ui.offset || 0) + 5; + else + return this._HY_ - parseInt((length - 1) / 2) + (core.status.event.ui.offset || 0); + } + // 移动光标 + actions.prototype._onMoveChoices = function (x, y) { + if (flags.isRMshop || flags.isRMTitle); + else if (this._out(x)) return; + var choices = core.status.event.ui.choices; + var topIndex = this._getChoicesTopIndex(choices.length); + if (y >= topIndex && y < topIndex + choices.length) { + var selection = y - topIndex; + if (selection == core.status.event.selection) return; + core.status.event.selection = selection; + core.playSound('光标移动'); + core.ui.drawChoices(core.status.event.ui.text, core.status.event.ui.choices, core.status.event.ui.width); + } + } + ////// 自定义事件时的点击操作 ////// + actions.prototype._clickAction = function (x, y, px, py) { + if (core.status.event.data.type == 'text') { + return this._clickAction_text(); + } + + if (core.status.event.data.type == 'wait') { + var timeout = Math.max(0, core.status.event.timeout - new Date().getTime()) || 0; + core.setFlag('type', 1); + core.setFlag('x', x); + core.setFlag('y', y); + core.setFlag('px', px); + core.setFlag('py', py); + core.setFlag('timeout', timeout); + var executed = core.events.__action_wait_afterGet(core.status.event.data.current); + if (executed || !core.status.event.data.current.forceChild) { + core.status.route.push("input:" + (1e8 * timeout + 1000000 + 1000 * px + py)); + clearTimeout(core.status.event.interval); + delete core.status.event.timeout; + core.doAction(); + } + return; + } + + if (core.status.event.data.type == 'choices') { + // 选项 + var data = core.status.event.data.current; + var choices = data.choices; + if (choices.length == 0) return; + if (flags.isRMshop || flags.isRMTitle); + else if (this._out(x)) return; + var topIndex = this._getChoicesTopIndex(choices.length); + if (y >= topIndex && y < topIndex + choices.length) { + var choice = choices[y - topIndex]; + if (choice.need != null && choice.need != '' && !core.calValue(choice.need)) { + core.playSound('操作失败'); + core.drawTip("无法选择此项"); + return; + } + clearTimeout(core.status.event.interval); + var timeout = Math.max(0, core.status.event.timeout - new Date().getTime()) || 0; + delete core.status.event.timeout; + core.setFlag('timeout', timeout); + // 对全局商店特殊处理 + var index = y - topIndex; + if (index == choices.length - 1 && core.hasFlag('@temp@shop')) { + index = -1; + } + core.status.route.push("choices:" + (100 * timeout + index)); + core.insertAction(choice.action); + core.doAction(); + } + return; + } + + if (core.status.event.data.type == 'confirm') { + if ((x == this._HX_ - 2 || x == this._HX_ - 1) && y == this._HY_ + 1) { + clearTimeout(core.status.event.interval); + var timeout = Math.max(0, core.status.event.timeout - new Date().getTime()) || 0; + delete core.status.event.timeout; + core.setFlag('timeout', timeout); + core.status.route.push("choices:" + 100 * timeout); + core.insertAction(core.status.event.ui.yes); + core.doAction(); + } else if ((x == this._HX_ + 2 || x == this._HX_ + 1) && y == this._HY_ + 1) { + clearTimeout(core.status.event.interval); + var timeout = Math.max(0, core.status.event.timeout - new Date().getTime()) || 0; + delete core.status.event.timeout; + core.setFlag('timeout', timeout); + core.status.route.push("choices:" + (100 * timeout + 1)); + core.insertAction(core.status.event.ui.no); + core.doAction(); + } + return; + } + } + + + } } \ No newline at end of file