diff --git a/components.d.ts b/components.d.ts index aeed6a3..d5a61d2 100644 --- a/components.d.ts +++ b/components.d.ts @@ -8,6 +8,8 @@ export {} declare module '@vue/runtime-core' { export interface GlobalComponents { ADivider: typeof import('ant-design-vue/es')['Divider'] + ASelect: typeof import('ant-design-vue/es')['Select'] + ASelectOption: typeof import('ant-design-vue/es')['SelectOption'] ASlider: typeof import('ant-design-vue/es')['Slider'] BoxAnimate: typeof import('./src/components/boxAnimate.vue')['default'] EnemyOne: typeof import('./src/components/enemyOne.vue')['default'] diff --git a/public/libs/actions.js b/public/libs/actions.js index e04b46d..fe3cfce 100644 --- a/public/libs/actions.js +++ b/public/libs/actions.js @@ -388,9 +388,6 @@ actions.prototype._sys_keyDown_lockControl = function (keyCode) { case 'viewMaps': this._keyDownViewMaps(keyCode); break; - case 'equipbox': - this._keyDownEquipbox(keyCode); - break; case 'toolbox': this._keyDownToolbox(keyCode); break; @@ -490,9 +487,6 @@ actions.prototype._sys_keyUp_lockControl = function (keyCode, altKey) { case 'selectShop': this._keyUpQuickShop(keyCode); break; - case 'equipbox': - this._keyUpEquipbox(keyCode, altKey); - break; case 'save': case 'load': case 'replayLoad': @@ -599,9 +593,6 @@ actions.prototype._sys_ondown_lockControl = function (x, y, px, py) { case 'selectShop': this._clickQuickShop(x, y, px, py); break; - case 'equipbox': - this._clickEquipbox(x, y, px, py); - break; case 'toolbox': this._clickToolbox(x, y, px, py); break; @@ -1816,402 +1807,6 @@ actions.prototype._keyUpQuickShop = function (keycode) { return; }; -////// 工具栏界面时的点击操作 ////// -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); -}; - -////// 选择工具栏界面中某个Index后的操作 ////// -actions.prototype._clickToolboxIndex = function (index) { - var tools = core.getToolboxItems('tools'), - constants = core.getToolboxItems('constants'); - - var items = null; - var select; - if (index < this.LAST) { - select = index + this.LAST * (core.status.event.data.toolsPage - 1); - items = tools; - } else { - select = - (index % this.LAST) + - this.LAST * (core.status.event.data.constantsPage - 1); - items = constants; - } - if (items == null) return; - if (select >= items.length) return; - var itemId = items[select]; - if (itemId == core.status.event.data.selectId) { - if (core.isReplaying()) return; - core.events.tryUseItem(itemId); - } else { - core.playSound('光标移动'); - core.ui._drawToolbox(index); - } -}; - -////// 工具栏界面时,按下某个键的操作 ////// -actions.prototype._keyDownToolbox = function (keycode) { - if (core.status.event.data == null) return; - - var last_index = this.LAST - 1; - - var tools = core.getToolboxItems('tools'), - constants = core.getToolboxItems('constants'); - var index = core.status.event.selection; - var toolsPage = core.status.event.data.toolsPage; - var constantsPage = core.status.event.data.constantsPage; - var toolsTotalPage = Math.ceil(tools.length / this.LAST); - var constantsTotalPage = Math.ceil(constants.length / this.LAST); - var toolsLastIndex = - toolsPage < toolsTotalPage - ? last_index - : (tools.length + last_index) % this.LAST; - var constantsLastIndex = - this.LAST + - (constantsPage < constantsTotalPage - ? last_index - : (constants.length + last_index) % this.LAST); - - if (keycode == 37) { - // left - if (index == 0) { - // 处理向前翻页 - if (toolsPage > 1) { - core.status.event.data.toolsPage--; - index = last_index; - } else return; // 第一页不向前翻 - } else if (index == this.LAST) { - if (constantsPage == 1) { - if (toolsTotalPage == 0) return; - core.status.event.data.toolsPage = toolsTotalPage; - index = (tools.length + last_index) % this.LAST; - } else { - core.status.event.data.constantsPage--; - index = 2 * this.LAST - 1; - } - } else index -= 1; - this._clickToolboxIndex(index); - return; - } - if (keycode == 38) { - // up - if (index >= this.LAST && index < this.LAST + this._HX_) { - // 进入tools - if (toolsTotalPage == 0) return; - if (toolsLastIndex >= this._HX_) - index = Math.min(toolsLastIndex, index - this._HX_); - else index = Math.min(toolsLastIndex, index - this.LAST); - } else if (index < this._HX_) return; // 第一行没有向上 - else index -= this._HX_; - this._clickToolboxIndex(index); - return; - } - if (keycode == 39) { - // right - if (toolsPage < toolsTotalPage && index == last_index) { - core.status.event.data.toolsPage++; - index = 0; - } else if ( - constantsPage < constantsTotalPage && - index == 2 * this.LAST - 1 - ) { - core.status.event.data.constantsPage++; - index = this.LAST; - } else if (index == toolsLastIndex) { - if (constantsTotalPage == 0) return; - core.status.event.data.constantsPage = 1; - index = this.LAST; - } else if (index == constantsLastIndex) - // 一个物品无操作 - return; - else index++; - this._clickToolboxIndex(index); - return; - } - if (keycode == 40) { - // down - var nextIndex = null; - if (index < this._HX_) { - if (toolsLastIndex >= this._HX_) - nextIndex = Math.min(toolsLastIndex, index + this._HX_); - else index += this._HX_; - } - if (nextIndex == null && index < this.LAST) { - if (constantsTotalPage == 0) return; - nextIndex = Math.min(index + this._HX_, constantsLastIndex); - } - if (nextIndex == null && index < this.LAST + this._HX_) { - if (constantsLastIndex >= this.LAST + this._HX_) - nextIndex = Math.min(constantsLastIndex, index + this._HX_); - } - if (nextIndex != null) { - this._clickToolboxIndex(nextIndex); - } - return; - } -}; - -////// 装备栏界面时的点击操作 ////// -actions.prototype._clickEquipbox = function (x, y, px, py) { - if (x >= this.LAST - 2 && y == 0) { - core.playSound('确定'); - core.ui.closePanel(); - if (core.isReplaying()) core.control._replay_toolbox(); - else core.openToolbox(); - 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; - } - if ((x == this._HX_ - 2 || x == this._HX_ - 3) && y === core._HEIGHT_ - 1) { - if (core.status.event.data.page > 1) { - core.status.event.data.page--; - core.playSound('光标移动'); - core.ui._drawEquipbox(core.status.event.selection); - } - return; - } - if ((x == this._HX_ + 2 || x == this._HX_ + 3) && y === core._HEIGHT_ - 1) { - var lastPage = Math.ceil( - core.getToolboxItems('equips').length / this.LAST - ); - if (core.status.event.data.page < lastPage) { - core.status.event.data.page++; - core.playSound('光标移动'); - core.ui._drawEquipbox(core.status.event.selection); - } - return; - } - var per_page = this._HX_ - 3, - v = core._WIDTH_ / per_page; - if (y === core._HEIGHT_ - 9) { - for (var i = 0; i < per_page; ++i) - if (x >= i * v && x <= (i + 1) * v) - return this._clickEquipboxIndex(i); - } else if (y === core._HEIGHT_ - 7) { - for (var i = 0; i < per_page; ++i) - if (x >= i * v && x <= (i + 1) * v) - return this._clickEquipboxIndex(per_page + i); - } else if (Math.abs(core._HEIGHT_ - 5 - py / 32) < 0.5) { - for (var i = 0; i < per_page; ++i) - if (x >= i * v && x <= (i + 1) * v) - return this._clickEquipboxIndex(2 * per_page + i); - } else if (y === core._HEIGHT_ - 4) - this._clickEquipboxIndex(this.LAST + parseInt(x / 2)); - else if (y === core._HEIGHT_ - 2) - this._clickEquipboxIndex(this.LAST + this._HX_ + parseInt(x / 2)); -}; - -////// 选择装备栏界面中某个Index后的操作 ////// -actions.prototype._clickEquipboxIndex = function (index) { - if (index < this.LAST) { - if (index >= core.status.globalAttribute.equipName.length) return; - if ( - index == core.status.event.selection && - core.status.hero.equipment[index] - ) { - if (core.isReplaying()) return; - core.unloadEquip(index); - core.status.route.push('unEquip:' + index); - } else core.playSound('光标移动'); - } else { - var equips = core.getToolboxItems('equips'); - if (index == core.status.event.selection) { - if (core.isReplaying()) return; - var equipId = - equips[ - index - - this.LAST + - (core.status.event.data.page - 1) * this.LAST - ]; - core.loadEquip(equipId); - core.status.route.push('equip:' + equipId); - } else core.playSound('光标移动'); - } - core.ui._drawEquipbox(index); -}; - -////// 装备栏界面时,按下某个键的操作 ////// -actions.prototype._keyDownEquipbox = function (keycode) { - if (core.status.event.data == null) return; - - var last_index = this.LAST - 1; - var per_line = this._HX_ - 3; - var equipCapacity = core.status.globalAttribute.equipName.length; - var ownEquipment = core.getToolboxItems('equips'); - var index = core.status.event.selection; - var page = core.status.event.data.page; - var totalPage = Math.ceil(ownEquipment.length / this.LAST); - var totalLastIndex = - this.LAST + - (page < totalPage - ? last_index - : (ownEquipment.length + last_index) % this.LAST); - - if (keycode == 37) { - // left - if (index == 0) return; - if (index == this.LAST) { - if (page > 1) { - core.status.event.data.page--; - core.playSound('光标移动'); - index = this.LAST + last_index; - } else if (page == 1) index = equipCapacity - 1; - else return; - } else index -= 1; - this._clickEquipboxIndex(index); - return; - } - if (keycode == 38) { - // up - if (index < per_line) return; - else if (index < 2 * per_line) index -= per_line; - else if (index < this.LAST + this._HX_) { - index = parseInt((index - this.LAST) / 2); - if (equipCapacity > per_line) - index = Math.min(equipCapacity - 1, index + per_line); - else index = Math.min(equipCapacity - 1, index); - } else index -= this._HX_; - this._clickEquipboxIndex(index); - return; - } - if (keycode == 39) { - // right - if (page < totalPage && index == this.LAST + last_index) { - core.status.event.data.page++; - core.playSound('光标移动'); - index = this.LAST; - } else if (index == equipCapacity - 1) { - if (totalPage == 0) return; - index = this.LAST; - } else if (index == totalLastIndex) return; - else index++; - this._clickEquipboxIndex(index); - return; - } - if (keycode == 40) { - // down - if (index < per_line) { - if (equipCapacity > per_line) - index = Math.min(index + per_line, equipCapacity - 1); - else { - if (totalPage == 0) return; - index = Math.min(2 * index + 1 + this.LAST, totalLastIndex); - } - } else if (index < 2 * per_line) { - if (totalPage == 0) return; - index = Math.min( - 2 * (index - per_line) + 1 + this.LAST, - totalLastIndex - ); - } else if (index < this.LAST + this._HX_) - index = Math.min(index + this._HX_, totalLastIndex); - else return; - this._clickEquipboxIndex(index); - return; - } -}; - -////// 装备栏界面时,放开某个键的操作 ////// -actions.prototype._keyUpEquipbox = function (keycode, altKey) { - if (altKey && keycode >= 48 && keycode <= 57) { - core.items.quickSaveEquip(keycode - 48); - return; - } - if (keycode == 84) { - core.playSound('确定'); - core.ui.closePanel(); - if (core.isReplaying()) core.control._replay_toolbox(); - else core.openToolbox(); - return; - } - if (keycode == 81 || 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.selectId) return; - - if (keycode == 13 || keycode == 32 || keycode == 67) { - this._clickEquipboxIndex(core.status.event.selection); - return; - } -}; - ////// 存读档界面时的点击操作 ////// actions.prototype._clickSL = function (x, y) { var page = core.status.event.data.page, diff --git a/public/libs/control.js b/public/libs/control.js index e3bbc9f..d1c6b9d 100644 --- a/public/libs/control.js +++ b/public/libs/control.js @@ -4163,7 +4163,7 @@ control.prototype.resize = function () { clientHeight = main.dom.body.clientHeight; var BORDER = 3; var extendToolbar = core.flags.extendToolbar; - var BAR_WIDTH = extendToolbar ? 0 : Math.round(core._PY_ * 0.3); + var BAR_WIDTH = extendToolbar ? 0 : Math.round(core._PY_ * 0.31); var horizontalMaxRatio = (clientHeight - 2 * BORDER - (extendToolbar ? BORDER : 0)) / @@ -4321,6 +4321,7 @@ control.prototype._resize_canvas = function (obj) { core.dom.gameDraw.style.top = obj.statusBarHeightInVertical + 'px'; core.dom.gameDraw.style.right = 0; core.dom.gameDraw.style.border = obj.border; + core.dom.gameDraw.style.boxSizing = 'content-box'; // resize bigmap core.bigmap.canvas.forEach(function (cn) { var ratio = core.canvas[cn].canvas.hasAttribute('isHD') diff --git a/public/libs/ui.js b/public/libs/ui.js index 16b8740..3ee4947 100644 --- a/public/libs/ui.js +++ b/public/libs/ui.js @@ -3529,267 +3529,7 @@ ui.prototype._drawViewMaps_buildData = function (index, x, y) { ui.prototype._drawToolbox = function (index) {}; ////// 绘制装备界面 ////// -ui.prototype._drawEquipbox = function (index) { - var info = this._drawEquipbox_getInfo(index); - this._drawToolbox_drawBackground(); - - core.setAlpha('ui', 1); - core.setStrokeStyle('ui', '#DDDDDD'); - core.canvas.ui.lineWidth = 2; - core.canvas.ui.strokeWidth = 2; - core.setTextAlign('ui', 'right'); - var line1 = core._PY_ - 306; - this._drawToolbox_drawLine(line1, '当前装备'); - var line2 = core._PY_ - 146; - this._drawToolbox_drawLine(line2 + 9, '拥有装备'); - - this._drawEquipbox_description(info, line1); - - this._drawEquipbox_drawEquiped(info, line1); - this._drawToolbox_drawContent( - info, - line2, - info.ownEquipment, - info.page, - true - ); - this.drawPagination(info.page, info.totalPage); - - core.setTextAlign('ui', 'center'); - core.fillText( - 'ui', - '[道具栏]', - core._PX_ - 46, - 25, - '#DDDDDD', - this._buildFont(15, true) - ); - core.fillText('ui', '返回游戏', core._PX_ - 46, core._PY_ - 13); -}; - -ui.prototype._drawEquipbox_getInfo = function (index) { - if (!core.status.event.data || core.status.event.data.page == null) - core.status.event.data = { page: 1, selectId: null }; - var allEquips = core.status.globalAttribute.equipName; - var equipLength = allEquips.length; - if (!core.status.hero.equipment) core.status.hero.equipment = []; - var n = core._WIDTH_ - 1; - var equipEquipment = core.status.hero.equipment; - var ownEquipment = core.getToolboxItems('equips'); - var page = core.status.event.data.page; - var totalPage = Math.ceil(ownEquipment.length / n); - // 处理index - if (index == null) { - if (equipLength > 0 && equipEquipment[0]) index = 0; - else if (ownEquipment.length > 0) index = n; - else index = 0; - } - if (index >= n && ownEquipment.length == 0) index = 0; - var selectId = null; - if (index < n) { - if (index >= equipLength) index = Math.max(0, equipLength - 1); - selectId = equipEquipment[index] || null; - } else { - if (page == totalPage) - index = Math.min(index, ((ownEquipment.length + n - 1) % n) + n); - selectId = ownEquipment[index - n + (page - 1) * n]; - if (!core.hasItem(selectId)) selectId = null; - } - core.status.event.selection = index; - core.status.event.data.selectId = selectId; - return { - index: index, - selectId: selectId, - page: page, - totalPage: totalPage, - allEquips: allEquips, - equipLength: equipLength, - equipEquipment: equipEquipment, - ownEquipment: ownEquipment - }; -}; - -ui.prototype._drawEquipbox_description = function (info, max_height) { - core.setTextAlign('ui', 'left'); - if (!info.selectId) return; - var equip = core.material.items[info.selectId]; - // --- 标题 - if (!equip.equip) equip.equip = { type: 0 }; - var equipType = equip.equip.type, - equipString; - if (typeof equipType === 'string') { - equipString = equipType || '未知部位'; - equipType = core.items.getEquipTypeByName(equipType); - } else equipString = info.allEquips[equipType] || '未知部位'; - core.fillText( - 'ui', - equip.name + '(' + equipString + ')', - 10, - 32, - core.status.globalAttribute.selectColor, - this._buildFont(20, true) - ); - // --- 描述 - var text = equip.text || '该装备暂无描述。'; - try { - text = core.replaceText(text); - } catch (e) {} - - var height = null; - for (var fontSize = 17; fontSize >= 9; fontSize -= 2) { - var config = { - left: 10, - top: 46, - fontSize: fontSize, - maxWidth: core._PX_ - 15, - bold: false, - color: 'white' - }; - height = 42 + core.getTextContentHeight(text, config); - if (height < max_height - 30 || fontSize == 9) { - core.drawTextContent('ui', text, config); - break; - } - } - // --- 变化值 - this._drawEquipbox_drawStatusChanged( - info, - max_height - 15, - equip, - equipType - ); -}; - -ui.prototype._drawEquipbox_getStatusChanged = function ( - info, - equip, - equipType, - y -) { - if (info.index < core._WIDTH_ - 1) { - // 光标在装备栏上:查询卸下装备属性 - return core.compareEquipment(null, info.selectId); - } - if (equipType < 0) { - // 没有空位 - core.fillText( - 'ui', - '<当前没有该装备的空位,请先卸下装备>', - 10, - y, - '#CCCCCC', - this._buildFont(14, false) - ); - return null; - } - // 光标在装备上:查询装上后的属性变化 - return core.compareEquipment(info.selectId, info.equipEquipment[equipType]); -}; - -ui.prototype._drawEquipbox_drawStatusChanged = function ( - info, - y, - equip, - equipType -) { - var compare = this._drawEquipbox_getStatusChanged( - info, - equip, - equipType, - y - ); - if (compare == null) return; - var obj = { drawOffset: 10, y: y }; - - // --- 变化值... - core.setFont('ui', this._buildFont(14, true)); - for (var name in core.status.hero) { - if (typeof core.status.hero[name] != 'number') continue; - var nowValue = core.getRealStatus(name); - // 查询新值 - var newValue = Math.floor( - ((core.getStatus(name) + (compare.value[name] || 0)) * - (core.getBuff(name) * 100 + (compare.percentage[name] || 0))) / - 100 - ); - if (nowValue == newValue) continue; - var text = core.getStatusLabel(name); - this._drawEquipbox_drawStatusChanged_draw(text + ' ', '#CCCCCC', obj); - var color = newValue > nowValue ? '#00FF00' : '#FF0000'; - nowValue = core.formatBigNumber(nowValue); - newValue = core.formatBigNumber(newValue); - this._drawEquipbox_drawStatusChanged_draw( - nowValue + '->', - '#CCCCCC', - obj - ); - this._drawEquipbox_drawStatusChanged_draw(newValue, color, obj); - obj.drawOffset += 8; - } -}; - -ui.prototype._drawEquipbox_drawStatusChanged_draw = function ( - text, - color, - obj -) { - var len = core.calWidth('ui', text); - if (obj.drawOffset + len >= core._PX_) { - // 换行 - obj.y += 19; - obj.drawOffset = 10; - } - core.fillText('ui', text, obj.drawOffset, obj.y, color); - obj.drawOffset += len; -}; - -ui.prototype._drawEquipbox_drawEquiped = function (info, line) { - core.setTextAlign('ui', 'center'); - var per_line = core._HALF_WIDTH_ - 3, - width = Math.floor(core._PX_ / (per_line + 0.25)); - // 当前装备 - for (var i = 0; i < info.equipLength; i++) { - var equipId = info.equipEquipment[i] || null; - // var offset_text = width * (i % per_line) + 56; - var offset_image = width * (i % per_line) + (width * 2) / 3; - var offset_text = offset_image - (width - 32) / 2; - var y = line + 54 * Math.floor(i / per_line) + 19; - if (equipId) { - var icon = core.material.icons.items[equipId]; - core.drawImage( - 'ui', - core.material.images.items, - 0, - 32 * icon, - 32, - 32, - offset_image, - y, - 32, - 32 - ); - } - core.fillText( - 'ui', - info.allEquips[i] || '未知', - offset_text, - y + 27, - '#FFFFFF', - this._buildFont(16, true) - ); - core.strokeRoundRect( - 'ui', - offset_image - 4, - y - 4, - 40, - 40, - 6, - info.index == i - ? core.status.globalAttribute.selectColor - : '#FFFFFF' - ); - } -}; +ui.prototype._drawEquipbox = function (index) {}; ////// 绘制存档/读档界面 ////// ui.prototype._drawSLPanel = function (index, refresh) { diff --git a/public/project/floors/MT1.js b/public/project/floors/MT1.js index 8557c43..4866aff 100644 --- a/public/project/floors/MT1.js +++ b/public/project/floors/MT1.js @@ -79,7 +79,7 @@ main.floors.MT1= [20042, 0, 0,201, 0, 0,141, 0,141,202, 17, 0, 0, 0,20040], [20042,202, 17, 17, 0, 0,205, 31, 0, 28, 17, 28, 0, 32,20040], [20042, 0, 27, 17, 31,141,141,141,141,201, 17, 17, 17, 17,20040], - [20042, 32, 0, 17, 0,201, 47, 0,201, 31,202, 0, 32, 0,20040], + [20042, 32, 0, 17, 0,201, 36, 35,201, 31,202, 0, 32, 0,20040], [20036,20033,20033,20033,20033,20033,20034, 93,20032,20033,20033,20033,20033,20033,20035] ], "bgmap": [ diff --git a/public/project/functions.js b/public/project/functions.js index d9e1d71..0f1d997 100644 --- a/public/project/functions.js +++ b/public/project/functions.js @@ -1389,7 +1389,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = { floorId: core.status.floorId, hero: core.clone(core.status.hero), hard: core.status.hard, - maps: core.maps.saveMap(), + maps: core.clone(core.maps.saveMap()), route: core.encodeRoute(core.status.route), values: values, version: core.firstData.version, @@ -1484,7 +1484,9 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = { money: '金币', exp: '经验', point: '加点', - steps: '步数' + steps: '步数', + up: '升级', + none: '无' }[name] || name ); }, diff --git a/public/project/items.js b/public/project/items.js index 92c474c..fcccbbc 100644 --- a/public/project/items.js +++ b/public/project/items.js @@ -151,8 +151,8 @@ var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a = "type": "武器", "animate": "jianji", "value": { - "mana": 10, - "atk": 15 + "atk": 15, + "mana": 10 }, "percentage": {} }, diff --git a/public/project/plugins.js b/public/project/plugins.js index 0f18c40..02bc1d1 100644 --- a/public/project/plugins.js +++ b/public/project/plugins.js @@ -3361,12 +3361,29 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = { } }, itemDetail: function () { + /* 宝石血瓶左下角显示数值 + * 需要将 变量:itemDetail改为true才可正常运行 + * 请尽量减少勇士的属性数量,否则可能会出现严重卡顿 + * 注意:这里的属性必须是core.status.hero里面的,flag无法显示 + * 如果不想显示,可以core.setFlag("itemDetail", false); + * 然后再core.getItemDetail(); + * 如有bug在大群或造塔群@古祠 + */ + + // 谁tm在即捡即用效果里面调用带有含刷新状态栏的函数 + var origin = core.control.updateStatusBar; + core.updateStatusBar = core.control.updateStatusBar = function () { + if (core.getFlag('__statistics__')) return; + else return origin.apply(core.control, arguments); + }; + core.bigmap.threshold = 256; core.control.updateDamage = function (floorId, ctx) { floorId = floorId || core.status.floorId; if (!floorId || core.status.gameOver || main.mode != 'play') return; var onMap = ctx == null; + // 没有怪物手册 if (!core.hasItem('book')) return; core.status.damage.posX = core.bigmap.posX; @@ -3385,9 +3402,11 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = { // 绘制地图显示 control.prototype._drawDamage_draw = function (ctx, onMap) { if (!core.hasItem('book')) return; - core.setFont(ctx, '15px normal'); + // *** 下一句话可以更改你想要的显示字体 + core.setFont(ctx, '14px normal'); + // *** core.setTextAlign(ctx, 'left'); - core.status.damage.data.forEach(one => { + core.status.damage.data.forEach(function (one) { var px = one.px, py = one.py; if (onMap && core.bigmap.v2) { @@ -3395,16 +3414,16 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = { py -= core.bigmap.posY * 32; if ( px < -32 * 2 || - px > core.__PIXELS__ + 32 || + px > core.__PX__ + 32 || py < -32 || - py > core.__PIXELS__ + 32 + py > core.__PY__ + 32 ) return; } core.fillBoldText(ctx, one.text, px, py, one.color); }); core.setTextAlign(ctx, 'center'); - core.status.damage.extraData.forEach(one => { + core.status.damage.extraData.forEach(function (one) { var px = one.px, py = one.py; if (onMap && core.bigmap.v2) { @@ -3412,69 +3431,25 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = { py -= core.bigmap.posY * 32; if ( px < -32 || - px > core.__PIXELS__ + 32 || + px > core.__PX__ + 32 || py < -32 || - py > core.__PIXELS__ + 32 + py > core.__PY__ + 32 ) return; } core.fillBoldText(ctx, one.text, px, py, one.color); }); }; - core.formatBigNumber = function (x, onMap, onCritical) { - x = Math.floor(parseFloat(x)); - if (!core.isset(x) || !Number.isFinite(x)) return '???'; - if (x > 1e24 || x < -1e24) return x.toExponential(2); - var c = x < 0 ? '-' : ''; - if (onCritical) c = '-> '; - x = Math.abs(x); - if (x <= 9999 || (!onMap && x <= 999999)) return c + x; - var all = [ - { val: 1e20, c: 'g' }, - { val: 1e16, c: 'j' }, - { val: 1e12, c: 'z' }, - { val: 1e8, c: 'e' }, - { val: 1e4, c: 'w' } - ]; - for (var i = 0; i < all.length; i++) { - var one = all[i]; - if (onMap) { - if (x >= one.val) { - var v = x / one.val; - return ( - c + - v.toFixed( - Math.max( - 0, - Math.floor( - (c == '-' ? 2 : 3) - Math.log10(v + 1) - ) - ) - ) + - one.c - ); - } - } else { - if (x >= 10 * one.val) { - var v = x / one.val; - return ( - c + - v.toFixed( - Math.max(0, Math.floor(4 - Math.log10(v + 1))) - ) + - one.c - ); - } - } - } - return c + x; - }; // 获取宝石信息 并绘制 this.getItemDetail = function (floorId) { if (!core.getFlag('itemDetail')) return; floorId = floorId || core.status.thisMap.floorId; - core.status.maps[floorId].blocks.forEach(block => { - if (block.event.cls !== 'items') return; + core.status.maps[floorId].blocks.forEach(function (block) { + if ( + block.event.cls !== 'items' || + block.event.id === 'superPotion' + ) + return; var x = block.x, y = block.y; // v2优化,只绘制范围内的部分 @@ -3498,7 +3473,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = { var item = core.material.items[id]; if (item.cls === 'equips') { // 装备也显示 - var diff = item.equip.value || {}; + var diff = core.clone(item.equip.value || {}); var per = item.equip.percentage; for (var name in per) { diff[name + 'per'] = per[name].toString() + '%'; @@ -3531,7 +3506,6 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = { } // 绘制 function drawItemDetail(diff, x, y) { - if (core.same(diff, {}) || !diff) return; var px = 32 * x + 2, py = 32 * y + 30; var content = ''; @@ -9291,14 +9265,17 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = { }, uiChange: function () { if (main.replayChecking) return; + ui.prototype.drawBook = function () { - if (main.replayChecking) return; return (core.plugin.bookOpened.value = true); }; ui.prototype._drawToolbox = function () { - if (main.replayChecking) return; return (core.plugin.toolOpened.value = true); }; + + ui.prototype._drawEquipbox = function () { + return (core.plugin.equipOpened.value = true); + }; } }; diff --git a/src/App.vue b/src/App.vue index 09c8985..7644a4c 100644 --- a/src/App.vue +++ b/src/App.vue @@ -20,7 +20,7 @@ import { uiStack } from './plugin/uiController'; overflow: hidden; } -@media screen and(max-width:600px) { +@media screen and (max-width: 600px) { #ui { width: 100%; height: 100%; diff --git a/src/components/boxAnimate.vue b/src/components/boxAnimate.vue index 65bfee6..f3c1e66 100644 --- a/src/components/boxAnimate.vue +++ b/src/components/boxAnimate.vue @@ -26,6 +26,7 @@ let ctx: CanvasRenderingContext2D; let drawFn: () => void; function draw() { + if (id === 'none') return; if (has(drawFn)) removeAnimate(drawFn); const cls = core.getClsFromId(props.id); @@ -46,7 +47,10 @@ function draw() { c.height = scale * h; ctx.scale(scale, scale); - if (frames === 1) { + if (props.id === 'hero') { + const img = core.material.images.hero; + ctx.drawImage(img, 0, 0, img.width / 4, img.height / 4, 0, 0, w, h); + } else if (frames === 1) { core.drawIcon(ctx, props.id, 0, 0, props.width, props.height); } else { drawFn = () => { diff --git a/src/components/scroll.vue b/src/components/scroll.vue index 38d27e0..c2323e7 100644 --- a/src/components/scroll.vue +++ b/src/components/scroll.vue @@ -39,8 +39,8 @@ let ctx: CanvasRenderingContext2D; let content: HTMLDivElement; let fromSelf = false; -const resize = () => { - calHeight(); +const resize = async () => { + await calHeight(); draw(); }; @@ -80,9 +80,14 @@ function draw() { /** * 计算元素总长度 */ -function calHeight() { - const style = getComputedStyle(content); - total = parseFloat(style[canvasAttr]); +async function calHeight() { + await new Promise(res => { + requestAnimationFrame(() => { + const style = getComputedStyle(content); + total = parseFloat(style[canvasAttr]); + res(''); + }); + }); } function scroll() { @@ -90,11 +95,11 @@ function scroll() { content.style[cssTarget] = `${-now}px`; } -onUpdated(() => { +onUpdated(async () => { if (fromSelf) return; now = props.now ?? now; content.style.transition = `${cssTarget} 0.2s ease-out`; - calHeight(); + await calHeight(); scroll(); }); @@ -120,15 +125,12 @@ function contentDrag(x: number, y: number) { scroll(); } -onMounted(() => { +onMounted(async () => { const div = document.getElementById(`scroll-div-${id}`) as HTMLDivElement; const canvas = document.getElementById(`scroll-${id}`) as HTMLCanvasElement; const d = document.getElementById(`content-${id}`) as HTMLDivElement; ctx = canvas.getContext('2d') as CanvasRenderingContext2D; content = d; - calHeight(); - - content.addEventListener('resize', resize); const style = getComputedStyle(canvas); canvas.style.width = `${width}px`; @@ -144,8 +146,6 @@ onMounted(() => { canvas.height = width * scale; } - draw(); - // 绑定滚动条拖拽事件 useDrag( canvas, @@ -190,10 +190,14 @@ onMounted(() => { scroll(); fromSelf = false; }); + + window.addEventListener('resize', resize); + await calHeight(); + draw(); }); onUnmounted(() => { - content.removeEventListener('resize', resize); + window.removeEventListener('resize', resize); cancelGlobalDrag(canvasDrag); cancelGlobalDrag(contentDrag); }); diff --git a/src/plugin/ui/equipbox.tsx b/src/plugin/ui/equipbox.tsx new file mode 100644 index 0000000..44fa8bf --- /dev/null +++ b/src/plugin/ui/equipbox.tsx @@ -0,0 +1,92 @@ +import { has } from '../utils'; + +/** + * 获取所有装备 + */ +export function getEquips() { + return Object.entries(core.status.hero.items.equips); +} + +/** + * 获取装备增加的属性 + * @param equip 装备 + */ +export function getAddStatus(equip: Equip) { + const toGet = Object.assign({}, equip.value, equip.percentage); + const keys = Object.keys(toGet); + + return ( +