refactor: sepia on menu open
This commit is contained in:
parent
c7998a7668
commit
db861f60a3
|
@ -66,14 +66,8 @@ export class App extends decorate(class {}) {
|
|||
this.roomView = new RoomView(this.room, this.stage.renderer);
|
||||
this.stage.addChild(this.roomView);
|
||||
this.on('darknessChanged', this.applyLighting, this);
|
||||
this.on('isFocusedChanged', () => {
|
||||
if (this.isFocused) {
|
||||
this.stage.removeAllFilters();
|
||||
}
|
||||
else {
|
||||
this.stage.sepia();
|
||||
}
|
||||
})
|
||||
this.on('isFocusedChanged', this.applyMuting, this)
|
||||
this.on('isMenuOpenedChanged', this.applyMuting, this)
|
||||
// Listen for new entities.
|
||||
this.room.on('entityAdded', this.onRoomEntityAdded, this);
|
||||
// Input.
|
||||
|
@ -136,6 +130,15 @@ export class App extends decorate(class {}) {
|
|||
}
|
||||
}
|
||||
|
||||
applyMuting() {
|
||||
if (!this.isFocused || this.isMenuOpened) {
|
||||
this.stage.sepia();
|
||||
}
|
||||
else {
|
||||
this.stage.removeAllFilters();
|
||||
}
|
||||
}
|
||||
|
||||
calculateDarkness() {
|
||||
let darkness = 0;
|
||||
if (this.worldTime.hour >= 21 || this.worldTime.hour < 4) {
|
||||
|
@ -226,7 +229,7 @@ export class App extends decorate(class {}) {
|
|||
case 'F2':
|
||||
this.isDebugging = !this.isDebugging;
|
||||
break;
|
||||
case 'Escape':
|
||||
case 'e':
|
||||
this.isMenuOpened = !this.isMenuOpened;
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user