Fixed all the level issues

This commit is contained in:
2021-02-26 01:36:19 -07:00
parent a3f359d78d
commit 32ffad0b21

View File

@@ -78,7 +78,7 @@
</div>--> </div>-->
</div> </div>
<div id="levelselect"> <div id="levelselect">
<v-virtual-scroll height="480" width="350" item-height="32" :items="levels"> <v-virtual-scroll height="480" width="350" item-height="32" :items="games[currentgame].levels">
<template v-slot:default="{ item }"> <template v-slot:default="{ item }">
<v-list-item <v-list-item
:key="item.index" :key="item.index"
@@ -135,11 +135,57 @@
>Previous Level</v-btn >Previous Level</v-btn
> >
<v-btn <v-btn
:disabled="currentLevel >= levels.length - 1" :disabled="currentLevel >= games[currentgame].levels.length - 1"
medium medium
@click="nextlevel" @click="nextlevel"
>Next Level</v-btn >Next Level</v-btn
> >
<div id="gameselect">
<v-virtual-scroll height="480" width="350" item-height="32" :items="games">
<template v-slot:default="{ item }">
<v-list-item
:key="item.index"
@click="gamejump(item.index)"
one-line
dense
>
<v-list-item-action style="margin-right: 5px;">
<v-btn v-if="item.index == currentgame"
x-small
depressed
color="error"
>
{{ item.index }}
</v-btn>
<v-btn v-else
x-small
depressed
color="teal"
>
{{ item.index }}
</v-btn>
</v-list-item-action>
<v-list-item-content>
<v-list-item-title v-if="item.index == currentgame" >
<v-btn
x-small
depressed
color="error"
>
{{ item.gamename }}
</v-btn>
</v-list-item-title>
<v-list-item-title v-else
style="margin-left: 0px;"
>
{{ item.gamename }}
</v-list-item-title>
</v-list-item-content>
</v-list-item>
<v-divider />
</template>
</v-virtual-scroll>
</div>
</v-col> </v-col>
</v-row> </v-row>
@@ -239,53 +285,6 @@
</v-col> </v-col>
</v-row> </v-row>
<div id="gameselect">
<v-virtual-scroll height="480" width="350" item-height="32" :items="games">
<template v-slot:default="{ item }">
<v-list-item
:key="item.index"
@click="gamejump(item.index)"
one-line
dense
>
<v-list-item-action style="margin-right: 5px;">
<v-btn v-if="item.index == currentgame"
x-small
depressed
color="error"
>
{{ item.index }}
</v-btn>
<v-btn v-else
x-small
depressed
color="teal"
>
{{ item.index }}
</v-btn>
</v-list-item-action>
<v-list-item-content>
<v-list-item-title v-if="item.index == currentgame" >
<v-btn
x-small
depressed
color="error"
>
{{ item.gamename }}
</v-btn>
</v-list-item-title>
<v-list-item-title v-else
style="margin-left: 0px;"
>
{{ item.gamename }}
</v-list-item-title>
</v-list-item-content>
</v-list-item>
<v-divider />
</template>
</v-virtual-scroll>
</div>
</v-container> </v-container>
</v-content> </v-content>
</v-app> </v-app>
@@ -305,19 +304,25 @@ export default {
beforeMount: function() {}, beforeMount: function() {},
mounted: function() { mounted: function() {
this.reset(); this.reset();
this.resetgame();
}, },
methods: { methods: {
copycomp: function() { copycomp: function() {
navigator.clipboard.writeText(this.levels[this.currentLevel].compliment) navigator.clipboard.writeText(this.games[this.currentgame].levels[this.currentLevel].compliment)
},
resetgame: function() {
for (var x = 0; x < this.games.length; x++) {
this.games[x].index = x;
}
}, },
reset: function () { reset: function () {
this.currentLevel = 0; this.currentLevel = 0;
this.score = 0; this.score = 0;
this.currenttask = 0; this.currenttask = 0;
this.name = ""; this.name = "";
for (var x = 0; x < this.levels.length; x++) { for (var x = 0; x < this.games[this.currentgame].levels.length; x++) {
this.levels[x].completed = false; this.games[this.currentgame].levels[x].completed = false;
this.levels[x].index = x; this.games[this.currentgame].levels[x].index = x;
} }
}, },
/*scramble: function() { /*scramble: function() {
@@ -347,7 +352,7 @@ export default {
},*/ },*/
nextlevel: function () { nextlevel: function () {
if (this.currentLevel < this.levels.length) { if (this.currentLevel < this.games[this.currentgame].levels.length) {
this.ready = false; this.ready = false;
this.currenttask = 0; this.currenttask = 0;
this.currentLevel++; this.currentLevel++;
@@ -365,10 +370,10 @@ export default {
this.currenttask++; this.currenttask++;
},*/ },*/
completetask: function () { completetask: function () {
if (!this.levels[this.currentLevel].completed) { if (!this.games[this.currentgame].levels[this.currentLevel].completed) {
this.levels[this.currentLevel].completed = true; this.games[this.currentgame].levels[this.currentLevel].completed = true;
this.score += this.levels[this.currentLevel].points; this.score += this.games[this.currentgame].levels[this.currentLevel].points;
if (this.autonext && this.levels.length > this.currentLevel) { if (this.autonext && this.games[this.currentgame].levels.length > this.currentLevel) {
setTimeout(this.nextlevel, 600); setTimeout(this.nextlevel, 600);
} }
} }
@@ -384,6 +389,7 @@ export default {
this.ready = false; this.ready = false;
this.currentgame = i; this.currentgame = i;
this.ready = true; this.ready = true;
this.reset();
}, },
leveljump: function (i) { leveljump: function (i) {
this.ready = false; this.ready = false;
@@ -501,7 +507,7 @@ export default {
limit: 200, limit: 200,
}, },
/*hidehighscore: false,*/ /*hidehighscore: false,*/
hidehightscorecover: false, hidehighscorecover: false,
fontFamily: "Acme", fontFamily: "Acme",
games: [{ games: [{
gamename: "Game1", gamename: "Game1",