|
|
|
@ -4,36 +4,43 @@ import { Container, FederatedPointerEvent, Graphics } from "pixi.js"; |
|
|
|
|
|
|
|
export default class Welcome2Scene extends BaseScene { |
|
|
|
stage = new Container(); |
|
|
|
private circle?: Graphics; |
|
|
|
private goWelcome = (_e: FederatedPointerEvent): void => { |
|
|
|
if (!this.circle) { |
|
|
|
return; |
|
|
|
} |
|
|
|
this.circle.x += 10; |
|
|
|
this.changeScene("welcome"); |
|
|
|
}; |
|
|
|
|
|
|
|
constructor() { |
|
|
|
super("welcome2", SceneType.Normal); |
|
|
|
} |
|
|
|
|
|
|
|
layout(): void { |
|
|
|
const circle = new Graphics(); |
|
|
|
circle.label = "circle"; |
|
|
|
circle.circle(0, 0, 32); |
|
|
|
circle.fill(0xfb6a8f); |
|
|
|
circle.x = 130; |
|
|
|
circle.y = 300; |
|
|
|
circle.eventMode = "static"; |
|
|
|
circle.cursor = "pointer"; |
|
|
|
protected onSceneLayout(): void { |
|
|
|
this.circle = new Graphics(); |
|
|
|
this.circle.label = "circle"; |
|
|
|
this.circle.circle(0, 0, 32); |
|
|
|
this.circle.fill(0xfb6a8f); |
|
|
|
this.circle.x = 130; |
|
|
|
this.circle.y = 300; |
|
|
|
this.circle.eventMode = "static"; |
|
|
|
this.circle.cursor = "pointer"; |
|
|
|
|
|
|
|
const goWelcome = (_e: FederatedPointerEvent) => { |
|
|
|
circle.x += 10; |
|
|
|
this.changeScene("welcome"); |
|
|
|
}; |
|
|
|
|
|
|
|
circle.on("touchend", goWelcome); |
|
|
|
circle.on("mousedown", goWelcome); |
|
|
|
this.stage.addChild(circle); |
|
|
|
this.circle.on("touchend", this.goWelcome); |
|
|
|
this.circle.on("mousedown", this.goWelcome); |
|
|
|
this.stage.addChild(this.circle); |
|
|
|
} |
|
|
|
|
|
|
|
onLoad(): void { |
|
|
|
protected onSceneEnter(): void { |
|
|
|
console.log("onLoad 2"); |
|
|
|
} |
|
|
|
|
|
|
|
onUnLoad(): void { |
|
|
|
protected onSceneExit(): void { |
|
|
|
if (this.circle) { |
|
|
|
this.circle.off("touchend", this.goWelcome); |
|
|
|
this.circle.off("mousedown", this.goWelcome); |
|
|
|
} |
|
|
|
console.log("onUnLoad 2"); |
|
|
|
} |
|
|
|
} |
|
|
|
|