新增一张内部完全透明的winskin图用于绘制

打开道具栏和手册时自绘状态栏效果改动
绘制道具栏改动
部分道具说明,以及是否在道具栏中显示改变(钥匙和手册)
This commit is contained in:
爱的天使Erdnase 2022-11-23 18:57:13 +08:00 committed by bdf1
parent 5d79aa9390
commit ad30bd4dda
5 changed files with 115 additions and 23 deletions

View File

@ -377,6 +377,7 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
"wangyuexiao.png",
"winskin.png",
"winskin2.png",
"winskin3.png",
"wupin.png",
"xialouti.png",
"xianzi.png",

View File

@ -1647,6 +1647,13 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
core.dom.caidan1Ctx.drawImage(core.material.images.images['caidan_grayscale.png'], 0, 0)
return;
}
//手册和道具栏画面背景
if (core.status.event.id === 'book' || core.status.event.id === 'toolbox') {
core.dom.caidan1Ctx.drawImage(core.material.images.images['black.png'], 0, 0)
core.drawWindowSkin('winskin.png', core.dom.caidan1Ctx, -20, 0, 201, 290);
core.drawWindowSkin('winskin.png', core.dom.caidan1Ctx, 0, 290, 161, 95);
core.drawWindowSkin('winskin.png', core.dom.caidan1Ctx, 0, 385, 161, 95);
}
if (core.flags.statusCanvas) { // 系统开关「自绘状态栏」开启
@ -1687,20 +1694,40 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
fill(core.getFlag("juqing", 0), 107, 91 + 35 + 36 + 34 + 32 + 32, '#FF0000');
ctx.textAlign = 'left';
if (flags.hard - 4) fill1('[' + core.formatBigNumber(core.getRealStatus('mdef')) + ']', 76, 174, '#FF1495');
core.drawImage(ctx, core.material.images.items, 0, 0, 32, 128, 13, 300, 28, 112);
fill('黄钥匙', 50, 320, '#FFFF80');
fill('蓝钥匙', 50, 320 + 28, '#80FFFF');
fill('红钥匙', 50, 320 + 56, '#FF8080');
fill('黑钥匙', 50, 320 + 84, '#000000');
ctx.textAlign = 'right';
fill(core.itemCount('yellowKey'), 140, 320, '#FFFF80');
fill(core.itemCount('blueKey'), 140, 320 + 28, '#80FFFF');
fill(core.itemCount('redKey'), 140, 320 + 56, '#FF8080');
fill(core.itemCount('greenKey'), 140, 320 + 84, '#000000');
core.drawImage(ctx, core.material.images.images[['00005.png', '00001.png', '00002.png', '00003.png', '00004.png', '00005.png'][flags.hard || 0]], 7, 404 - [0, 10, 10, 0, 0, 0][flags.hard || 0]);
ctx.textAlign = 'left';
if (flags.poison) fill("中毒", 8, 282, '#00CD00');
if (flags.weak) fill("衰弱", 64, 282, '#FF1493');
if (core.status.event.id !== 'book' && core.status.event.id !== 'toolbox') {
core.drawImage(ctx, core.material.images.items, 0, 0, 32, 128, 13, 300, 28, 112);
fill('黄钥匙', 50, 320, '#FFFF80');
fill('蓝钥匙', 50, 320 + 28, '#80FFFF');
fill('红钥匙', 50, 320 + 56, '#FF8080');
fill('黑钥匙', 50, 320 + 84, '#000000');
ctx.textAlign = 'right';
fill(core.itemCount('yellowKey'), 140, 320, '#FFFF80');
fill(core.itemCount('blueKey'), 140, 320 + 28, '#80FFFF');
fill(core.itemCount('redKey'), 140, 320 + 56, '#FF8080');
fill(core.itemCount('greenKey'), 140, 320 + 84, '#000000');
core.drawImage(ctx, core.material.images.images[['00005.png', '00001.png', '00002.png', '00003.png', '00004.png', '00005.png'][flags.hard || 0]], 7, 404 - [0, 10, 10, 0, 0, 0][flags.hard || 0]);
ctx.textAlign = 'left';
if (flags.poison) fill("中毒", 8, 282, '#00CD00');
if (flags.weak) fill("衰弱", 64, 282, '#FF1493');
} else {
core.drawWindowSkin('winskin3.png', ctx, 0, 0, 181, 290);
fill('游戏时间', 20, 330, '#c0e0ff');
fill('步数', 20, 425, '#c0e0ff');
ctx.textAlign = 'right';
var hour = Math.floor(core.animateFrame.totalTime / (1000 * 60 * 60)) % 24,
minutes = Math.floor(core.animateFrame.totalTime / (1000 * 60)) % 60,
seconds = Math.floor(core.animateFrame.totalTime / 1000) % 60,
day = Math.floor(core.animateFrame.totalTime / (1000 * 60 * 60 * 24)),
step = core.status.hero.steps;
hour = hour < 10 ? '0' + hour : hour;
minutes = minutes < 10 ? '0' + minutes : minutes;
seconds = seconds < 10 ? '0' + seconds : seconds;
if (day >= 1)
fill(day + ':' + hour + ':' + minutes + ':' + seconds, 140, 360, "#ffffff");
else
fill(hour + ':' + minutes + ':' + seconds, 140, 360, "#ffffff");
fill(step, 140, 455, '#ffffff');
}
}
} else if (core.flags.extendToolbar && !core.domStyle.isVertical) { // 横屏且隐藏状态栏
if (!core.dymCanvas['status'])

BIN
project/images/winskin3.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 KiB

View File

@ -4,19 +4,19 @@ var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a =
"cls": "tools",
"name": "黄钥匙",
"text": "用来开黄色的门",
"hideInToolbox": true
"hideInToolbox": false
},
"blueKey": {
"cls": "tools",
"name": "蓝钥匙",
"text": "用来开蓝色的门",
"hideInToolbox": true
"hideInToolbox": false
},
"redKey": {
"cls": "tools",
"name": "红钥匙",
"text": "用来开红色的门",
"hideInToolbox": true
"hideInToolbox": false
},
"redGem": {
"cls": "items",
@ -310,15 +310,15 @@ var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a =
"book": {
"cls": "constants",
"name": "怪物手册",
"text": "可以查看当前楼层各怪物属性",
"hideInToolbox": true,
"text": "持有后可以察看怪物信息",
"hideInToolbox": false,
"useItemEffect": "core.ui.drawBook(0);",
"canUseItemEffect": "true"
},
"fly": {
"cls": "constants",
"name": "楼层传送器",
"text": "可以自由往来去过的楼层",
"text": "在访问过的楼层间任意往来快捷键g",
"hideInReplay": true,
"hideInToolbox": false,
"useItemEffect": "core.ui.drawFly(core.floorIds.indexOf(core.status.floorId));",
@ -363,7 +363,7 @@ var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a =
"greenKey": {
"cls": "tools",
"name": "黑钥匙",
"text": "可以打开一扇黑门"
"text": "用来开黑色的门"
},
"steelKey": {
"cls": "tools",

View File

@ -850,7 +850,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
core.clearMap('bookBg'); ////清空手册Bg
core.clearMap('itemBg'); ////清空道具栏Bg
core.clearUIEventSelector(1); ////清除绘制的光标
core.clearUIEventSelector(2);
if (core.status.hero && core.status.hero.flags) {
// 清除全部临时变量
Object.keys(core.status.hero.flags).forEach(function (name) {
@ -879,7 +879,71 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
/// 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绘制
core.drawWindowSkin('winskin.png', 'itemBg', 0, 0, core._PX_, core._PY_ - 306); ///道具栏背景用winskin绘制
core.drawWindowSkin('winskin.png', 'itemBg', 0, core._PY_ - 306 - 20, core._PX_, core._PY_ - 306);
core.drawWindowSkin('winskin.png', 'itemBg', 0, core._PY_ - 146 - 30, core._PX_, core._PY_ - 306);
}
////// 绘制道具栏 //////
ui.prototype._drawToolbox = function (index) {
var info = this._drawToolbox_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, "永久道具");
this._drawToolbox_drawDescription(info, line1);
this._drawToolbox_drawContent(info, line1, info.tools, info.toolsPage, true);
this.drawPagination(info.toolsPage, info.toolsTotalPage, core._HEIGHT_ - 6);
this._drawToolbox_drawContent(info, line2, info.constants, info.constantsPage);
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, core._PY_ - 13);
}
ui.prototype._drawToolbox_drawDescription = function (info, max_height) {
core.setTextAlign('ui', 'left');
if (!info.selectId) return;
var item = core.material.items[info.selectId];
var name = item.name || "未知道具";
try { name = core.replaceText(name); } catch (e) {}
core.fillText('ui', name, 10 + 10, 32 + 10, "#ffffff", this._buildFont(20, true));
core.drawUIEventSelector(2, 'winskin.png', 15, 32 - 10, 25 * name.length || 0, 30, 139);
var text = item.text || "该道具暂无描述。";
try { text = core.replaceText(text); } catch (e) {}
var height = null;
for (var fontSize = 20; fontSize >= 9; fontSize -= 2) {
var config = { left: 10 + 10, top: 46 + 20, fontSize: fontSize, maxWidth: core._PX_ - 15, bold: true, color: "white" };
height = 42 + core.getTextContentHeight(text, config);
if (height < max_height || fontSize == 9) {
core.drawTextContent('ui', text, config);
break;
}
}
if (height < max_height - 33) {
core.fillText('ui', '<继续点击该道具即可进行使用>', 10 + 10, max_height - 15 - 10, '#CCCCCC', this._buildFont(14, false));
}
}
////// 点击工具栏时的打开操作 //////
events.prototype.openToolbox = function (fromUserAction) {
if (core.isReplaying()) return;
if (!this._checkStatus('toolbox', fromUserAction)) return;
core.playSound('打开界面');
core.updateStatusBar(); ///更新状态栏以绘制工具栏时的状态栏背景
core.ui._drawToolbox();
}
ui.prototype._drawToolbox_drawContent = function (info, line, items, page, drawCount) {