From 599122d37f13480d8914b38fed23eab6d5a2a9ce Mon Sep 17 00:00:00 2001 From: ShakeFlower Date: Tue, 20 May 2025 17:19:01 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E7=A7=BB=E9=99=A4=E6=97=A0=E5=85=B3?= =?UTF-8?q?=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- toolBar1.md | 300 -------------------------------------- 发版前注意删除无关文件.md | 87 ----------- 2 files changed, 387 deletions(-) delete mode 100644 toolBar1.md delete mode 100644 发版前注意删除无关文件.md diff --git a/toolBar1.md b/toolBar1.md deleted file mode 100644 index d9a7f4ab..00000000 --- a/toolBar1.md +++ /dev/null @@ -1,300 +0,0 @@ - 'icons': { - 'floor': 0, - 'name': null, - 'lv': 1, - 'hpmax': 2, - 'hp': 3, - 'atk': 4, - 'def': 5, - 'mdef': 6, - 'money': 7, - 'exp': 8, - 'up': 9, - 'book': 10, - 'fly': 11, - 'toolbox': 12, - 'keyboard': 13, - 'shop': 14, - 'save': 15, - 'load': 16, - 'settings': 17, - 'play': 18, - 'pause': 19, - 'stop': 20, - 'speedDown': 21, - 'speedUp': 22, - 'rewind': 23, - 'equipbox': 24, - 'mana': 25, - 'skill': 26, - 'btn1': 27, - 'btn2': 28, - 'btn3': 29, - 'btn4': 30, - 'btn5': 31, - 'btn6': 32, - 'btn7': 33, - 'btn8': 34 - }, - - ```html -
- - - - - - - - - - - - - - - - - -

-
- ``` - -```js -control.prototype._resize_toolBar = function (obj) { - // toolBar console.log(obj); - var toolBar = core.dom.toolBar; - if (core.domStyle.isVertical) { - toolBar.style.left = 0; - toolBar.style.right = ""; - toolBar.style.width = obj.outerSize + "px"; - toolBar.style.top = obj.statusBarHeightInVertical + obj.outerSize + "px"; - toolBar.style.height = obj.toolbarHeightInVertical + "px"; - toolBar.style.background = obj.globalAttribute.toolsBackground; - } - else { - if (obj.extendToolbar) { - toolBar.style.left = ""; - toolBar.style.right = 0; - toolBar.style.width = obj.outerSize + "px"; - toolBar.style.top = obj.outerSize + "px"; - toolBar.style.height = obj.TOOLBAR_HEIGHT * core.domStyle.scale + obj.BORDER + "px"; - toolBar.style.background = obj.globalAttribute.toolsBackground; - } else { - toolBar.style.left = 0; - toolBar.style.right = ""; - toolBar.style.width = obj.BAR_WIDTH * core.domStyle.scale + obj.BORDER + "px"; - toolBar.style.top = 0.718 * obj.outerSize + "px"; - toolBar.style.height = 0.281 * obj.outerSize + "px"; - toolBar.style.background = 'transparent'; - } - } - toolBar.style.borderLeft = obj.border; - toolBar.style.borderRight = toolBar.style.borderBottom = core.domStyle.isVertical || obj.extendToolbar ? obj.border : ''; - toolBar.style.fontSize = 16 * core.domStyle.scale + "px"; - - if (!core.domStyle.showStatusBar && !core.domStyle.isVertical && !obj.extendToolbar) { - toolBar.style.display = 'none'; - } else { - toolBar.style.display = 'block'; - } -} -``` -目测为控制toolBar形状的关键函数! -resize函数很关键 -```js -control.prototype.resize = function () { - if (main.mode == 'editor') return; - var clientWidth = main.dom.body.clientWidth, clientHeight = main.dom.body.clientHeight; - var CANVAS_WIDTH = core.__PIXELS__, BAR_WIDTH = Math.round(core.__PIXELS__ * 0.31); - var BORDER = 3; - var extendToolbar = core.flags.extendToolbar; - - var horizontalMaxRatio = (clientHeight - 2 * BORDER - (extendToolbar ? BORDER : 0)) / (CANVAS_WIDTH + (extendToolbar ? 38 : 0)); - - if (clientWidth - 3 * BORDER >= CANVAS_WIDTH + BAR_WIDTH || (clientWidth > clientHeight && horizontalMaxRatio < 1)) { - // 横屏 - core.domStyle.isVertical = false; - - core.domStyle.availableScale = []; - [1, 1.25, 1.5, 1.75, 2, 2.25, 2.5].forEach(function (v) { - if (clientWidth - 3 * BORDER >= v * (CANVAS_WIDTH + BAR_WIDTH) && horizontalMaxRatio >= v) { - core.domStyle.availableScale.push(v); - } - }); - if (core.domStyle.availableScale.indexOf(core.domStyle.scale) < 0) { - core.domStyle.scale = Math.min(1, horizontalMaxRatio); - } - } - else { - // 竖屏 - core.domStyle.isVertical = true; - core.domStyle.scale = Math.min((clientWidth - 2 * BORDER) / CANVAS_WIDTH); - core.domStyle.availableScale = []; - extendToolbar = false; - } - - var statusDisplayArr = this._shouldDisplayStatus(), count = statusDisplayArr.length; - var statusCanvas = core.flags.statusCanvas, statusCanvasRows = core.values.statusCanvasRowsOnMobile || 3; - var col = statusCanvas ? statusCanvasRows : Math.ceil(count / 3); - if (col > 5) { - if (statusCanvas) alert("自绘状态栏的在竖屏下的行数应不超过5!"); - else alert("当前状态栏数目(" + count + ")大于15,请调整到不超过15以避免手机端出现显示问题。"); - } - var globalAttribute = core.status.globalAttribute || core.initStatus.globalAttribute; - - var obj = { - clientWidth: clientWidth, - clientHeight: clientHeight, - CANVAS_WIDTH: CANVAS_WIDTH, - BORDER: BORDER, - BAR_WIDTH: BAR_WIDTH, - TOOLBAR_HEIGHT: 38, - outerSize: CANVAS_WIDTH * core.domStyle.scale + 2 * BORDER, - globalAttribute: globalAttribute, - border: '3px ' + core.arrayToRGBA(globalAttribute.borderColor) + ' solid', - statusDisplayArr: statusDisplayArr, - count: count, - col: col, - statusBarHeightInVertical: core.domStyle.isVertical ? (32 * col + 6) * core.domStyle.scale + 2 * BORDER : 0, - toolbarHeightInVertical: core.domStyle.isVertical ? 38 * core.domStyle.scale + 2 * BORDER : 0, - extendToolbar: extendToolbar, - is15x15: core.__SIZE__ == 15 - }; - - this._doResize(obj); - this.setToolbarButton(); - core.updateStatusBar(); -} -``` - -```js -////// 工具栏界面时的点击操作 ////// -actions.prototype._clickToolbox - -``` -疑似看的是event.id 神人设计 - -尝试修改,改动总结 -```js -// # main.js - this.statusBar = { - 'image': { - 'floor': document.getElementById('img-floor'), - 'name': document.getElementById('img-name'), - 'lv': document.getElementById('img-lv'), - 'hpmax': document.getElementById('img-hpmax'), - 'hp': document.getElementById("img-hp"), - 'mana': document.getElementById("img-mana"), - 'atk': document.getElementById("img-atk"), - 'def': document.getElementById("img-def"), - 'mdef': document.getElementById("img-mdef"), - 'money': document.getElementById("img-money"), - 'exp': document.getElementById("img-exp"), - 'up': document.getElementById("img-up"), - 'skill': document.getElementById('img-skill'), - 'book': document.getElementById("img-book"), - 'fly': document.getElementById("img-fly"), - 'toolbox': document.getElementById("img-toolbox"), - 'keyboard': document.getElementById("img-keyboard"), - 'shop': document.getElementById('img-shop'), - 'save': document.getElementById("img-save"), - 'load': document.getElementById("img-load"), - 'settings': document.getElementById("img-settings"), - 'btn1': document.getElementById("img-btn1"), - 'btn2': document.getElementById("img-btn2"), - 'btn3': document.getElementById("img-btn3"), - 'btn4': document.getElementById("img-btn4"), - 'btn5': document.getElementById("img-btn5"), - 'btn6': document.getElementById("img-btn6"), - 'btn7': document.getElementById("img-btn7"), - 'btn8': document.getElementById("img-btn8"), - 'slime': document.getElementById('img-slime'), // 增加 - }, - //... this.statsBar.image中添加slime - - 'icons': { - 'floor': 0, - 'name': null, - 'lv': 1, - 'hpmax': 2, - 'hp': 3, - 'atk': 4, - 'def': 5, - 'mdef': 6, - 'money': 7, - 'exp': 8, - 'up': 9, - 'book': 10, - 'fly': 11, - 'toolbox': 12, - 'keyboard': 13, - 'shop': 14, - 'save': 15, - 'load': 16, - 'settings': 17, - 'play': 18, - 'pause': 19, - 'stop': 20, - 'speedDown': 21, - 'speedUp': 22, - 'rewind': 23, - 'equipbox': 24, - 'mana': 25, - 'skill': 26, - 'btn1': 27, - 'btn2': 28, - 'btn3': 29, - 'btn4': 30, - 'btn5': 31, - 'btn6': 32, - 'btn7': 33, - 'btn8': 34, - 'slime': 35, // 增加 - }, - //... this.statsBar.icon中添加slime 会自动采用该列第35个图片作为相应的icon - } - - main.statusBar.image.slime.onclick = function (e) { - e.stopPropagation(); - console.log(1); - }; - //... 添加slime的点击事件 -``` - - -那么元素img-slime从哪来呢? -答案是index.html -```js -
- - - - - - - - - - - - - - - - - -

-
-``` - -controls中的函数_updateStatusBar_setToolboxIcon也很重要,该函数调控进/出录像模式的图标变化 -setToolbarButton 改变工具栏为按钮1-8 - -todo:长弹幕显示不全 done -todo:点取消卡死 done -todo:未知的自动拾取导致bug 为什么其它塔没有bug? 有待将来观察 -todo:2.10其它改动 - -todo:放缩下存档界面显示不全 楼传等? -快速移动待测 不知道为什么体感时间远比显示时间长 \ No newline at end of file diff --git a/发版前注意删除无关文件.md b/发版前注意删除无关文件.md deleted file mode 100644 index 4646733e..00000000 --- a/发版前注意删除无关文件.md +++ /dev/null @@ -1,87 +0,0 @@ -tileset只有noPass属性。设置noPass为false的瞬间就会写入project/maps.js -其它情况只要不是items就不可过。 -写入可通行性对tileset只用写canPass就好 -读档:```core.utils.decompress(core.saves.cache['template_save3'] );``` -解码录像 core.decodeRoute(a.route); - -可通行性,关键在getBlockByNumber函数。它从core.status.number2Block中获取信息。而number2Block不存在该属性时会initBlock -initBlock从blocksInfo中读 - -改变canPass后:(模仿setBlock) -originBlock = core.getBlock(x, y, floorId, true);获取originBlock -core.status.maps[floorId].blocks全要改 -core.status.mapBlockObjs全要改 - -enemyInfo进存档的手法非常简单粗暴 就是存了个变量 - -extractBlocks->_mapIntoBlocks->initBlock - -cannotOut和cannotIn的关键 -箭头还在getBlockByNumber中 - -首先抽象一下 思考一下顶层设计 -ItemBox类 -需要的属性:当前持有的Item和数量 当前的页数 - -使用道具时,情况会改变,所以,每次重绘时,都需要获取一遍core.status.hero.items,然后依据此获取一个列表itemList。根据当前页数(currPage)获取该绘制的内容。 - -整个道具栏做成一个大按钮,还需要属性selectedItem 每次根据selectedItem重绘右侧的物品详细说明 - -按钮可往前不往后,以防一页的道具全用光会不去 - -点击时:点左侧 根据位置和itemList和currPage推导处在哪里,更新selectedItem,更新右侧 左侧是一个大按钮 -点下方 左右 currPage -右侧按键: -使用 尝试使用selectedItem -批量使用 新功能 -隐藏/显示 修改道具的隐藏属性 -显示隐藏 页面级属性 showHidedItem - -最高级 MenuPage 名为boxPage -拥有背景和背景中的两个箭头和道具栏|装备栏的字样 -按键切换两栏 监听tab等 -右下角的× - -toolBox 拥有底部两按钮,右侧的一切,中间的大按钮 -equipBox 拥有 -```js -const itemClsName = { - "constants": "永久道具", - "tools": "消耗道具", -} -const itemNum = 12; - -core.initThisEventInfo(); -let info = core.status.thisUIEventInfo -info.index = 1; -core.setIndexAndSelect('select'); -let ctx =core.canvas.ui; -core.status.thisEventClickArea = []; - -let info1 = core.drawBoxBackground(ctx); -info1.itemNum = itemNum; -core.drawItemListbox(ctx, info1.obj); -core.drawToolboxRightbar(ctx, info1); - -``` - -!mypromt callback疑似需要改回去 - -难绷的bug太多了 自动拾取,自动清怪,追猎等等。 - -moveBlock: -```js -let [x, y, steps, time, keep] = [0,0,['down'],1,false]; -let blockArr = core.maps._getAndRemoveBlock(x, y); -let block = blockArr[0], blockInfo = blockArr[1]; -let canvases = core.maps._initDetachedBlock(blockInfo, x, y, block.event.animate !== false); -core.maps._moveDetachedBlock(blockInfo, 32 * x, 32 * y, 1, canvases); -``` -1.blockArr:[block,blockInfo]组成,同时会removeBlock -block,blockInfo有一个什么都没有,则blockArr什么都没有,则返回 -接下来处理moveSteps,得到['down',1]; -_initDetachedBlock返回三个canvas的对象 {headCanvas,bodyCanvas,damageCanvas} -_moveDetachedBlock:疑似是通过该函数不断移动实现移动效果 - -模板字符串居然不能随意填字符串,逆天 -arguments对象是 JavaScript 中的一个特殊对象,它自动提供给每一个函数作为局部变量。它是类数组对象,但缺少真正数组的许多方法。 \ No newline at end of file