X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=public%2Fjavascripts%2Fcomponents%2Frules.js;h=0f27d5327177c9f18d664869a6b024ea09dc6c37;hb=b955c65b942d09d24b5c3bed0d755d4f2f8f71f1;hp=02d3a0ca40ad7123db0e715f344c88a10db7b104;hpb=8d7e2786f5a67a1b9a77c742d7951e0efbe8747d;p=vchess.git diff --git a/public/javascripts/components/rules.js b/public/javascripts/components/rules.js index 02d3a0ca..0f27d532 100644 --- a/public/javascripts/components/rules.js +++ b/public/javascripts/components/rules.js @@ -1,11 +1,39 @@ // Load rules on variant page Vue.component('my-rules', { + props: ["settings"], data: function() { - return { content: "" }; + return { + content: "", + display: "rules", + mode: "computer", + subMode: "", //'auto' for game CPU vs CPU + gameInProgress: false, + mycolor: "w", + allowMovelist: true, + fen: "", + }; }, template: `
-
+
+ + + + +
+
+ +
`, mounted: function() { @@ -28,5 +56,25 @@ Vue.component('my-rules', { shadow: fenParts[3], }; }, + startGame: function() { + if (this.gameInProgress) + return; + this.gameInProgress = true; + this.mode = "computer"; + this.display = "computer"; + this.fen = V.GenRandInitFen(); + }, + stopGame: function() { + this.gameInProgress = false; + this.mode = "analyze"; + }, + playAgainstComputer: function() { + this.subMode = ""; + this.startGame(); + }, + watchComputerGame: function() { + this.subMode = "auto"; + this.startGame(); + }, }, })