1 changed files with 30 additions and 40 deletions
@ -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: "修仙人生日常"})
|
|||
|
|||
// this.stage.addChild(this.text)
|
|||
async layout(): Promise<void> { |
|||
const btn = new Button({ |
|||
text: "修仙人生日常", position: () => Position.get("center", "center"), click: () => { |
|||
this.changeStage("init") |
|||
} |
|||
}) |
|||
this.stage.addChild(btn._comp) |
|||
text: "进入游戏", |
|||
onClick: () => { |
|||
this.changeScene("welcome2"); |
|||
}, |
|||
position: () => position.center(), |
|||
}); |
|||
|
|||
this.stage.addChild(btn.container); |
|||
} |
|||
onLoad() { |
|||
console.log("onLoad 1"); |
|||
|
|||
onLoad(): void { |
|||
console.log("welcome onLoad"); |
|||
} |
|||
onUnLoad() { |
|||
Sound.stop("my-sound") |
|||
console.log("onUnLoad 1"); |
|||
|
|||
onUnLoad(): void { |
|||
soundManager.stop("my-sound"); |
|||
console.log("welcome onUnLoad"); |
|||
} |
|||
update() { |
|||
// this.text.x = gameManager.getInfo().width-this.text.width
|
|||
// this.text.y = gameManager.getInfo().height-this.text.height
|
|||
// console.log(22);
|
|||
} |
|||
}) |
|||
Loading…
Reference in new issue