|
|
|
@ -380,94 +380,12 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
|
|
|
|
// 立刻移动
|
|
|
|
|
core.setAutoHeroMove();
|
|
|
|
|
}
|
|
|
|
|
////// 绘制一个对话框 //////
|
|
|
|
|
/*core.ui.drawTextBox = function (content, config) {
|
|
|
|
|
config = config || {};
|
|
|
|
|
|
|
|
|
|
this.clearUI();
|
|
|
|
|
content = core.replaceText(content);
|
|
|
|
|
|
|
|
|
|
let ctx = core.getContextByName(config.ctx || 'ui');
|
|
|
|
|
if (ctx && main.mode == 'play') {
|
|
|
|
|
core.createCanvas(ctx, 0, 0, core._PX_, core._PY_, 141);
|
|
|
|
|
ctx = core.getContextByName(ctx);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Step 1: 获得标题信息和位置信息
|
|
|
|
|
var textAttribute = core.status.textAttribute;
|
|
|
|
|
var titleInfo = this._getTitleAndIcon(content);
|
|
|
|
|
var posInfo = this._getPosition(titleInfo.content);
|
|
|
|
|
if (posInfo.position != 'up' && posInfo.position != 'down') posInfo.px = posInfo.py = null;
|
|
|
|
|
if (!posInfo.position) posInfo.position = textAttribute.position;
|
|
|
|
|
content = this._drawTextBox_drawImages(posInfo.content, config.ctx);
|
|
|
|
|
if (config.pos) {
|
|
|
|
|
delete posInfo.px;
|
|
|
|
|
delete posInfo.py;
|
|
|
|
|
posInfo.pos = config.pos;
|
|
|
|
|
}
|
|
|
|
|
posInfo.ctx = ctx;
|
|
|
|
|
|
|
|
|
|
// Step 2: 计算对话框的矩形位置
|
|
|
|
|
var hPos = this._drawTextBox_getHorizontalPosition(content, titleInfo, posInfo);
|
|
|
|
|
var vPos = this._drawTextBox_getVerticalPosition(content, titleInfo, posInfo, hPos.validWidth);
|
|
|
|
|
posInfo.xoffset = hPos.xoffset;
|
|
|
|
|
posInfo.yoffset = vPos.yoffset - 4;
|
|
|
|
|
|
|
|
|
|
if (ctx && main.mode == 'play') {
|
|
|
|
|
ctx.canvas.setAttribute('_text_left', hPos.left);
|
|
|
|
|
ctx.canvas.setAttribute('_text_top', vPos.top);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Step 3: 绘制背景图
|
|
|
|
|
var isWindowSkin = this.drawBackground(hPos.left, vPos.top, hPos.right, vPos.bottom, posInfo);
|
|
|
|
|
|
|
|
|
|
if (titleInfo.title) {
|
|
|
|
|
let titlefont = core.status.textAttribute.titlefont,
|
|
|
|
|
titleStyle = core.arrayToRGBA(core.status.textAttribute.title);
|
|
|
|
|
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();
|
|
|
|
|
ctx.textAlign = 'center';
|
|
|
|
|
ctx.textBaseline = 'middle';
|
|
|
|
|
core.fillText(ctx, titleInfo.title, hPos.left + (width + 30) / 2 - 5, vPos.top - (titlefont + 12) / 2 - 5, titleStyle, tf);
|
|
|
|
|
ctx.restore();
|
|
|
|
|
}
|
|
|
|
|
titleInfo.title = null;
|
|
|
|
|
|
|
|
|
|
var alpha = isWindowSkin ? this._drawWindowSkin_getOpacity() : textAttribute.background[3];
|
|
|
|
|
|
|
|
|
|
// Step 4: 绘制标题、头像、动画
|
|
|
|
|
var content_top = this._drawTextBox_drawTitleAndIcon(titleInfo, hPos, vPos, alpha, config.ctx);
|
|
|
|
|
|
|
|
|
|
// Step 5: 绘制正文
|
|
|
|
|
var config = this.drawTextContent(config.ctx || 'ui', content, {
|
|
|
|
|
left: hPos.content_left,
|
|
|
|
|
top: content_top,
|
|
|
|
|
maxWidth: hPos.validWidth,
|
|
|
|
|
lineHeight: vPos.lineHeight,
|
|
|
|
|
time: (config.showAll || config.async || textAttribute.time <= 0 || core.status.event.id != 'action') ? 0 : textAttribute.time
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// Step 6: 绘制光标
|
|
|
|
|
if (main.mode == 'play') {
|
|
|
|
|
main.dom.next.style.display = 'block';
|
|
|
|
|
main.dom.next.style.borderRightColor = main.dom.next.style.borderBottomColor = core.arrayToRGB(textAttribute.text);
|
|
|
|
|
main.dom.next.style.top = (vPos.bottom - 20) * core.domStyle.scale + "px";
|
|
|
|
|
var left = (hPos.left + hPos.right) / 2;
|
|
|
|
|
if (posInfo.position == 'up' && !posInfo.noPeak && posInfo.px != null && Math.abs(posInfo.px * 32 + 16 - left) < 50)
|
|
|
|
|
left = hPos.right - 64;
|
|
|
|
|
main.dom.next.style.left = left * core.domStyle.scale + "px";
|
|
|
|
|
}
|
|
|
|
|
return config;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
ui.prototype._drawChoices_drawChoices = function (choices, isWindowSkin, hPos, vPos, ctx) {
|
|
|
|
|
var hasCtx = ctx != null;
|
|
|
|
|
ctx = ctx || 'ui';
|
|
|
|
|
// 选项
|
|
|
|
|
core.setTextAlign(ctx, 'left');
|
|
|
|
|
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);
|
|
|
|
@ -484,7 +402,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
|
|
|
|
offset += 14;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
core.fillText(ctx, choices[i].text, offset - 70, vPos.choice_top + 32 * i, color, ui.prototype._buildFont(22, false));
|
|
|
|
|
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') {
|
|
|
|
@ -498,7 +416,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
|
|
|
|
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._PX_ / 2 - len / 2 - 5 - 60, vPos.choice_top + 32 * core.status.event.selection - 20, len + 10, 28);
|
|
|
|
|
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,
|
|
|
|
@ -927,7 +845,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
|
|
|
|
case 'shuangta':
|
|
|
|
|
this._clickShuangta(x, y, px, py);
|
|
|
|
|
break;
|
|
|
|
|
case 'RM':
|
|
|
|
|
case 'rm':
|
|
|
|
|
this._clickRM(x, y, px, py);
|
|
|
|
|
break;
|
|
|
|
|
case 'about':
|
|
|
|
@ -1189,8 +1107,8 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
|
|
|
|
top + 28, '#ffffff', this._buildFont(enemy.name.length >= 5 ? 18 : 20, false), width); /////修改怪物名字颜色,取消加粗
|
|
|
|
|
switch (enemy.specialText.length) {
|
|
|
|
|
case 1:
|
|
|
|
|
core.fillText('ui', ((!core.getFlag('isCommon') || (2 != enemy.specialText[0].length))
|
|
|
|
|
? enemy.specialText[0] : enemy.specialText[0][0] + ' ' + enemy.specialText[0][1]),
|
|
|
|
|
core.fillText('ui', ((!core.getFlag('isCommon') || (2 != enemy.specialText[0].length)) ?
|
|
|
|
|
enemy.specialText[0] : enemy.specialText[0][0] + ' ' + enemy.specialText[0][1]),
|
|
|
|
|
left + width / 2, ////单属性两个字中间空一格
|
|
|
|
|
top + 50, core.arrayToRGBA((enemy.specialColor || [])[0] || '#FF6A6A'),
|
|
|
|
|
this._buildFont(20, false), width); ////调大怪物字号,取消加粗
|
|
|
|
@ -1409,7 +1327,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
|
|
|
|
this.drawPagination(info.constantsPage, info.constantsTotalPage);
|
|
|
|
|
|
|
|
|
|
core.setTextAlign('ui', 'center');
|
|
|
|
|
core.fillText('ui', '[装备栏]', core._PX_ - 46, 25, '#DDDDDD', this._buildFont(15, true));
|
|
|
|
|
//core.fillText('ui', '[装备栏]', core._PX_ - 46, 25, '#DDDDDD', this._buildFont(15, true));
|
|
|
|
|
core.fillText('ui', '返回游戏', core._PX_ - 46, core._PY_ - 13);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -1489,6 +1407,137 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
|
|
|
|
if (callback) callback();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
////// “即捡即用类”道具的使用效果 //////
|
|
|
|
|
items.prototype.getItemEffect = function (itemId, itemNum) {
|
|
|
|
|
var itemCls = core.material.items[itemId].cls;
|
|
|
|
|
// 消耗品
|
|
|
|
|
if (itemCls === 'items' || itemCls === "equips") {
|
|
|
|
|
var curr_hp = core.status.hero.hp;
|
|
|
|
|
var itemEffect = core.material.items[itemId].itemEffect;
|
|
|
|
|
if (itemEffect) {
|
|
|
|
|
try {
|
|
|
|
|
for (var i = 0; i < itemNum; ++i)
|
|
|
|
|
eval(itemEffect);
|
|
|
|
|
} catch (e) {
|
|
|
|
|
console.error(e);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
core.status.hero.statistics.hp += core.status.hero.hp - curr_hp;
|
|
|
|
|
|
|
|
|
|
var useItemEvent = core.material.items[itemId].useItemEvent;
|
|
|
|
|
if (useItemEvent) {
|
|
|
|
|
try {
|
|
|
|
|
core.insertAction(useItemEvent);
|
|
|
|
|
} catch (e) {
|
|
|
|
|
console.error(e);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
core.updateStatusBar(false, true);
|
|
|
|
|
} else {
|
|
|
|
|
core.addItem(itemId, itemNum);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/////屏蔽装备栏
|
|
|
|
|
////// 点击装备栏时的打开操作 //////
|
|
|
|
|
events.prototype.openEquipbox = function (fromUserAction) {
|
|
|
|
|
if (core.isReplaying() || true) return; ////直接返回
|
|
|
|
|
if (!this._checkStatus('equipbox', fromUserAction)) return;
|
|
|
|
|
core.playSound('打开界面');
|
|
|
|
|
core.ui._drawEquipbox();
|
|
|
|
|
}
|
|
|
|
|
////// 工具栏界面时的点击操作 //////
|
|
|
|
|
actions.prototype._clickToolbox = function (x, y) {
|
|
|
|
|
var tools = core.getToolboxItems('tools'),
|
|
|
|
|
constants = core.getToolboxItems('constants');
|
|
|
|
|
|
|
|
|
|
// 装备栏
|
|
|
|
|
// if (x >= this.LAST - 2 && y == 0) {
|
|
|
|
|
// core.ui.closePanel();
|
|
|
|
|
// if (core.isReplaying())
|
|
|
|
|
// core.control._replay_equipbox();
|
|
|
|
|
// else
|
|
|
|
|
// core.openEquipbox();
|
|
|
|
|
// return;
|
|
|
|
|
// }
|
|
|
|
|
if (x >= this.LAST - 2 && y === core._HEIGHT_ - 1) {
|
|
|
|
|
core.playSound('取消');
|
|
|
|
|
core.ui.closePanel();
|
|
|
|
|
var last = core.status.route[core.status.route.length - 1] || '';
|
|
|
|
|
if (last.startsWith('equip:') || last.startsWith('unEquip:')) {
|
|
|
|
|
core.status.route.push('no');
|
|
|
|
|
}
|
|
|
|
|
core.checkAutoEvents();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var toolsPage = core.status.event.data.toolsPage;
|
|
|
|
|
var constantsPage = core.status.event.data.constantsPage;
|
|
|
|
|
// 上一页
|
|
|
|
|
if (x == this._HX_ - 2 || x == this._HX_ - 3) {
|
|
|
|
|
if (y === core._HEIGHT_ - 1 - 5 && toolsPage > 1) {
|
|
|
|
|
core.status.event.data.toolsPage--;
|
|
|
|
|
core.playSound('光标移动');
|
|
|
|
|
core.ui._drawToolbox(core.status.event.selection);
|
|
|
|
|
}
|
|
|
|
|
if (y === core._HEIGHT_ - 1 && constantsPage > 1) {
|
|
|
|
|
core.status.event.data.constantsPage--;
|
|
|
|
|
core.playSound('光标移动');
|
|
|
|
|
core.ui._drawToolbox(core.status.event.selection);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// 下一页
|
|
|
|
|
if (x == this._HX_ + 2 || x == this._HX_ + 3) {
|
|
|
|
|
if (y === core._HEIGHT_ - 1 - 5 && toolsPage < Math.ceil(tools.length / this.LAST)) {
|
|
|
|
|
core.status.event.data.toolsPage++;
|
|
|
|
|
core.playSound('光标移动');
|
|
|
|
|
core.ui._drawToolbox(core.status.event.selection);
|
|
|
|
|
}
|
|
|
|
|
if (y === core._HEIGHT_ - 1 && constantsPage < Math.ceil(constants.length / this.LAST)) {
|
|
|
|
|
core.status.event.data.constantsPage++;
|
|
|
|
|
core.playSound('光标移动');
|
|
|
|
|
core.ui._drawToolbox(core.status.event.selection);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var index = parseInt(x / 2);
|
|
|
|
|
if (y === core._HEIGHT_ - 1 - 8) index += 0;
|
|
|
|
|
else if (y === core._HEIGHT_ - 1 - 6) index += this._HX_;
|
|
|
|
|
else if (y === core._HEIGHT_ - 1 - 3) index += this.LAST;
|
|
|
|
|
else if (y === core._HEIGHT_ - 1 - 1) index += this.LAST + this._HX_;
|
|
|
|
|
else index = -1;
|
|
|
|
|
if (index >= 0)
|
|
|
|
|
this._clickToolboxIndex(index);
|
|
|
|
|
}
|
|
|
|
|
////// 工具栏界面时,放开某个键的操作 //////
|
|
|
|
|
actions.prototype._keyUpToolbox = function (keycode) {
|
|
|
|
|
// if (keycode == 81) {
|
|
|
|
|
// core.playSound('确定');
|
|
|
|
|
// core.ui.closePanel();
|
|
|
|
|
// if (core.isReplaying())
|
|
|
|
|
// core.control._replay_equipbox();
|
|
|
|
|
// else
|
|
|
|
|
// core.openEquipbox();
|
|
|
|
|
// return;
|
|
|
|
|
//}
|
|
|
|
|
if (keycode == 84 || keycode == 27 || keycode == 88) {
|
|
|
|
|
core.playSound('取消');
|
|
|
|
|
core.ui.closePanel();
|
|
|
|
|
var last = core.status.route[core.status.route.length - 1] || '';
|
|
|
|
|
if (last.startsWith('equip:') || last.startsWith('unEquip:')) {
|
|
|
|
|
core.status.route.push('no');
|
|
|
|
|
}
|
|
|
|
|
core.checkAutoEvents();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (core.status.event.data == null) return;
|
|
|
|
|
|
|
|
|
|
if (keycode == 13 || keycode == 32 || keycode == 67) {
|
|
|
|
|
this._clickToolboxIndex(core.status.event.selection);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
"drawLight": function () {
|
|
|
|
@ -4175,6 +4224,9 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
|
|
|
|
var _my_useS_PASS = function (keycode) { ////放开某个键
|
|
|
|
|
if (!core.getFlag('useS_PASS')) return false;
|
|
|
|
|
if (keycode == 83) { ////按下S时
|
|
|
|
|
if (core.hasAsync())
|
|
|
|
|
core.drawTip('请等待事件结束');
|
|
|
|
|
else
|
|
|
|
|
core.Confirmskip();
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
@ -4184,6 +4236,9 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
|
|
|
|
if (!core.getFlag('useS_PASS')) return false;
|
|
|
|
|
|
|
|
|
|
if (x >= 7 && y <= 2) {
|
|
|
|
|
if (core.hasAsync())
|
|
|
|
|
core.drawTip('请等待事件结束');
|
|
|
|
|
else
|
|
|
|
|
core.Confirmskip();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -4477,5 +4532,47 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
|
|
|
|
core.relocateCanvas('ui', 0, 0);
|
|
|
|
|
_doa.call(core.events);
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
"怪物受击发亮": function () {
|
|
|
|
|
// 在此增加新插件
|
|
|
|
|
// 在此增加新插件
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function pop() {
|
|
|
|
|
var ctx = core.getContextByName('pop');
|
|
|
|
|
if (!ctx) ctx = core.createCanvas('pop', 0, 0, core.__PIXELS__, core.__PIXELS__, 90);
|
|
|
|
|
core.clearMap(ctx);
|
|
|
|
|
|
|
|
|
|
if (core.status.replay.speed <= 3) {
|
|
|
|
|
var list = core.status.pop || [];
|
|
|
|
|
var count = 0;
|
|
|
|
|
list.forEach(function (one) {
|
|
|
|
|
|
|
|
|
|
one.frame++;
|
|
|
|
|
// 绘制
|
|
|
|
|
|
|
|
|
|
core.setFilter(ctx, 'brightness(' + (220 - 6 * one.frame) + '%)');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
core.drawIcon(ctx, one.value, one.px, one.py, 32, 32);
|
|
|
|
|
|
|
|
|
|
if (one.frame >= 20) count++;
|
|
|
|
|
});
|
|
|
|
|
if (count > 0) list.splice(0, count);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!main.replayChecking) {
|
|
|
|
|
core.registerAnimationFrame('pop', true, pop);
|
|
|
|
|
}
|
|
|
|
|
/** 添加弹出内容 */
|
|
|
|
|
this.addPop = function (px, py, value, frame) {
|
|
|
|
|
var data = { px: px, py: py, value: value, frame: frame || 0 };
|
|
|
|
|
if (core.status.replay.speed <= 3) {
|
|
|
|
|
if (!core.status.pop) core.status.pop = [data];
|
|
|
|
|
else core.status.pop.push(data);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|