refactor: scene control
This commit is contained in:
@@ -167,20 +167,20 @@ export class GridViewerScene extends ReactiveScene {
|
||||
const { width, height } = this.scale;
|
||||
|
||||
// Back button
|
||||
this.createButton('返回菜单', 100, 40, () => {
|
||||
this.scene.start('IndexScene');
|
||||
this.createButton('返回菜单', 100, 40, async () => {
|
||||
await this.sceneController.launch('IndexScene');
|
||||
});
|
||||
|
||||
// Clear button
|
||||
this.createButton('清空', width - 260, 40, () => {
|
||||
this.createButton('清空', width - 260, 40, async () => {
|
||||
this.inventory = createGridInventory(this.GRID_WIDTH, this.GRID_HEIGHT);
|
||||
this.scene.restart();
|
||||
await this.sceneController.restart();
|
||||
});
|
||||
|
||||
// Random fill button
|
||||
this.createButton('随机填充', width - 130, 40, () => {
|
||||
this.createButton('随机填充', width - 130, 40, async () => {
|
||||
this.randomFill();
|
||||
this.scene.restart();
|
||||
await this.sceneController.restart();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -63,8 +63,8 @@ export class IndexScene extends ReactiveScene {
|
||||
text.setScale(1);
|
||||
});
|
||||
|
||||
bg.on('pointerdown', () => {
|
||||
this.scene.start(targetScene);
|
||||
bg.on('pointerdown', async () => {
|
||||
await this.sceneController.launch(targetScene);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -85,8 +85,8 @@ export class MapViewerScene extends ReactiveScene {
|
||||
this.backButtonBg.setFillStyle(0x444466);
|
||||
this.backButtonText.setScale(1);
|
||||
});
|
||||
this.backButtonBg.on('pointerdown', () => {
|
||||
this.scene.start('IndexScene');
|
||||
this.backButtonBg.on('pointerdown', async () => {
|
||||
await this.sceneController.launch('IndexScene');
|
||||
});
|
||||
|
||||
// Regenerate button
|
||||
|
||||
@@ -126,8 +126,8 @@ export class ShapeViewerScene extends ReactiveScene {
|
||||
const { width, height } = this.scale;
|
||||
|
||||
// Back button
|
||||
this.createButton('返回菜单', 100, height - 40, () => {
|
||||
this.scene.start('IndexScene');
|
||||
this.createButton('返回菜单', 100, height - 40, async () => {
|
||||
await this.sceneController.launch('IndexScene');
|
||||
});
|
||||
|
||||
// Info text
|
||||
|
||||
Reference in New Issue
Block a user