refactor: inline room.fromJSON
This commit is contained in:
parent
8d67f220c9
commit
0a6677055c
|
@ -28,10 +28,11 @@ const decorate = compose(
|
|||
|
||||
export class Room extends decorate(class {}) {
|
||||
|
||||
constructor() {
|
||||
constructor(json) {
|
||||
super();
|
||||
this.bounds = [];
|
||||
this.layers = new Layers();
|
||||
const layerJSON = 'undefined' !== typeof json ? json.layers : undefined;
|
||||
this.layers = new Layers(layerJSON);
|
||||
this.queuedEntityPackets = {};
|
||||
// Listeners.
|
||||
this.layers.on('entityAdded', this.onEntityAddedToRoom, this);
|
||||
|
@ -39,6 +40,9 @@ export class Room extends decorate(class {}) {
|
|||
this.layers.on('layerAdded', this.onLayerAdded, this);
|
||||
this.on('sizeChanged', this.onSizeChanged, this);
|
||||
this.on('worldChanged', this.onWorldChanged, this);
|
||||
if ('undefined' !== typeof json && json.size) {
|
||||
this.size = json.size;
|
||||
}
|
||||
}
|
||||
|
||||
acceptPacket(packet) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user