minor changes
This commit is contained in:
parent
c052d08e0e
commit
269faca609
5 changed files with 11 additions and 11 deletions
|
|
@ -43,7 +43,7 @@ function preload() {
|
|||
floorImage = loadImage(FLOOR_IMAGE_PATH);
|
||||
}
|
||||
function setup() {
|
||||
createCanvas(2000, 1000);
|
||||
createCanvas(1085, 600);
|
||||
floorHeight = height / 5;
|
||||
setupObstacleConsts();
|
||||
setupFont();
|
||||
|
|
|
|||
|
|
@ -10,8 +10,8 @@
|
|||
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"></script>
|
||||
|
||||
<title><%= htmlWebpackPlugin.options.title %></title>
|
||||
<script src="./game.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/p5@1.5.0/lib/p5.js"></script>
|
||||
<script src="./game.js"></script>
|
||||
</head>
|
||||
<body style="background-color: beige;">
|
||||
<noscript>
|
||||
|
|
|
|||
|
|
@ -7,10 +7,10 @@
|
|||
<UserScores :userScores="userScores"></UserScores>
|
||||
</div>
|
||||
<div class="row">
|
||||
<Game v-if="user" v-bind:user-id=this.userId class="col"
|
||||
<Game :class="user ? '' : 'hidden'" v-bind:user-id=this.userId class="col"
|
||||
@gameFinished="this.updateUserScores()">
|
||||
</Game>
|
||||
<Login v-else @userChange="(event) => {this.user = event; this.userId = this.user.id}">
|
||||
<Login v-if="!user" @userChange="(event) => {this.user = event; this.userId = this.user.id}">
|
||||
</Login>
|
||||
</div>
|
||||
<div class="row">
|
||||
|
|
@ -52,8 +52,6 @@ export default defineComponent({
|
|||
user: null,
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
methods: {
|
||||
async fetchFromApi(path: string, method: "GET" | "POST") {
|
||||
let res: Response = await fetch(Rest.URL + path, {method: method,});
|
||||
|
|
@ -86,4 +84,7 @@ export default defineComponent({
|
|||
.everything {
|
||||
margin-bottom: 4em;
|
||||
}
|
||||
.hidden {
|
||||
visibility: hidden;
|
||||
}
|
||||
</style>
|
||||
|
|
|
|||
|
|
@ -40,9 +40,6 @@ export default {
|
|||
created() {
|
||||
this.updatePage();
|
||||
},
|
||||
updated() {
|
||||
this.updatePage()
|
||||
},
|
||||
methods: {
|
||||
async fetchPage() {
|
||||
let res = await fetch(`${Rest.URL}/leaderboard/${this.type}?pagination=true&entriesPerPage=${this.entriesPerPage}&page=${this.pageNumber}`, {method: "GET"});
|
||||
|
|
|
|||
|
|
@ -25,8 +25,10 @@ export default {
|
|||
emits: ['userChange'],
|
||||
methods: {
|
||||
async setUser() {
|
||||
let user = await User.getByName(this.username);
|
||||
if (user.errors) {
|
||||
let user;
|
||||
try {
|
||||
user = await User.getByName(this.username);
|
||||
} catch (e) {
|
||||
user = await User.create(this.username);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue