34 lines
818 B
JavaScript
34 lines
818 B
JavaScript
import { Actor, Action } from './actor.js';
|
|
|
|
export class Scene {
|
|
constructor(name, rootBox) {
|
|
this.name = name;
|
|
this.box = rootBox.addBox(name);
|
|
this.titleBox = this.box.addBox().setInnerHTML(name);
|
|
this.box.addBox('Spacer').setInnerHTML(' ');
|
|
this.displayValuesBox = this.box.addBox(`${this.name}-values`);
|
|
this.box.addBox('Spacer').setInnerHTML(' ');
|
|
this.logBox = this.box.addBox(`${this.name}-log`);
|
|
}
|
|
|
|
addActor(name) {
|
|
const actor = new Actor(name, this);
|
|
return actor;
|
|
}
|
|
|
|
addAction(name) {
|
|
const action = new Action(name, this);
|
|
return action;
|
|
}
|
|
|
|
addDisplayValue(name) {
|
|
const dv = this.displayValuesBox.addDisplayValue(name);
|
|
return dv;
|
|
}
|
|
|
|
log(msg) {
|
|
this.logBox.addBox().setInnerHTML(msg).monospace();
|
|
return this;
|
|
}
|
|
}
|