|
| 1 | +import Phaser from "phaser"; |
| 2 | +import { useJigsStore } from '../../stores/jigs'; |
| 3 | + |
| 4 | +export class MessageScene extends Phaser.Scene { |
| 5 | + jigs: any; |
| 6 | + |
| 7 | + constructor() { |
| 8 | + super({ key: "MessageScene" }); |
| 9 | + this.jigs = useJigsStore(); |
| 10 | + } |
| 11 | + |
| 12 | + preload() { |
| 13 | + } |
| 14 | + |
| 15 | + create() { |
| 16 | + |
| 17 | + if (this.jigs.missionCompleteDialog !== "Blank") { |
| 18 | + |
| 19 | + var content = this.jigs.missionCompleteDialog; |
| 20 | + console.log(this.jigs.missionCompleteDialog); |
| 21 | + |
| 22 | + // const missionCompleteTitle = this.add.text(100, 300, this.jigs.missionCompleteDialog.title, { font: 'bold 24px Roboto', backgroundColor: 'rgba(0, 0, 0, 0.8)', color: '#ffffff' }).setPadding({ left: 16, right: 16, top: 8, bottom: 8 }); |
| 23 | + |
| 24 | + let noti_bg = this.add.rectangle(200, 100, 600, 400, 0x000000, .5).setDisplayOrigin(0, 0); |
| 25 | + const missionCompleteHeader = this.add.text(100, 200, 'Mission Complete!', { font: 'bold 32px Roboto', backgroundColor: 'rgba(0, 0, 0, 0.8)', color: '#ffffff' }).setPadding({ left: 16, right: 16, top: 8, bottom: 8 }).setDisplayOrigin(0, 0); |
| 26 | + Phaser.Display.Align.In.TopCenter(missionCompleteHeader, noti_bg); |
| 27 | + // let noti_txt = this.add.text(0, 0, 'Magic is not ready yet\n\nwait a sec', { align: 'center' }); |
| 28 | + |
| 29 | + const text = this.add.text(0, 0, content, { font: 'bold 16px Roboto', backgroundColor: 'rgba(0, 0, 0, 0.8)', color: '#ffffff' }).setPadding({ left: 16, right: 16, top: 8, bottom: 8 }).setDisplayOrigin(0,0); |
| 30 | + text.setWordWrapWidth(500, false); |
| 31 | + |
| 32 | + Phaser.Display.Align.In.Center(text, noti_bg); |
| 33 | + const missionCompleteReward = this.add.text(300, 200, 'Reward', { font: 'bold 24px Roboto', backgroundColor: 'rgba(25, 83, 95, 0.8)', color: '#ffffff' }).setPadding({ left: 16, right: 16, top: 8, bottom: 8 }); |
| 34 | + |
| 35 | + Phaser.Display.Align.In.BottomCenter(missionCompleteReward, noti_bg); |
| 36 | + |
| 37 | + this.add.image(350, 400, 'icon01'); |
| 38 | + this.add.image(450, 400, 'icon02'); |
| 39 | + this.add.image(550, 400, 'icon03'); |
| 40 | + this.add.image(650, 400, 'icon04'); |
| 41 | + |
| 42 | + this.jigs.missionCompleteDialog = "Blank"; |
| 43 | + |
| 44 | + const helloButton = this.add.text(100, 100, 'Close', { color: '#0f0' }); |
| 45 | + helloButton.setInteractive(); |
| 46 | + helloButton.on('pointerdown', () => { |
| 47 | + // this.scene.stop(); |
| 48 | + this.scene.switch('HudScene'); |
| 49 | + }); |
| 50 | + } |
| 51 | + } |
| 52 | + |
| 53 | + update() { } |
| 54 | +} |
0 commit comments