Commit 30e0d1ae authored by Tt's avatar Tt

除去点击事件

parent 6512c51f
...@@ -304,143 +304,144 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -304,143 +304,144 @@ export default class SceneComponent extends MyCocosSceneComponent {
private audioId: any; private audioId: any;
addPieceTouchEventListener(node: cc.Node, color) { addPieceTouchEventListener(node: cc.Node, color) {
node.on(cc.Node.EventType.TOUCH_START, (event: cc.Event.EventTouch) => { return;
const playerMe = this.allPlayerList.find( // node.on(cc.Node.EventType.TOUCH_START, (event: cc.Event.EventTouch) => {
(player) => player.uuid == this.playerId // const playerMe = this.allPlayerList.find(
); // (player) => player.uuid == this.playerId
if (playerMe.color != this._status.current) { // );
this.blinkPiece(node); // if (playerMe.color != this._status.current) {
return; // this.blinkPiece(node);
} // return;
if (this._status.current != color) { // }
this.blinkPiece(node); // if (this._status.current != color) {
return; // this.blinkPiece(node);
} // return;
if (this._status.letter == "") { // }
this.blinkPiece(node); // if (this._status.letter == "") {
return; // this.blinkPiece(node);
} // return;
if (node["cantMove"]) { // }
this.blinkPiece(node); // if (node["cantMove"]) {
return; // this.blinkPiece(node);
} // return;
this.stopRollPiece(node); // }
node["touchStartPos"] = { // this.stopRollPiece(node);
nodeX: node.x, // node["touchStartPos"] = {
nodeY: node.y, // nodeX: node.x,
touchX: event.getLocation().x, // nodeY: node.y,
touchY: event.getLocation().y, // touchX: event.getLocation().x,
}; // touchY: event.getLocation().y,
node.zIndex = 1; // };
this.showStars(node); // node.zIndex = 1;
}); // this.showStars(node);
node.on(cc.Node.EventType.TOUCH_MOVE, (event: cc.Event.EventTouch) => { // });
const playerMe = this.allPlayerList.find( // node.on(cc.Node.EventType.TOUCH_MOVE, (event: cc.Event.EventTouch) => {
(player) => player.uuid == this.playerId // const playerMe = this.allPlayerList.find(
); // (player) => player.uuid == this.playerId
if (playerMe.color != this._status.current) { // );
return; // if (playerMe.color != this._status.current) {
} // return;
if (this._status.current != color) { // }
return; // if (this._status.current != color) {
} // return;
if (this._status.letter == "") { // }
return; // if (this._status.letter == "") {
} // return;
if (node["cantMove"]) { // }
return; // if (node["cantMove"]) {
} // return;
const pos = event.getLocation(); // }
const touchStartPos = node["touchStartPos"]; // const pos = event.getLocation();
const worldNodePos = node.parent.convertToWorldSpaceAR( // const touchStartPos = node["touchStartPos"];
cc.v2(touchStartPos.nodeX, touchStartPos.nodeY) // const worldNodePos = node.parent.convertToWorldSpaceAR(
); // cc.v2(touchStartPos.nodeX, touchStartPos.nodeY)
const nodePos = node.parent.convertToNodeSpaceAR( // );
cc.v2( // const nodePos = node.parent.convertToNodeSpaceAR(
worldNodePos.x + pos.x - touchStartPos.touchX, // cc.v2(
worldNodePos.y + pos.y - touchStartPos.touchY // worldNodePos.x + pos.x - touchStartPos.touchX,
) // worldNodePos.y + pos.y - touchStartPos.touchY
); // )
node.setPosition(nodePos); // );
}); // node.setPosition(nodePos);
node.on(cc.Node.EventType.TOUCH_END, async (event: cc.Event.EventTouch) => { // });
const playerMe = this.allPlayerList.find( // node.on(cc.Node.EventType.TOUCH_END, async (event: cc.Event.EventTouch) => {
(player) => player.uuid == this.playerId // const playerMe = this.allPlayerList.find(
); // (player) => player.uuid == this.playerId
if (playerMe.color != this._status.current) { // );
return; // if (playerMe.color != this._status.current) {
} // return;
if (this._status.current != color) { // }
return; // if (this._status.current != color) {
} // return;
if (this._status.letter == "") { // }
return; // if (this._status.letter == "") {
} // return;
if (node["cantMove"]) { // }
return; // if (node["cantMove"]) {
} // return;
node["cantMove"] = true; // }
if (this.checkNodeInRightBlock(node, color)) { // node["cantMove"] = true;
const idx = this.getNextRightIdx(); // if (this.checkNodeInRightBlock(node, color)) {
const playerMe = this.allPlayerList.find( // const idx = this.getNextRightIdx();
(player) => player.uuid == this.playerId // const playerMe = this.allPlayerList.find(
); // (player) => player.uuid == this.playerId
this.networkHelper.sendFrame({ // );
type: "right", // this.networkHelper.sendFrame({
idx: idx, // type: "right",
uuid: playerMe.uuid, // idx: idx,
color: playerMe.color, // uuid: playerMe.uuid,
}); // color: playerMe.color,
} else { // });
const playerMe = this.allPlayerList.find( // } else {
(player) => player.uuid == this.playerId // const playerMe = this.allPlayerList.find(
); // (player) => player.uuid == this.playerId
this.networkHelper.sendFrame({ // );
type: "wrong", // this.networkHelper.sendFrame({
uuid: playerMe.uuid, // type: "wrong",
color: playerMe.color, // uuid: playerMe.uuid,
}); // color: playerMe.color,
} // });
}); // }
node.on(cc.Node.EventType.TOUCH_CANCEL, async (event: cc.Event.EventTouch) => { // });
const playerMe = this.allPlayerList.find( // node.on(cc.Node.EventType.TOUCH_CANCEL, async (event: cc.Event.EventTouch) => {
(player) => player.uuid == this.playerId // const playerMe = this.allPlayerList.find(
); // (player) => player.uuid == this.playerId
if (playerMe.color != this._status.current) { // );
return; // if (playerMe.color != this._status.current) {
} // return;
if (this._status.current != color) { // }
return; // if (this._status.current != color) {
} // return;
if (this._status.letter == "") { // }
return; // if (this._status.letter == "") {
} // return;
if (node["cantMove"]) { // }
return; // if (node["cantMove"]) {
} // return;
node["cantMove"] = true; // }
if (this.checkNodeInRightBlock(node, color)) { // node["cantMove"] = true;
const idx = this.getNextRightIdx(); // if (this.checkNodeInRightBlock(node, color)) {
const playerMe = this.allPlayerList.find( // const idx = this.getNextRightIdx();
(player) => player.uuid == this.playerId // const playerMe = this.allPlayerList.find(
); // (player) => player.uuid == this.playerId
this.networkHelper.sendFrame({ // );
type: "right", // this.networkHelper.sendFrame({
idx: idx, // type: "right",
uuid: playerMe.uuid, // idx: idx,
color: playerMe.color, // uuid: playerMe.uuid,
}); // color: playerMe.color,
} else { // });
const playerMe = this.allPlayerList.find( // } else {
(player) => player.uuid == this.playerId // const playerMe = this.allPlayerList.find(
); // (player) => player.uuid == this.playerId
this.networkHelper.sendFrame({ // );
type: "wrong", // this.networkHelper.sendFrame({
uuid: playerMe.uuid, // type: "wrong",
color: playerMe.color, // uuid: playerMe.uuid,
}); // color: playerMe.color,
} // });
}); // }
// });
} }
blinkPiece(node) { blinkPiece(node) {
......
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