diff --git a/project/functions.js b/project/functions.js index f0abd17..ceb3ecd 100644 --- a/project/functions.js +++ b/project/functions.js @@ -487,41 +487,41 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = }, "enemys": { "getSpecials": function () { - // 获得怪物的特殊属性,每一行定义一个特殊属性。 - // 分为五项,第一项为该特殊属性的数字,第二项为特殊属性的名字,第三项为特殊属性的描述 - // 第四项为该特殊属性的颜色,可以写十六进制 #RRGGBB 或者 [r,g,b,a] 四元数组 - // 第五项为该特殊属性的标记;目前 1 代表是地图类技能(需要进行遍历全图) - // 名字和描述可以直接写字符串,也可以写个function将怪物传进去 - return [ - [1, "先攻", "怪物首先攻击", "#ffcc33"], - [2, "魔攻", "怪物无视角色的防御", "#bbb0ff"], - [3, "坚固", "怪物防御不小于角色攻击-1", "#c0b088"], - [4, "2连击", "怪物每回合攻击2次", "#ffee77"], - [5, "3连击", "怪物每回合攻击3次", "#ffee77"], - [6, function (enemy) { return (enemy.n || '') + "连击"; }, function (enemy) { return "怪物每回合攻击" + (enemy.n || 4) + "次"; }, "#ffee77"], - [7, "破甲", function (enemy) { return "战斗前,怪物附加角色防御的" + Math.floor(100 * (enemy.breakArmor || core.values.breakArmor || 0)) + "%作为伤害"; }, "#88c0ff"], - [8, "反击", function (enemy) { return "战斗时,怪物每回合附加角色攻击的" + Math.floor(100 * (enemy.counterAttack || core.values.counterAttack || 0)) + "%作为伤害,无视角色防御"; }, "#ffaa44"], - [9, "净化", function (enemy) { return "战斗前,怪物附加角色护盾的" + (enemy.purify || core.values.purify) + "倍作为伤害"; }, "#80eed6"], - [10, "模仿", "怪物的攻防和角色攻防相等", "#b0c0dd"], - [11, "吸血", function (enemy) { return "战斗前,怪物首先吸取角色的" + Math.floor(100 * enemy.vampire || 0) + "%生命(约" + Math.floor((enemy.vampire || 0) * core.getStatus('hp')) + "点)作为伤害" + (enemy.add ? ",并把伤害数值加到自身生命上" : ""); }, "#dd4448"], - [12, "中毒", "战斗后,角色陷入中毒状态,每一步损失生命" + core.values.poisonDamage + "点", "#99ee88"], - [13, "衰弱", "战斗后,角色陷入衰弱状态,攻防暂时下降" + (core.values.weakValue >= 1 ? core.values.weakValue + "点" : parseInt(core.values.weakValue * 100) + "%"), "#f0bbcc"], - [14, "诅咒", "战斗后,角色陷入诅咒状态,战斗无法获得金币和经验", "#bbeef0"], - [15, "领域", function (enemy) { return "经过怪物周围" + (enemy.zoneSquare ? "九宫格" : "十字") + "范围内" + (enemy.range || 1) + "格时自动减生命" + (enemy.zone || 0) + "点"; }, "#c677dd"], - [16, "夹击", "经过两只相同的怪物中间,角色生命值变成一半", "#bb99ee"], - [17, "仇恨", "战斗前,怪物附加之前积累的仇恨值作为伤害;战斗后,释放一半的仇恨值。(每杀死一个怪物获得" + (core.values.hatred || 0) + "点仇恨值)", "#b0b666"], - [18, "阻击", function (enemy) { return "经过怪物周围" + (enemy.zoneSquare ? "九宫格" : "十字") + "时自动减生命" + (enemy.repulse || 0) + "点,同时怪物后退一格"; }, "#8888e6"], - [19, "自爆", "战斗后角色的生命值变成1", "#ff6666"], - [20, "无敌", "角色无法打败怪物,除非拥有十字架", "#aaaaaa"], - [21, "退化", function (enemy) { return "战斗后角色永久下降" + (enemy.atkValue || 0) + "点攻击和" + (enemy.defValue || 0) + "点防御"; }], - [22, "固伤", function (enemy) { return "战斗前,怪物对角色造成" + (enemy.damage || 0) + "点固定伤害,未开启负伤时无视角色护盾。"; }, "#ff9977"], - [23, "重生", "怪物被击败后,角色转换楼层则怪物将再次出现", "#a0e0ff"], - [24, "激光", function (enemy) { return "经过怪物同行或同列时自动减生命" + (enemy.laser || 0) + "点"; }, "#dda0dd"], - [25, "光环", function (enemy) { return (enemy.range != null ? ((enemy.haloSquare ? "该怪物九宫格" : "该怪物十字") + enemy.haloRange + "格范围内") : "同楼层所有") + "怪物生命提升" + (enemy.hpBuff || 0) + "%,攻击提升" + (enemy.atkBuff || 0) + "%,防御提升" + (enemy.defBuff || 0) + "%," + (enemy.haloAdd ? "可叠加" : "不可叠加"); }, "#e6e099", 1], - [26, "支援", "当周围一圈的怪物受到攻击时将上前支援,并组成小队战斗。", "#77c0b6", 1], - [27, "捕捉", function (enemy) { return "当走到怪物周围" + (enemy.zoneSquare ? "九宫格" : "十字") + "时会强制进行战斗。"; }, "#c0ddbb"] - ]; - }, + // 获得怪物的特殊属性,每一行定义一个特殊属性。 + // 分为五项,第一项为该特殊属性的数字,第二项为特殊属性的名字,第三项为特殊属性的描述 + // 第四项为该特殊属性的颜色,可以写十六进制 #RRGGBB 或者 [r,g,b,a] 四元数组 + // 第五项为该特殊属性的标记;目前 1 代表是地图类技能(需要进行遍历全图) + // 名字和描述可以直接写字符串,也可以写个function将怪物传进去 + return [ + [1, "先攻", "怪物率先攻击", "#e5de0d"], + [2, "魔攻", "怪物攻击无视基础防御", "#ffc080"], + [3, "坚固", "怪物防御小于勇士攻击时,怪物防御=勇士攻击-1", "#c0c0c0"], + [4, "2连击", "每回合怪物2次攻击", "#ffff80"], + [5, "3连击", "每回合怪物3次攻击", "#ffff80"], + [6, function (enemy) { return (enemy.n || '') + "连击"; }, function (enemy) { return "怪物每回合攻击" + (enemy.n || 4) + "次"; }, "#ffee77"], + [7, "破甲", function (enemy) { return "战斗前,怪物附加角色防御的" + Math.floor(100 * (enemy.breakArmor || core.values.breakArmor || 0)) + "%作为伤害"; }, "#88c0ff"], + [8, "反击", function (enemy) { return "战斗时,怪物每回合附加角色攻击的" + Math.floor(100 * (enemy.counterAttack || core.values.counterAttack || 0)) + "%作为伤害,无视角色防御"; }, "#ffaa44"], + [9, "净化", function (enemy) { return "战斗前,怪物附加角色护盾的" + (enemy.purify || core.values.purify) + "倍作为伤害"; }, "#80eed6"], + [10, "模仿", "怪物的攻防和角色攻防相等", "#b0c0dd"], + [11, "吸血", function (enemy) { return "优先扣掉玩家" + Math.floor(100 * enemy.vampire || 0) + "%生命(约" + Math.floor((enemy.vampire || 0) * core.getStatus('hp')) + "点)" + (enemy.add ? ",并把伤害数值加到自身生命上" : ""); }, "#ff8080"], + [12, "中毒", "每走一步会损失15点生命值", "#80ff80"], + [13, "衰弱", "勇士攻防降低" + (core.values.weakValue >= 1 ? core.values.weakValue + "点" : parseInt(core.values.weakValue * 100) + "%"), "#fb7ff8"], + [14, "诅咒", "战斗后,角色陷入诅咒状态,战斗无法获得金币和经验", "#bbeef0"], + [15, "领域", function (enemy) { return "靠近怪物时受到伤害" + (enemy.zone || 0) + "点"; }, "#ff32c8"], + [16, "夹击", "经过两只相同的怪物中间,角色生命值变成一半", "#bb99ee"], + [17, "仇恨", "战斗前,怪物附加之前积累的仇恨值作为伤害;战斗后,释放一半的仇恨值。(每杀死一个怪物获得" + (core.values.hatred || 0) + "点仇恨值)", "#b0b666"], + [18, "阻击", function (enemy) { return "经过怪物周围" + (enemy.zoneSquare ? "九宫格" : "十字") + "时自动减生命" + (enemy.repulse || 0) + "点,同时怪物后退一格"; }, "#8888e6"], + [19, "自爆", "战斗后角色的生命值变成1", "#ff6666"], + [20, "无敌", "角色无法打败怪物,除非拥有十字架", "#aaaaaa"], + [21, "退化", function (enemy) { return "战斗后角色永久下降" + (enemy.atkValue || 0) + "点攻击和" + (enemy.defValue || 0) + "点防御"; }], + [22, "固伤", function (enemy) { return "战斗前,怪物对角色造成" + (enemy.damage || 0) + "点固定伤害,未开启负伤时无视角色护盾。"; }, "#ff9977"], + [23, "重生", "怪物被击败后,角色转换楼层则怪物将再次出现", "#a0e0ff"], + [24, "激光", function (enemy) { return "经过怪物同行或同列时自动减生命" + (enemy.laser || 0) + "点"; }, "#dda0dd"], + [25, "光环", function (enemy) { return (enemy.range != null ? ((enemy.haloSquare ? "该怪物九宫格" : "该怪物十字") + enemy.haloRange + "格范围内") : "同楼层所有") + "怪物生命提升" + (enemy.hpBuff || 0) + "%,攻击提升" + (enemy.atkBuff || 0) + "%,防御提升" + (enemy.defBuff || 0) + "%," + (enemy.haloAdd ? "可叠加" : "不可叠加"); }, "#e6e099", 1], + [26, "支援", "当周围一圈的怪物受到攻击时将上前支援,并组成小队战斗。", "#77c0b6", 1], + [27, "捕捉", function (enemy) { return "当走到怪物周围" + (enemy.zoneSquare ? "九宫格" : "十字") + "时会强制进行战斗。"; }, "#c0ddbb"] + ]; +}, "getEnemyInfo": function (enemy, hero, x, y, floorId) { // 获得某个怪物变化后的数据;该函数将被伤害计算和怪物手册使用 // 例如:坚固、模仿、仿攻等等 diff --git a/project/plugins.js b/project/plugins.js index 50da1b2..f750e95 100644 --- a/project/plugins.js +++ b/project/plugins.js @@ -451,47 +451,47 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = var selection = y - topIndex; core.status.event.selection = selection; switch (selection) { - case 0: - core.status.event.selection = 0; - core.playSound('确定'); - core.ui._drawSwitchs(); - break; - case 1: - // core.playSound('确定'); - core.ui._drawKeyBoard(); - break; - case 2: - // core.playSound('确定'); - core.clearUI(); - core.ui._drawViewMaps(); - break; - case 3: - core.status.event.selection = 0; - core.playSound('确定'); - core.ui._drawNotes(); - break; - case 4: - core.status.event.selection = 0; - core.playSound('确定'); - core.ui._drawSyncSave(); - break; - case 5: - core.status.event.selection = 0; - core.playSound('确定'); - core.ui._drawGameInfo(); - break; - case 6: - return core.confirmRestart(); - case 7: - core.playSound('取消'); - core.ui.closePanel(); - break; - case 8: - core.playSound('确定'); - core.setFlag("itemDetail", !core.getFlag("itemDetail")); - core.getItemDetail(); - core.ui.closePanel(); - break; + case 0: + core.status.event.selection = 0; + core.playSound('确定'); + core.ui._drawSwitchs(); + break; + case 1: + // core.playSound('确定'); + core.ui._drawKeyBoard(); + break; + case 2: + // core.playSound('确定'); + core.clearUI(); + core.ui._drawViewMaps(); + break; + case 3: + core.status.event.selection = 0; + core.playSound('确定'); + core.ui._drawNotes(); + break; + case 4: + core.status.event.selection = 0; + core.playSound('确定'); + core.ui._drawSyncSave(); + break; + case 5: + core.status.event.selection = 0; + core.playSound('确定'); + core.ui._drawGameInfo(); + break; + case 6: + return core.confirmRestart(); + case 7: + core.playSound('取消'); + core.ui.closePanel(); + break; + case 8: + core.playSound('确定'); + core.setFlag("itemDetail", !core.getFlag("itemDetail")); + core.getItemDetail(); + core.ui.closePanel(); + break; } } return; @@ -506,7 +506,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = if (num > 1) text += "x" + num; if (itemCls === 'items' && num == 1) text += core.items.getItemEffectTip(id); core.drawTip(text, id); - + // --- 首次获得道具的提示 if (!core.hasFlag("__itemHint__")) core.setFlag("__itemHint__", []); var itemHint = core.getFlag("__itemHint__"); @@ -514,38 +514,37 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = var hint = core.material.items[id].text || "该道具暂无描述"; try { hint = core.replaceText(hint); - } catch (e) { } + } catch (e) {} if (!core.status.event.id || core.status.event.id == 'action') { - core.insertAction("\t[" + core.material.items[id].name + "," + id + "]\b[center]" + hint + "\n" - + (id.endsWith('Key') ? "(钥匙类道具,遇到对应的门时自动打开)" - : itemCls == 'tools' ? "(消耗类道具,请按T在道具栏使用)" - : itemCls == 'constants' ? "(永久类道具,请按T在道具栏使用)" - : itemCls == 'equips' ? "(装备类道具,请按Q在装备栏进行装备)" : "")); + core.insertAction("\t[" + core.material.items[id].name + "," + id + "]\b[center]" + hint + "\n" + + (id.endsWith('Key') ? "(钥匙类道具,遇到对应的门时自动打开)" : + itemCls == 'tools' ? "(消耗类道具,请按T在道具栏使用)" : + itemCls == 'constants' ? "(永久类道具,请按T在道具栏使用)" : + itemCls == 'equips' ? "(装备类道具,请按Q在装备栏进行装备)" : "")); } itemHint.push(id); } - + this.afterGetItem(id, x, y, isGentleClick); if (callback) callback(); } core.enemys.getDamageString = function (enemy, x, y, floorId) { if (typeof enemy == 'string') enemy = core.material.enemys[enemy]; var damage = this.getDamage(enemy, x, y, floorId); - + var color = '#000000'; - + if (damage == null) { damage = "???"; color = '#FF2222'; - } - else { + } else { if (damage < 0) color = '#11FF11'; else if (damage == 0) color = '#FFFFFF'; else if (damage < core.status.hero.hp / 3) color = '#FFFF00'; else if (damage < core.status.hero.hp * 2 / 3) color = '#FF9933'; else if (damage < core.status.hero.hp) color = '#FF9933'; else color = '#FF2222'; - + damage = core.formatBigNumber(damage, true); if (core.enemys.hasSpecial(enemy, 19)) damage += "+"; @@ -554,7 +553,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = if (core.enemys.hasSpecial(enemy, 11)) damage += "^"; } - + return { "damage": damage, "color": color @@ -562,10 +561,325 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = } core.ui._drawBook_drawBackground = function () { core.setAlpha('ui', 1); - core.setFillStyle('ui', '#000000'); - core.fillRect('ui', 0, 0, core._PX_, core._PY_); - core.drawWindowSkin('winskin.png', 'ui', 0, 0, core._PX_, core._PY_); + //core.setFillStyle('ui', '#000000'); + //core.fillRect('ui', 0, 0, core._PX_, core._PY_);删除绘制的黑底 + core.createCanvas('bookBg', 0, 0, 480, 480, 138); ///创建一个动态画布用于绘制手册bg + core.drawWindowSkin('winskin.png', 'bookBg', 0, 0, core._PX_, core._PY_); } + + + + + + ui.prototype._drawBook_drawOne = function (floorId, index, enemy, pageinfo, selected) { + var top = pageinfo.per_height * index + pageinfo.padding_top; // 最上面margin默认是12px + enemy.floorId = floorId; + // 横向规划: + // 22 + 42 = 64 是头像框 + this._drawBook_drawBox(index, enemy, top, pageinfo); + var left = 64, + total_width = core._PX_ - left; + var name_width = total_width * 10 / 35; + this._drawBook_drawName(index, enemy, top, left, name_width); + this._drawBook_drawContent(index, enemy, top, left + name_width); + if (selected) + core.drawUIEventSelector(1, 'winskin.png', 10, top + 1, core._PX_ - 10 * 2, pageinfo.per_height, 139); ////绘制光标 + //core.strokeRoundRect('ui', 10, top + 1, core._PX_ - 10 * 2, pageinfo.per_height, 10, core.status.globalAttribute.selectColor);取消原本的黄色框框 + } + + ui.prototype._drawBook_drawBox = function (index, enemy, top, pageinfo) { + // 横向:22+42;纵向:10 + 42 + 10(正好居中);内部图像 32x32 + var border_top = top + (pageinfo.per_height - 42) / 2, + border_left = 22; + var img_top = border_top + 5, + img_left = border_left + 5; + //core.strokeRect('ui', 22, border_top, 42, 42, '#DDDDDD', 2); //删除怪物边框 + var blockInfo = core.getBlockInfo(enemy.id); + core.drawIcon('ui', enemy.id, 22 + 5, border_top + 5, 32, 32) ///取消用动画的绘制,改用图标绘制 + /* + // 检查大怪物 + if (blockInfo.bigImage) { + core.status.boxAnimateObjs.push({ + bigImage: blockInfo.bigImage, + face: blockInfo.face, + centerX: border_left + 21, + centerY: border_top + 21, + max_width: 60 + }); + } else if (blockInfo.height >= 42) { + var originEnemy = core.material.enemys[enemy.id] || {}; + // 检查上半部分是不是纯透明的;取用原始值避免重复计算 + if (originEnemy.is32x32 == null) { + originEnemy.is32x32 = this._drawBook_is32x32(blockInfo); + } + if (originEnemy.is32x32) { + core.status.boxAnimateObjs.push({ + 'bgx': border_left, + 'bgy': border_top, + 'bgWidth': 42, + 'bgHeight': 42, + 'x': img_left, + 'y': img_top, + 'height': 32, + 'animate': blockInfo.animate, + 'image': blockInfo.image, + 'pos': blockInfo.posY * blockInfo.height + blockInfo.height - 32 + }); + } else { + var drawWidth = 42 * 32 / blockInfo.height; + core.status.boxAnimateObjs.push({ + 'bgx': border_left, + 'bgy': border_top, + 'bgWidth': 42, + 'bgHeight': 42, + 'x': img_left - 5 + (42 - drawWidth) / 2, + 'y': img_top - 5, + 'dw': drawWidth, + 'dh': 42, + 'height': blockInfo.height, + 'animate': blockInfo.animate, + 'image': blockInfo.image, + 'pos': blockInfo.posY * blockInfo.height + }); + } + } else { + core.status.boxAnimateObjs.push({ + 'bgx': border_left, + 'bgy': border_top, + 'bgWidth': 42, + 'bgHeight': 42, + 'x': img_left, + 'y': img_top, + 'height': 32, + 'animate': blockInfo.animate, + 'image': blockInfo.image, + 'pos': blockInfo.posY * blockInfo.height + }); + } + */ + } + + ui.prototype._drawBook_drawName = function (index, enemy, top, left, width) { + // 绘制第零列(名称和特殊属性) + // 如果需要添加自己的比如怪物的称号等,也可以在这里绘制 + core.setTextAlign('ui', 'center'); + if (enemy.specialText.length == 0) { + core.fillText('ui', enemy.name, left + width / 2, + top + 35, '#ffffff', this._buildFont(enemy.name.length >= 5 ? 18 : 20, false), width); /////修改怪物名字的颜色,取消加粗 + } else { + core.fillText('ui', enemy.name, left + width / 2, + top + 28, '#ffffff', this._buildFont(enemy.name.length >= 5 ? 18 : 20, false), width); /////修改怪物名字颜色,取消加粗 + switch (enemy.specialText.length) { + case 1: + core.fillText('ui', enemy.specialText[0][0] + ' ' + enemy.specialText[0][1], left + width / 2, ////单属性两个字中间空一格 + top + 50, core.arrayToRGBA((enemy.specialColor || [])[0] || '#FF6A6A'), + this._buildFont(20, false), width); ////调大怪物字号,取消加粗 + break; + case 2: + // Step 1: 计算字体 + var text = enemy.specialText[0] + "" + enemy.specialText[1]; ///减少空格 + core.setFontForMaxWidth('ui', text, width, this._buildFont(20, false)); ////调大怪物属性的字号,取消加粗 + // Step 2: 计算总宽度 + var totalWidth = core.calWidth('ui', text); + var leftWidth = core.calWidth('ui', enemy.specialText[0]); + var rightWidth = core.calWidth('ui', enemy.specialText[1]); + // Step 3: 绘制 + core.fillText('ui', enemy.specialText[0], left + (width + leftWidth - totalWidth) / 2, + top + 50, core.arrayToRGBA((enemy.specialColor || [])[0] || '#FF6A6A')); + core.fillText('ui', enemy.specialText[1], left + (width + totalWidth - rightWidth) / 2, + top + 50, core.arrayToRGBA((enemy.specialColor || [])[1] || '#FF6A6A')); + break; + default: + core.fillText('ui', '多属性...', left + width / 2, + top + 50, '#FF6A6A', this._buildFont(15, true), width); + } + } + } + + + ui.prototype._drawBook_drawRow1 = function (index, enemy, top, left, width, position) { + // 绘制第一行 + core.setTextAlign('ui', 'left'); + var b13 = this._buildFont(13, true), + f13 = this._buildFont(13, false); + var col1 = left, + col2 = left + width * 9 / 25, + col3 = left + width * 17 / 25; + var colour = '#80ffff'; ////单数行颜色 + if (index % 2 === 0) + colour = '#80ff80'; ////双数行颜色 + core.fillText('ui', core.getStatusLabel('hp'), col1, position, colour, f13); + core.fillText('ui', core.formatBigNumber(enemy.hp || 0), col1 + 30, position, null, b13); + core.fillText('ui', core.getStatusLabel('atk'), col2, position, colour, f13); + core.fillText('ui', core.formatBigNumber(enemy.atk || 0), col2 + 30, position, null, b13); + core.fillText('ui', core.getStatusLabel('def'), col3, position, colour, f13); + core.fillText('ui', core.formatBigNumber(enemy.def || 0), col3 + 30, position, null, b13); + } + + ui.prototype._drawBook_drawRow2 = function (index, enemy, top, left, width, position) { + // 绘制第二行 + core.setTextAlign('ui', 'left'); + var b13 = this._buildFont(13, true), + f13 = this._buildFont(13, false); + var col1 = left, + col2 = left + width * 9 / 25, + col3 = left + width * 17 / 25; + var colour = '#80ffff'; ////单数行颜色 + if (index % 2 === 0) + colour = '#80ff80'; ////双数行颜色 + // 获得第二行绘制的内容 + var second_line = []; + if (core.flags.statusBarItems.indexOf('enableMoney') >= 0) second_line.push([core.getStatusLabel('money'), core.formatBigNumber(enemy.money || 0)]); + if (core.flags.enableAddPoint) second_line.push([core.getStatusLabel('point'), core.formatBigNumber(enemy.point || 0)]); + if (core.flags.statusBarItems.indexOf('enableExp') >= 0) second_line.push([core.getStatusLabel('exp'), core.formatBigNumber(enemy.exp || 0)]); + + var damage_offset = col1 + (core._PX_ - col1) / 2 - 12; + // 第一列 + if (second_line.length > 0) { + var one = second_line.shift(); + core.fillText('ui', one[0], col1, position, colour, f13); + core.fillText('ui', one[1], col1 + 30, position, colour, b13); + damage_offset = col2 + (core._PX_ - col2) / 2 - 12; + } + // 第二列 + if (second_line.length > 0) { + var one = second_line.shift(); + core.fillText('ui', one[0], col2, position, colour, f13); + core.fillText('ui', one[1], col2 + 30, position, colour, b13); + damage_offset = col3 + (core._PX_ - col3) / 2 - 12; + } + // 忽略第三列,直接绘制伤害 + core.fillText('ui', '伤害', col3, position, colour, f13); ////增加绘制伤害两字 + this._drawBook_drawDamage(index, enemy, damage_offset, position); + + } + + ui.prototype._drawBook_drawRow3 = function (index, enemy, top, left, width, position) { + // 绘制第三行 + core.setTextAlign('ui', 'left'); + var b13 = this._buildFont(13, true), + f13 = this._buildFont(13, false); + var col1 = left, + col2 = left + width * 9 / 25, + col3 = left + width * 17 / 25; + var colour = '#80ffff'; ////单数行颜色 + if (index % 2 === 0) + colour = '#80ff80'; ////双数行颜色 + core.fillText('ui', '临界', col1, position, colour, f13); + core.fillText('ui', core.formatBigNumber(enemy.critical || 0), col1 + 30, position, colour, b13); + core.fillText('ui', '减伤', col2, position, colour, f13); + core.fillText('ui', core.formatBigNumber(enemy.criticalDamage || 0), col2 + 30, position, colour, b13); + core.fillText('ui', '加防', col3, position, colour, f13); + core.fillText('ui', core.formatBigNumber(enemy.defDamage || 0), col3 + 30, position, colour, b13); + } + + ui.prototype._drawBook_drawDamage = function (index, enemy, offset, position) { //////修改了颜色 + offset -= 5; //往左移5像素 + //core.setTextAlign('ui', 'center');取消居中对齐 + var damage = enemy.damage, + color = '#e6de0d'; + if (damage == null) { + damage = '????'; ////////无法战斗怪物手册中改为????显示 + color = '#ff8080'; + } else { + if (damage >= core.status.hero.hp) color = '#ff8080'; + else if (damage >= core.status.hero.hp * 2 / 3) color = '#ffc080'; + else if (damage <= 0) color = '#ffffff'; + damage = core.formatBigNumber(damage); + if (core.enemys.hasSpecial(enemy, 19)) damage += "+"; + if (core.enemys.hasSpecial(enemy, 21)) damage += "-"; + if (core.enemys.hasSpecial(enemy, 11)) damage += "^"; + } + if (enemy.notBomb) damage += "[b]"; + core.fillText('ui', damage, offset, position, color, this._buildFont(13, true)); + } + + ////// 绘制怪物属性的详细信息 ////// + ui.prototype._drawBookDetail = function (index) { + var info = this._drawBookDetail_getInfo(index), + enemy = info[0]; + if (!enemy) return; + var content = info[1].join("\n"); + core.status.event.id = 'book-detail'; + core.animateFrame.tip = null; + core.clearMap('data'); + + var left = 10, + width = core._PX_ - 2 * left, + right = left + width; + var content_left = left + 25, + validWidth = right - content_left - 13; + var height = Math.max(this.getTextContentHeight(content, { fontSize: 16, lineHeight: 24, maxWidth: validWidth }) + 58, 80), + top = (core._PY_ - height) / 2, + bottom = top + height; + + core.drawWindowSkin('winskin.png', 'data', left, top, width, height); ////用winskin绘制一个对话框 + /// core.setAlpha('data', 0.9);///注销原本的黑底边框 + ///core.fillRect('data', left, top, width, height, '#000000'); + // core.setAlpha('data', 1); + // core.strokeRect('data', left - 1, top - 1, width + 1, height + 1, + // core.arrayToRGBA(core.status.globalAttribute.borderColor), 2); + core.playSound('确定'); + this._drawBookDetail_drawContent(enemy, content, { top: top, content_left: content_left, bottom: bottom, validWidth: validWidth }); + } + + + ////// 结束一切事件和绘制,关闭UI窗口,返回游戏进程 ////// + ui.prototype.closePanel = function () { + + core.clearMap('bookBg'); ////清空手册Bg + core.clearMap('itemBg'); ////清空道具栏Bg + core.clearUIEventSelector(1); ////清除绘制的光标 + + if (core.status.hero && core.status.hero.flags) { + // 清除全部临时变量 + Object.keys(core.status.hero.flags).forEach(function (name) { + if (name.startsWith("@temp@") || /^arg\d+$/.test(name)) { + delete core.status.hero.flags[name]; + } + }); + } + this.clearUI(); + core.maps.generateGroundPattern(); + core.updateStatusBar(true); + core.unlockControl(); + core.status.event.data = null; + core.status.event.id = null; + core.status.event.selection = null; + core.status.event.ui = null; + core.status.event.interval = null; + // 清除onDownInterval + clearInterval(core.interval.onDownInterval); + core.interval.onDownInterval = 'tmp'; + } + + ui.prototype._drawToolbox_drawBackground = function () { + // 绘制 + core.clearMap('ui'); + /// core.setAlpha('ui', 0.85); + /// core.fillRect('ui', 0, 0, core._PX_, core._PY_, '#000000'); + core.createCanvas('itemBg', 0, 0, 480, 480, 138); ///创建一个动态画布用于绘制道具栏bg + core.drawWindowSkin('winskin.png', 'itemBg', 0, 0, core._PX_, core._PY_); ///道具栏背景用winskin绘制 + } + + ui.prototype._drawToolbox_drawContent = function (info, line, items, page, drawCount) { + var n = core._HALF_WIDTH_; + core.setTextAlign('ui', 'right'); + for (var i = 0; i < core._WIDTH_ - 1; i++) { + var item = items[(core._WIDTH_ - 1) * (page - 1) + i]; + if (!item) continue; + var yoffset = line + 54 * Math.floor(i / n) + 19; + var icon = core.material.icons.items[item], + image = core.material.images.items; + core.drawImage('ui', image, 0, 32 * icon, 32, 32, 64 * (i % n) + 21, yoffset, 32, 32); + if (drawCount) + core.fillText('ui', core.itemCount(item), 64 * (i % n) + 56, yoffset + 33, '#FFFFFF', this._buildFont(14, true)); + if (info.selectId == item) + core.drawUIEventSelector(1, 'winskin.png', 64 * (i % n) + 17, yoffset - 4, 40, 40, 139); ////绘制光标 + //core.strokeRoundRect('ui', 64 * (i % n) + 17, yoffset - 4, 40, 40, 6, core.status.globalAttribute.selectColor);删除原本绘制的黄色边框 + } + } + core.ui.drawFly = function (page) { core.status.event.data = page; var floorId = core.floorIds[page]; @@ -581,9 +895,9 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = core.fillText('ui', '浏览地图时也', core._PX_ - 10, core._PY_ - 23, '#aaaaaa', this._buildFont(10, false)); core.fillText('ui', '可楼层跳跃!', core._PX_ - 10, core._PY_ - 11, null, this._buildFont(10, false)); core.setTextAlign('ui', 'center'); - + var middle = core._PY_ / 2 + 39; - + // 换行 var lines = core.splitLines('ui', title, 120, this._buildFont(19, true)); var start_y = middle - (lines.length - 1) * 11; @@ -2999,25 +3313,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = return colors; } - core.ui._drawBook_drawDamage = function (index, enemy, offset, position) { - core.setTextAlign('ui', 'center'); - var damage = enemy.damage, - color = '#FFFF00'; - if (damage == null) { - damage = '????'; ////////无法战斗怪物手册中改为????显示 - color = '#FF2222'; - } else { - if (damage >= core.status.hero.hp) color = '#FF2222'; - else if (damage >= core.status.hero.hp * 1 / 3) color = '#FF9933'; - else if (damage <= 0) color = '#11FF11'; - damage = core.formatBigNumber(damage); - if (core.enemys.hasSpecial(enemy, 19)) damage += "+"; - if (core.enemys.hasSpecial(enemy, 21)) damage += "-"; - if (core.enemys.hasSpecial(enemy, 11)) damage += "^"; - } - if (enemy.notBomb) damage += "[b]"; - core.fillText('ui', damage, offset, position, color, this._buildFont(13, true)); - } + }, "仿RM渐变效果": function () { // 在此增加新插件