From aaa9fd8ac3bc7df2c54ebfa5a0930cd4b3e47ad6 Mon Sep 17 00:00:00 2001 From: littlefean <2028140990@qq.com> Date: Tue, 19 Sep 2023 12:29:05 +0800 Subject: [PATCH] =?UTF-8?q?:sparkles:=20=E5=A2=9E=E5=8A=A0=E4=BA=86?= =?UTF-8?q?=E5=8F=96=E6=B6=88=E6=A3=8B=E5=AD=90=E8=BF=9E=E6=8E=A5=E6=95=88?= =?UTF-8?q?=E6=9E=9C=E7=9A=84=E5=BC=80=E5=85=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.html | 3 ++- js/normalGame.js | 52 ++++++++++++++++++++++++++---------------------- 2 files changed, 30 insertions(+), 25 deletions(-) diff --git a/index.html b/index.html index db0abb8..f5019be 100644 --- a/index.html +++ b/index.html @@ -17,7 +17,7 @@

围棋大变种

- +
@@ -57,6 +57,7 @@

围棋大变种

+
diff --git a/js/normalGame.js b/js/normalGame.js index 2612589..8b0e952 100644 --- a/js/normalGame.js +++ b/js/normalGame.js @@ -27,6 +27,7 @@ class NormalGame extends Game { this.animationSwitch = { "boardShake": false, // 棋盘抖动 "shockWave": true, // 触发吃子时的 落子位置 震荡波 + connect: true, // 棋子连接 } } @@ -72,12 +73,14 @@ class NormalGame extends Game { $(".animationSwitch-boardShake").onclick = function () { self.animationSwitch.boardShake = !self.animationSwitch.boardShake; this.innerText = this.innerText.split(":")[0] + ":" + self.animationSwitch.boardShake; - console.log(123) } $(".animationSwitch-shockWave").onclick = function () { self.animationSwitch.shockWave = !self.animationSwitch.shockWave; this.innerText = this.innerText.split(":")[0] + ":" + self.animationSwitch.shockWave; - console.log(456) + } + $(".animationSwitch-connect").onclick = function () { + self.animationSwitch.connect = !self.animationSwitch.connect; + this.innerText = this.innerText.split(":")[0] + ":" + self.animationSwitch.connect; } } @@ -621,28 +624,29 @@ class NormalGame extends Game { if (GameObject.isPlayer(n)) { block.classList.add("playerBlock"); block.style.backgroundColor = this.colorList[n - GameObject.BasePlayerNumber]; - // 连接生动效果 - let up = point.up(); - let down = point.down(); - let left = point.left(); - let right = point.right(); - - - if (up.outOfBoard(this.width, this.height) || this._get(up) === n) { - block.style.borderTopLeftRadius = "0"; - block.style.borderTopRightRadius = "0"; - } - if (down.outOfBoard(this.width, this.height) || this._get(down) === n) { - block.style.borderBottomLeftRadius = "0"; - block.style.borderBottomRightRadius = "0"; - } - if (left.outOfBoard(this.width, this.height) || this._get(left) === n) { - block.style.borderBottomLeftRadius = "0"; - block.style.borderTopLeftRadius = "0"; - } - if (right.outOfBoard(this.width, this.height) || this._get(right) === n) { - block.style.borderBottomRightRadius = "0"; - block.style.borderTopRightRadius = "0"; + // 是否开启棋子连接特效的开关 + if (this.animationSwitch.connect) { + // 连接生动效果 + let up = point.up(); + let down = point.down(); + let left = point.left(); + let right = point.right(); + if (up.outOfBoard(this.width, this.height) || this._get(up) === n) { + block.style.borderTopLeftRadius = "0"; + block.style.borderTopRightRadius = "0"; + } + if (down.outOfBoard(this.width, this.height) || this._get(down) === n) { + block.style.borderBottomLeftRadius = "0"; + block.style.borderBottomRightRadius = "0"; + } + if (left.outOfBoard(this.width, this.height) || this._get(left) === n) { + block.style.borderBottomLeftRadius = "0"; + block.style.borderTopLeftRadius = "0"; + } + if (right.outOfBoard(this.width, this.height) || this._get(right) === n) { + block.style.borderBottomRightRadius = "0"; + block.style.borderTopRightRadius = "0"; + } } } else { block.classList.add(GameObject.eval(n));