-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathScene.ts
30 lines (25 loc) · 807 Bytes
/
Scene.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import Screen from './Screen';
import SceneObject from './SceneObject';
/**
* Important!!
* -----------
* 1. Do not call the set position and size methods.
* such as setX, setY, setWidth, setHeight.
* Because the position and size of the Scene will be used for picking objects.
*/
export default class Scene extends SceneObject {
public onShow: (() => void) | null = null;
public onHide: (() => void) | null = null;
private screen: Screen;
constructor(screen: Screen) {
super(screen.getDesignedWidth(), screen.getDesignedHeight());
this.screen = screen;
}
public addSceneObject(object: SceneObject): SceneObject {
this.addChild(object);
return object;
}
public getCurrentScreen(): Screen {
return this.screen;
}
}