Commit 3f4f7cff authored by 范雪寒's avatar 范雪寒

fix: 连点导致的报错问题

parent 176a5498
......@@ -35,7 +35,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
onLoadEnd() {
// TODO 加载完成后的逻辑写在这里, 下面的代码仅供参考
this.log('onLoadEnd');
this.log("onLoadEnd");
this.initData();
this.initView();
this.initListener();
......@@ -343,6 +343,9 @@ export default class SceneComponent extends MyCocosSceneComponent {
}
blinkPiece(node) {
if (node['rightTween']) {
return;
}
node.stopAllActions();
cc.tween(node)
.set({ scale: 1 })
......@@ -483,10 +486,12 @@ export default class SceneComponent extends MyCocosSceneComponent {
piece.zIndex = 1;
this.showStars(piece);
piece['rightTween'] = true;
await asyncTweenTo(piece, 1, {
x: rightBlock.x + offsetX[color],
y: rightBlock.y + offsetY[color],
});
piece['rightTween'] = false;
for (let i = 0; i < 20; i++) {
const star = cc.instantiate(cc.find("nodes/star"));
......@@ -528,7 +533,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
console.log(status);
this._status = JSON.parse(JSON.stringify(status));
} else {
console.log('喵喵喵');
console.log("喵喵喵");
}
const playerMe = this.allPlayerList.find(
(player) => player.uuid == this.playerId
......@@ -580,10 +585,10 @@ export default class SceneComponent extends MyCocosSceneComponent {
changeSide() {
if (this._status.current == "Red") {
this._status.current = "Blue";
console.log('changeSide Blue');
console.log("changeSide Blue");
} else {
this._status.current = "Red";
console.log('changeSide Red');
console.log("changeSide Red");
}
}
......@@ -631,7 +636,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
cc.log("playerLeave" + JSON.stringify(event));
});
this.networkHelper.on("playerOffLine", (event) => {
cc.find('Canvas/bg/PlayerOffLineLayer').active = true;
cc.find("Canvas/bg/PlayerOffLineLayer").active = true;
this.networkHelper.leaveRoom();
this.log("playerOffLine" + JSON.stringify(event));
});
......@@ -709,7 +714,13 @@ export default class SceneComponent extends MyCocosSceneComponent {
console.log(rightBlock);
const idx = this.getNextRightIdx();
console.log(idx);
const pieceRed = cc.find("Canvas/bg/chessBoard/pieceRed");
const pieceBlue = cc.find("Canvas/bg/chessBoard/pieceBlue");
pieceRed["cantMove"] = false;
pieceBlue["cantMove"] = false;
await this.pieceFindRightBlock(rightBlock, idx);
pieceRed["cantMove"] = true;
pieceBlue["cantMove"] = true;
this._status.letter = "";
this.changeSide();
this.updateStatus();
......
......@@ -23,7 +23,8 @@ export class AI {
} else if (event.type == "SERVER_playerRoll") {
this._status.letter = event.letter;
if (this.playerData.color == this._status.current) {
await asyncDelay(Math.random() * 3 + 12);
// await asyncDelay(Math.random() * 3 + 12);
await asyncDelay(15);
}
} else if (event.type == "SERVER_playerRight") {
this._status.letter = "";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment