expand Justice

This commit is contained in:
KGrzeg 2021-10-18 02:33:29 +02:00
parent a16f5bb56e
commit e244da0942
8 changed files with 69 additions and 13 deletions

View file

@ -1,4 +1,3 @@
const baseApiPath = "http://localhost:3000"
export default {
@ -70,5 +69,9 @@ export default {
async top() {
return this.get("top")
},
async start() {
return this.get("start")
}
}

View file

@ -22,6 +22,10 @@ export default class PlayScene extends Phaser.Scene {
if (window.myStuff.token) {
const response = await API.record(pts, shts, time)
if (response.error) {
console.log("%c" + response.error, "color:red")
}
if (response.rank) {
rank = response.rank
await window.updateTopList()

View file

@ -1,4 +1,5 @@
import Phaser from 'phaser'
import API from "../api"
export default class StartScene extends Phaser.Scene {
@ -42,8 +43,15 @@ export default class StartScene extends Phaser.Scene {
color: 'yellow'
}).setOrigin(0.5, 0.5)
this.input.on('pointerup', () => {
this.input.on('pointerup', async () => {
window.freezeGui()
if (window.myStuff.token) {
try {
await API.start()
} catch (error) {
console.log("oops", error)
}
}
this.scene.start('play-scene');
});
}