fix:道具栏和楼传界面的一些小bug

This commit is contained in:
ShakeFlower 2025-07-26 23:06:42 +08:00
parent b2c8d28d5a
commit 3315948b18
2 changed files with 36 additions and 36 deletions

View File

@ -2595,8 +2595,6 @@ ui.prototype.drawFly = function (page) {
core.fillText('ui', isHide ? '[显示本层]' : '[隐藏本层]', 60, 80, '#EEEEEE', this._buildFont(12, false)); core.fillText('ui', isHide ? '[显示本层]' : '[隐藏本层]', 60, 80, '#EEEEEE', this._buildFont(12, false));
core.fillText('ui', '[显示隐藏层:' + (noHideFly ? 'ON' : 'OFF') + ']', 160, 80, '#EEEEEE', this._buildFont(12, false)); core.fillText('ui', '[显示隐藏层:' + (noHideFly ? 'ON' : 'OFF') + ']', 160, 80, '#EEEEEE', this._buildFont(12, false));
core.fillText('ui', '[楼层笔记]', 260, 80, '#EEEEEE', this._buildFont(12, false));
var middle = this.HPIXEL + 39; var middle = this.HPIXEL + 39;
// 换行 // 换行
@ -2629,20 +2627,20 @@ ui.prototype.drawFly = function (page) {
const blockCounts = getFloorBlockCounts(floorId); const blockCounts = getFloorBlockCounts(floorId);
if (blockCounts.enemy > 0) { if (blockCounts.enemy > 0) {
core.drawIcon('ui', 'greenSlime', this.PIXEL - 90, 100, 16, 16); core.drawIcon('ui', 'greenSlime', this.PIXEL - 90, 30, 16, 16);
core.drawIcon('ui', 'redSlime', this.PIXEL - 85, 105, 16, 16); core.drawIcon('ui', 'redSlime', this.PIXEL - 85, 35, 16, 16);
core.fillText('ui', '× ' + blockCounts.enemy, this.PIXEL - 50, 117, 'white', '12px Verdana'); core.fillText('ui', '× ' + blockCounts.enemy, this.PIXEL - 50, 47, 'white', '12px Verdana');
} }
if (blockCounts.item > 0) { if (blockCounts.item > 0) {
core.drawIcon('ui', 'redGem', this.PIXEL - 90, 130, 16, 16); core.drawIcon('ui', 'redGem', this.PIXEL - 90, 60, 16, 16);
core.drawIcon('ui', 'bluePotion', this.PIXEL - 85, 135, 16, 16); core.drawIcon('ui', 'bluePotion', this.PIXEL - 85, 65, 16, 16);
core.fillText('ui', '× ' + blockCounts.item, this.PIXEL - 50, 147, 'white', '12px Verdana'); core.fillText('ui', '× ' + blockCounts.item, this.PIXEL - 50, 77, 'white', '12px Verdana');
} }
if (blockCounts.npc > 0) { if (blockCounts.npc > 0) {
core.drawIcon('ui', 'man', this.PIXEL - 90, 160, 16, 16); core.drawIcon('ui', 'man', this.PIXEL - 90, 90, 16, 16);
core.drawIcon('ui', 'trader', this.PIXEL - 85, 165, 16, 16); core.drawIcon('ui', 'trader', this.PIXEL - 85, 95, 16, 16);
core.fillText('ui', '× ' + blockCounts.npc, this.PIXEL - 50, 177, 'white', '12px Verdana'); core.fillText('ui', '× ' + blockCounts.npc, this.PIXEL - 50, 107, 'white', '12px Verdana');
} }
} }

View File

