optimize: sepia application
This commit is contained in:
parent
6a93555354
commit
53e1ecc595
|
@ -66,7 +66,14 @@ export class App extends decorate(class {}) {
|
||||||
this.roomView = new RoomView(this.room, this.stage.renderer);
|
this.roomView = new RoomView(this.room, this.stage.renderer);
|
||||||
this.stage.addChild(this.roomView);
|
this.stage.addChild(this.roomView);
|
||||||
this.on('darknessChanged', this.applyLighting, this);
|
this.on('darknessChanged', this.applyLighting, this);
|
||||||
this.on('isFocusedChanged', this.applyLighting, this);
|
this.on('isFocusedChanged', () => {
|
||||||
|
if (this.isFocused) {
|
||||||
|
this.stage.removeAllFilters();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.stage.sepia();
|
||||||
|
}
|
||||||
|
})
|
||||||
// Listen for new entities.
|
// Listen for new entities.
|
||||||
this.room.on('entityAdded', this.onRoomEntityAdded, this);
|
this.room.on('entityAdded', this.onRoomEntityAdded, this);
|
||||||
// Input.
|
// Input.
|
||||||
|
@ -100,7 +107,6 @@ export class App extends decorate(class {}) {
|
||||||
}
|
}
|
||||||
|
|
||||||
applyLighting() {
|
applyLighting() {
|
||||||
this.stage.removeAllFilters();
|
|
||||||
const roomView = this.roomView;
|
const roomView = this.roomView;
|
||||||
if (!roomView) {
|
if (!roomView) {
|
||||||
return;
|
return;
|
||||||
|
@ -128,9 +134,6 @@ export class App extends decorate(class {}) {
|
||||||
const layerContainer = layerView.layerContainer;
|
const layerContainer = layerView.layerContainer;
|
||||||
layerContainer.night(this.darkness);
|
layerContainer.night(this.darkness);
|
||||||
}
|
}
|
||||||
if (!this.isFocused) {
|
|
||||||
this.stage.paused(this.darkness);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
calculateDarkness() {
|
calculateDarkness() {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user