mirror of
https://github.com/unanmed/HumanBreak.git
synced 2025-01-19 12:49:25 +08:00
feat: 元素滤镜
This commit is contained in:
parent
8440f222ac
commit
929ca6f18d
@ -1477,33 +1477,33 @@ maps.prototype.generateGroundPattern = function (floorId) {
|
||||
maps.prototype.drawMap = function (floorId) {
|
||||
floorId = floorId || core.status.floorId;
|
||||
if (!floorId) return;
|
||||
core.clearMap('all');
|
||||
this.generateGroundPattern(floorId);
|
||||
// core.clearMap('all');
|
||||
// this.generateGroundPattern(floorId);
|
||||
core.status.floorId = floorId;
|
||||
core.extractBlocks(floorId);
|
||||
core.status.thisMap = core.status.maps[floorId];
|
||||
|
||||
this._drawMap_drawAll();
|
||||
if (core.status.curtainColor) {
|
||||
core.fillRect(
|
||||
'curtain',
|
||||
0,
|
||||
0,
|
||||
core._PX_,
|
||||
core._PY_,
|
||||
core.arrayToRGBA(core.status.curtainColor)
|
||||
);
|
||||
}
|
||||
core.drawHero();
|
||||
// this._drawMap_drawAll();
|
||||
// if (core.status.curtainColor) {
|
||||
// core.fillRect(
|
||||
// 'curtain',
|
||||
// 0,
|
||||
// 0,
|
||||
// core._PX_,
|
||||
// core._PY_,
|
||||
// core.arrayToRGBA(core.status.curtainColor)
|
||||
// );
|
||||
// }
|
||||
// core.drawHero();
|
||||
core.updateStatusBar();
|
||||
};
|
||||
|
||||
////// 重绘某张地图 //////
|
||||
maps.prototype.redrawMap = function () {
|
||||
core.bigmap.canvas.forEach(function (one) {
|
||||
core.clearMap(one);
|
||||
});
|
||||
this._drawMap_drawAll(null, { redraw: true });
|
||||
// core.bigmap.canvas.forEach(function (one) {
|
||||
// core.clearMap(one);
|
||||
// });
|
||||
// this._drawMap_drawAll(null, { redraw: true });
|
||||
core.drawDamage();
|
||||
};
|
||||
|
||||
|
@ -162,6 +162,8 @@ export abstract class RenderItem<E extends ERenderItemEvent = ERenderItemEvent>
|
||||
antiAliasing: boolean = true;
|
||||
/** 是否被隐藏 */
|
||||
hidden: boolean = false;
|
||||
/** 滤镜 */
|
||||
filter: string = 'none';
|
||||
|
||||
/** 当前元素的父元素 */
|
||||
parent?: RenderItem & IRenderChildable;
|
||||
@ -226,6 +228,7 @@ export abstract class RenderItem<E extends ERenderItemEvent = ERenderItemEvent>
|
||||
const ay = -this.anchorY * this.height;
|
||||
|
||||
canvas.ctx.save();
|
||||
canvas.ctx.filter = this.filter;
|
||||
canvas.setAntiAliasing(this.antiAliasing);
|
||||
if (this.type === 'static') transformCanvas(canvas, tran);
|
||||
if (this.enableCache) {
|
||||
@ -257,6 +260,15 @@ export abstract class RenderItem<E extends ERenderItemEvent = ERenderItemEvent>
|
||||
this.transform.setTranslate(x, y);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置本元素的滤镜
|
||||
* @param filter 滤镜
|
||||
*/
|
||||
seyFilter(filter: string) {
|
||||
this.filter = filter;
|
||||
this.update(this);
|
||||
}
|
||||
|
||||
setAnchor(x: number, y: number): void {
|
||||
this.anchorX = x;
|
||||
this.anchorY = y;
|
||||
|
Loading…
Reference in New Issue
Block a user