@ -2942,7 +2942,9 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
} }
const callback = function () { const callback = function () {
UI.redraw(); [UI._equipSlots, UI._equipInv, UI._itemInfo].forEach((menu) => {
if (menu && menu.onDraw) menu.drawContent();
});
core.ui.closePanel(); core.ui.closePanel();
const next = core.status.replay.toReplay[0] || ""; const next = core.status.replay.toReplay[0] || "";
if (!next.startsWith('equip:') && !next.startsWith('unEquip:')) { if (!next.startsWith('equip:') && !next.startsWith('unEquip:')) {
@ -2978,7 +2980,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
// 复写control.startReplay // 复写control.startReplay
const oriStartReplay = core.control.startReplay; // 进入播放录像模式时清空道具栏选中目标的缓存 const oriStartReplay = core.control.startReplay; // 进入播放录像模式时清空道具栏选中目标的缓存
core.control.startReplay = function (list) { core.control.startReplay = function (list) {
UI.clearItemBoxCache(); clearItemBoxCache();
oriStartReplay.apply(core.control, [list, ...arguments]); oriStartReplay.apply(core.control, [list, ...arguments]);
} }
@ -3250,7 +3252,9 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
if (core.material.items[itemId]) itemInv.triggerItem(); if (core.material.items[itemId]) itemInv.triggerItem();
} else if (selectType === "equipBox") { } else if (selectType === "equipBox") {
equipChangeBoard.triggerItem(); equipChangeBoard.triggerItem();
UI.redraw(); [UI._equipSlots, UI._equipInv, UI._itemInfo].forEach((menu) => {
if (menu && menu.onDraw) menu.drawContent();
});
} else { } else {
itemInv.setIndex(0); itemInv.setIndex(0);
} }
@ -3303,7 +3307,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
* @description 选中指定位置 * @description 选中指定位置
* @param {number} index * @param {number} index
**/ **/
setIndex(index){} setIndex(index) { }
/** /**
* @abstract 尝试使用当前选中的物品 * @abstract 尝试使用当前选中的物品
@ -3779,8 +3783,6 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
/** @param {string} itemId */ /** @param {string} itemId */
function hotkeySelectFactory(itemId) { function hotkeySelectFactory(itemId) {
const hotkeySelect = new HotkeySelect(itemId, 60, 100, 296, 206, 141); // 应当比物品背包的选择光标大,遮盖住前者 const hotkeySelect = new HotkeySelect(itemId, 60, 100, 296, 206, 141); // 应当比物品背包的选择光标大,遮盖住前者
/** @type {[string, ButtonBaseClass][]} */
const btnMap = [];
const setHotkeyNum = function (i) { const setHotkeyNum = function (i) {
const num = this.key.replace('btn', ''); const num = this.key.replace('btn', '');
hotkeySelect.setHotkey(num); hotkeySelect.setHotkey(num);
@ -3798,7 +3800,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
let btn; let btn;
if (row === 1) btn = new IconBtn(leftMargin + i * (btnSize + btnInterval), 100, btnSize, btnSize, 'btn' + num, style); if (row === 1) btn = new IconBtn(leftMargin + i * (btnSize + btnInterval), 100, btnSize, btnSize, 'btn' + num, style);
else btn = new IconBtn(leftMargin + (i - 5) * (btnSize + btnInterval), 150, btnSize, btnSize, 'btn' + num, style); else btn = new IconBtn(leftMargin + (i - 5) * (btnSize + btnInterval), 150, btnSize, btnSize, 'btn' + num, style);
hotkeySelect.registerBtn('btn' + num, btn, () => setHotkeyNum(i)); hotkeySelect.registerBtn('btn' + num, btn, () => setHotkeyNum.call(btn, i));
} }
const setNullBtn = new SetNullBtn(leftMargin + 4 * (btnSize + btnInterval), 150, btnSize, btnSize); const setNullBtn = new SetNullBtn(leftMargin + 4 * (btnSize + btnInterval), 150, btnSize, btnSize);
hotkeySelect.registerBtn('setNullBtn', setNullBtn, () => { hotkeySelect.registerBtn('setNullBtn', setNullBtn, () => {
@ -3937,7 +3939,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
const setHotkeyBtn = new IconBtn(145, 60, 24, 24, 'keyboard'); const setHotkeyBtn = new IconBtn(145, 60, 24, 24, 'keyboard');
this.itemInfo.registerBtn('setHotkeyBtn', setHotkeyBtn, () => { this.itemInfo.registerBtn('setHotkeyBtn', setHotkeyBtn, () => {
if (!UI.itemId) return; if (!UI.itemId) return;
[UI.back, UI.itemInv, UI.equipSlots, UI.itemInfo].forEach((menu) => { [UI._back, UI.itemInv, UI._equipSlots, UI._itemInfo].forEach((menu) => {
if (menu) menu.endListen(); if (menu) menu.endListen();
}); });
const hotkeySelect = hotkeySelectFactory(UI.itemId); const hotkeySelect = hotkeySelectFactory(UI.itemId);
@ -4146,8 +4148,8 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
let equipType = core.material.items[j].equip.type; let equipType = core.material.items[j].equip.type;
switch (typeof equipType) { switch (typeof equipType) {
case 'number': case 'number':
for (let k = 0, l = equipOwned[j]; k < l; k++) { for (let k = 0, l = equipOwned[j]; k < l; k++) {
equipList[equipIncluded.indexOf(equipType)].add(j); equipList[equipIncluded.indexOf(equipType)].add(j);
} }
break; break;
case 'string': case 'string':
@ -4479,7 +4481,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
} }
// @todo 悬浮按钮不改变时不触发事件 这个优化有没有做 // @todo 悬浮按钮不改变时不触发事件 这个优化有没有做
/** 单个设置菜单的基类 */ /** 单个设置菜单的基类 */
class SettingOnePage extends MenuBase { class SettingOnePage extends MenuBase {
constructor(name, settingData) { constructor(name, settingData) {
@ -4551,7 +4553,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
const setting = btn.setting; const setting = btn.setting;
setting.effect.apply(this, eventArgs); setting.effect.apply(this, eventArgs);
if (setting.replay) { if (setting.replay) {
let actionString = 'cSet:' + key; let actionString = 'cSet:' + key;
if (eventArgs && eventArgs.length > 0) { if (eventArgs && eventArgs.length > 0) {
actionString += ':' + eventArgs.map(arg => encodeURIComponent(arg)).join(':'); actionString += ':' + eventArgs.map(arg => encodeURIComponent(arg)).join(':');
} }
@ -5033,21 +5035,21 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
clearHotKeys: { clearHotKeys: {
getName: () => '', getName: () => '',
effect: /** @this {GameView} */ effect: /** @this {GameView} */
function () { function () {
for (let i = 1; i <= 9; i++) { for (let i = 1; i <= 9; i++) {
core.setLocalStorage('hotkey' + i, null); core.setLocalStorage('hotkey' + i, null);
} }
this.drawContent(); this.drawContent();
core.drawSuccessTip('快捷键已重置到默认状态。'); core.drawSuccessTip('快捷键已重置到默认状态。');
}, },
text: '重置本页面所有快捷键到默认状态。', text: '重置本页面所有快捷键到默认状态。',
replay: false, replay: false,
draw: /** @this {SettingButton} */ draw: /** @this {SettingButton} */
function (ctx) { function (ctx) {
core.fillRoundRect(ctx, this.x, this.y, this.w, this.h, 3, '#D3D3D3'); core.fillRoundRect(ctx, this.x, this.y, this.w, this.h, 3, '#D3D3D3');
core.strokeRoundRect(ctx, this.x, this.y, this.w, this.h, 3, '#888888'); core.strokeRoundRect(ctx, this.x, this.y, this.w, this.h, 3, '#888888');
core.fillText(ctx, '重置', this.x + 5, this.y + this.h / 2 + 5, '#333333', '16px Verdana'); core.fillText(ctx, '重置', this.x + 5, this.y + this.h / 2 + 5, '#333333', '16px Verdana');
} }
} }
}; };
class KeyMenu extends SettingOnePage { class KeyMenu extends SettingOnePage {
@ -5578,7 +5580,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
// this.initOnePage(this.currPage); // this.initOnePage(this.currPage);
} }
} }
const allSettings = { const allSettings = {
...gamePlaySetting, ...gamePlaySetting,
...gameViewSetting, ...gameViewSetting,