Fixed all the level issues
This commit is contained in:
124
src/App.vue
124
src/App.vue
@@ -78,7 +78,7 @@
|
||||
</div>-->
|
||||
</div>
|
||||
<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 }">
|
||||
<v-list-item
|
||||
:key="item.index"
|
||||
@@ -135,11 +135,57 @@
|
||||
>Previous Level</v-btn
|
||||
>
|
||||
<v-btn
|
||||
:disabled="currentLevel >= levels.length - 1"
|
||||
:disabled="currentLevel >= games[currentgame].levels.length - 1"
|
||||
medium
|
||||
@click="nextlevel"
|
||||
>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-row>
|
||||
|
||||
@@ -239,53 +285,6 @@
|
||||
</v-col>
|
||||
</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-content>
|
||||
</v-app>
|
||||
@@ -305,19 +304,25 @@ export default {
|
||||
beforeMount: function() {},
|
||||
mounted: function() {
|
||||
this.reset();
|
||||
this.resetgame();
|
||||
},
|
||||
methods: {
|
||||
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 () {
|
||||
this.currentLevel = 0;
|
||||
this.score = 0;
|
||||
this.currenttask = 0;
|
||||
this.name = "";
|
||||
for (var x = 0; x < this.levels.length; x++) {
|
||||
this.levels[x].completed = false;
|
||||
this.levels[x].index = x;
|
||||
for (var x = 0; x < this.games[this.currentgame].levels.length; x++) {
|
||||
this.games[this.currentgame].levels[x].completed = false;
|
||||
this.games[this.currentgame].levels[x].index = x;
|
||||
}
|
||||
},
|
||||
/*scramble: function() {
|
||||
@@ -347,7 +352,7 @@ export default {
|
||||
},*/
|
||||
|
||||
nextlevel: function () {
|
||||
if (this.currentLevel < this.levels.length) {
|
||||
if (this.currentLevel < this.games[this.currentgame].levels.length) {
|
||||
this.ready = false;
|
||||
this.currenttask = 0;
|
||||
this.currentLevel++;
|
||||
@@ -365,10 +370,10 @@ export default {
|
||||
this.currenttask++;
|
||||
},*/
|
||||
completetask: function () {
|
||||
if (!this.levels[this.currentLevel].completed) {
|
||||
this.levels[this.currentLevel].completed = true;
|
||||
this.score += this.levels[this.currentLevel].points;
|
||||
if (this.autonext && this.levels.length > this.currentLevel) {
|
||||
if (!this.games[this.currentgame].levels[this.currentLevel].completed) {
|
||||
this.games[this.currentgame].levels[this.currentLevel].completed = true;
|
||||
this.score += this.games[this.currentgame].levels[this.currentLevel].points;
|
||||
if (this.autonext && this.games[this.currentgame].levels.length > this.currentLevel) {
|
||||
setTimeout(this.nextlevel, 600);
|
||||
}
|
||||
}
|
||||
@@ -384,6 +389,7 @@ export default {
|
||||
this.ready = false;
|
||||
this.currentgame = i;
|
||||
this.ready = true;
|
||||
this.reset();
|
||||
},
|
||||
leveljump: function (i) {
|
||||
this.ready = false;
|
||||
@@ -501,7 +507,7 @@ export default {
|
||||
limit: 200,
|
||||
},
|
||||
/*hidehighscore: false,*/
|
||||
hidehightscorecover: false,
|
||||
hidehighscorecover: false,
|
||||
fontFamily: "Acme",
|
||||
games: [{
|
||||
gamename: "Game1",
|
||||
|
||||
Reference in New Issue
Block a user