刻度尺高亮,前景虚化

This commit is contained in:
ckcz123 committed 2020-07-19 11:52:50 +08:00
1 parent f040f82b51
commit 2bf38dece2
6 files changed
+60 -18

No files matched your search

+15 -18
View File
@@ -865,7 +865,22 @@ maps.prototype._drawBlockInfo_bgfg = function (blockInfo, name, x, y, ctx) {
}
core.drawImage(ctx, core.material.groundCanvas.canvas, px, py);
}
var alpha = null;
if (name == 'fg' && this._drawBlockInfo_shouldBlurFg()) {
var eventArr = this.getMapArray();
if (eventArr != null && eventArr[y][x] != 0) {
ctx = core.getContextByName(ctx);
alpha = ctx.globalAlpha;
core.setAlpha(ctx, 0.6);
}
}
core.drawImage(ctx, image, posX * 32, posY * height, 32, height, px, py + 32 - height, 32, height);
if (alpha != null) core.setAlpha(ctx, alpha);
}
////// 是否应当存在事件时虚化前景层 //////
maps.prototype._drawBlockInfo_shouldBlurFg = function () {
return main.mode == 'editor' || core.flags.blurFg;
}
////// 生成groundPattern //////
@@ -1099,11 +1114,6 @@ maps.prototype._drawBgFgMap = function (floorId, name, config) {
var endY = config.onMap && core.bigmap.v2 ? Math.min(height, core.bigmap.posY + core.__SIZE__ + 2) : height; // +1 for 48 px
var arr = this._getBgFgMapArray(name, floorId, !config.redraw);
var eventArr = null;
if (name == 'fg' && config.onMap && this._drawBgFgMap_shouldBlurFg()) {
eventArr = this.getMapArray(floorId);
}
for (var x = startX; x < endX; x++) {
for (var y = startY; y < endY; y++) {
if (arr[y][x] == 0) continue;
@@ -1111,24 +1121,11 @@ maps.prototype._drawBgFgMap = function (floorId, name, config) {
block.name = name;
var blockInfo = this.getBlockInfo(block);
if (!blockInfo) continue;
// --- 前景虚化
var blur = false, alpha;
if (eventArr != null && eventArr[y][x] != 0) {
blur = true;
alpha = config.ctx.globalAlpha;
config.ctx.globalAlpha = 0.6;
}
this._drawMap_drawBlockInfo(config.ctx, block, blockInfo, arr, config.onMap);
if (blur) config.ctx.globalAlpha = alpha;
}
}
}
////// 是否应当存在事件时虚化前景层 //////
maps.prototype._drawBgFgMap_shouldBlurFg = function () {
return main.mode == 'editor' || core.flags.blurFg;
}
////// 绘制楼层贴图 //////
maps.prototype._drawFloorImages = function (floorId, ctx, name, images, currStatus, onMap) {
floorId = floorId || core.status.floorId;