diff --git a/src/stages/welcome/page_welcome.ts b/src/stages/welcome/page_welcome.ts index cf2f6d7..a0bf5c0 100644 --- a/src/stages/welcome/page_welcome.ts +++ b/src/stages/welcome/page_welcome.ts @@ -1,45 +1,35 @@ import Button from "@/components/Button"; -import { gameManager, defineWindow, stageManager } from "@/Game"; -import Sound from "@/Game/Sound"; -import { Container, Graphics, Text } from "pixi.js"; +import soundManager from "@/utils/Sound"; +import { Container } from "pixi.js"; +import { BaseScene } from "@/scene/BaseScene"; +import { SceneType } from "@/enums/SceneType"; +import position from "@/utils/Position"; -import Circle from "./circle" -import { PWindow } from "@/Game/type"; -import Position from "@/Game/Position"; +export default class WelcomeScene extends BaseScene { + stage: Container = new Container(); + constructor() { + super("welcome", SceneType.Normal); + } -export default defineWindow("welcome", class extends PWindow { - stage: Container = null - text: any - layout() { - const circle = Circle.render() - this.stage.addChild(circle) - circle.on("touchend", () => { - this.changeStage("welcome2") - }) - circle.on("mousedown", () => { - this.changeStage("welcome2") - }) - // this.text = new Text({text: "修仙人生日常"}) + async layout(): Promise { + const btn = new Button({ + text: "进入游戏", + onClick: () => { + this.changeScene("welcome2"); + }, + position: () => position.center(), + }); - // this.stage.addChild(this.text) - const btn = new Button({ - text: "修仙人生日常", position: () => Position.get("center", "center"), click: () => { - this.changeStage("init") - } - }) - this.stage.addChild(btn._comp) - } - onLoad() { - console.log("onLoad 1"); - } - onUnLoad() { - Sound.stop("my-sound") - console.log("onUnLoad 1"); - } - update() { - // this.text.x = gameManager.getInfo().width-this.text.width - // this.text.y = gameManager.getInfo().height-this.text.height - // console.log(22); - } -}) \ No newline at end of file + this.stage.addChild(btn.container); + } + + onLoad(): void { + console.log("welcome onLoad"); + } + + onUnLoad(): void { + soundManager.stop("my-sound"); + console.log("welcome onUnLoad"); + } +} \ No newline at end of file