|
|
|
@ -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;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|