projects
/
vchess.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Simplify game variables passed to BaseGame component
[vchess.git]
/
client
/
src
/
views
/
Rules.vue
diff --git
a/client/src/views/Rules.vue
b/client/src/views/Rules.vue
index
4edc428
..
738e25f
100644
(file)
--- a/
client/src/views/Rules.vue
+++ b/
client/src/views/Rules.vue
@@
-10,19
+10,20
@@
button(v-show="gameInProgress" @click="stopGame")
| Stop game
.section-content(v-show="display=='rules'" v-html="content")
button(v-show="gameInProgress" @click="stopGame")
| Stop game
.section-content(v-show="display=='rules'" v-html="content")
-
Game(v-show="display=='computer'" :gid-or-fen="fen
"
- :
mode="mode" :sub-mode="subMode" :variant="variant
"
+
ComputerGame(v-show="display=='computer'
"
+ :
fen="fen" :mode="mode" :vname="variant.name
"
@computer-think="gameInProgress=false" @game-over="stopGame")
</template>
<script>
@computer-think="gameInProgress=false" @game-over="stopGame")
</template>
<script>
-import
Game from "@/components/
Game.vue";
+import
ComputerGame from "@/components/Computer
Game.vue";
import { store } from "@/store";
import { getDiagram } from "@/utils/printDiagram";
import { store } from "@/store";
import { getDiagram } from "@/utils/printDiagram";
+
export default {
name: 'my-rules',
components: {
export default {
name: 'my-rules',
components: {
- Game,
+
Computer
Game,
},
data: function() {
return {
},
data: function() {
return {
@@
-30,15
+31,13
@@
export default {
variant: {id: 0, name: "_unknown"}, //...yet
content: "",
display: "rules",
variant: {id: 0, name: "_unknown"}, //...yet
content: "",
display: "rules",
- mode: "computer",
- subMode: "", //'auto' for game CPU vs CPU
+ mode: "versus",
gameInProgress: false,
gameInProgress: false,
- mycolor: "w",
fen: "",
};
},
watch: {
fen: "",
};
},
watch: {
-
$route
: function(newRoute) {
+
"$route"
: function(newRoute) {
this.tryChangeVariant(newRoute.params["vname"]);
},
},
this.tryChangeVariant(newRoute.params["vname"]);
},
},
@@
-57,7
+56,7
@@
export default {
};
},
tryChangeVariant: async function(vname) {
};
},
tryChangeVariant: async function(vname) {
- if (vname == "_unknown")
+ if (
!vname ||
vname == "_unknown")
return;
if (this.st.variants.length > 0)
{
return;
if (this.st.variants.length > 0)
{
@@
-82,7
+81,6
@@
export default {
if (this.gameInProgress)
return;
this.gameInProgress = true;
if (this.gameInProgress)
return;
this.gameInProgress = true;
- this.mode = "computer";
this.display = "computer";
this.fen = V.GenRandInitFen();
},
this.display = "computer";
this.fen = V.GenRandInitFen();
},
@@
-91,11
+89,11
@@
export default {
this.mode = "analyze";
},
playAgainstComputer: function() {
this.mode = "analyze";
},
playAgainstComputer: function() {
- this.
subMode = "
";
+ this.
mode = "versus
";
this.startGame();
},
watchComputerGame: function() {
this.startGame();
},
watchComputerGame: function() {
- this.
subM
ode = "auto";
+ this.
m
ode = "auto";
this.startGame();
},
},
this.startGame();
},
},