Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
l2_boardgame2_tree
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
template admin
l2_boardgame2_tree
Commits
30e0d1ae
Commit
30e0d1ae
authored
Jul 22, 2022
by
Tt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
除去点击事件
parent
6512c51f
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
138 additions
and
137 deletions
+138
-137
l2_boardgame2_tree.ts
assets/l2_boardgame2_tree/scene/l2_boardgame2_tree.ts
+138
-137
No files found.
assets/l2_boardgame2_tree/scene/l2_boardgame2_tree.ts
View file @
30e0d1ae
...
@@ -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
)
=>
{
const
playerMe
=
this
.
allPlayerList
.
find
(
(
player
)
=>
player
.
uuid
==
this
.
playerId
);
if
(
playerMe
.
color
!=
this
.
_status
.
current
)
{
this
.
blinkPiece
(
node
);
return
;
}
if
(
this
.
_status
.
current
!=
color
)
{
this
.
blinkPiece
(
node
);
return
;
}
if
(
this
.
_status
.
letter
==
""
)
{
this
.
blinkPiece
(
node
);
return
;
}
if
(
node
[
"
cantMove
"
])
{
this
.
blinkPiece
(
node
);
return
;
}
this
.
stopRollPiece
(
node
);
node
[
"
touchStartPos
"
]
=
{
nodeX
:
node
.
x
,
nodeY
:
node
.
y
,
touchX
:
event
.
getLocation
().
x
,
touchY
:
event
.
getLocation
().
y
,
};
node
.
zIndex
=
1
;
this
.
showStars
(
node
);
});
node
.
on
(
cc
.
Node
.
EventType
.
TOUCH_MOVE
,
(
event
:
cc
.
Event
.
EventTouch
)
=>
{
const
playerMe
=
this
.
allPlayerList
.
find
(
(
player
)
=>
player
.
uuid
==
this
.
playerId
);
if
(
playerMe
.
color
!=
this
.
_status
.
current
)
{
return
;
}
if
(
this
.
_status
.
current
!=
color
)
{
return
;
}
if
(
this
.
_status
.
letter
==
""
)
{
return
;
}
if
(
node
[
"
cantMove
"
])
{
return
;
}
const
pos
=
event
.
getLocation
();
const
touchStartPos
=
node
[
"
touchStartPos
"
];
const
worldNodePos
=
node
.
parent
.
convertToWorldSpaceAR
(
cc
.
v2
(
touchStartPos
.
nodeX
,
touchStartPos
.
nodeY
)
);
const
nodePos
=
node
.
parent
.
convertToNodeSpaceAR
(
cc
.
v2
(
worldNodePos
.
x
+
pos
.
x
-
touchStartPos
.
touchX
,
worldNodePos
.
y
+
pos
.
y
-
touchStartPos
.
touchY
)
);
node
.
setPosition
(
nodePos
);
});
node
.
on
(
cc
.
Node
.
EventType
.
TOUCH_END
,
async
(
event
:
cc
.
Event
.
EventTouch
)
=>
{
const
playerMe
=
this
.
allPlayerList
.
find
(
(
player
)
=>
player
.
uuid
==
this
.
playerId
);
if
(
playerMe
.
color
!=
this
.
_status
.
current
)
{
return
;
}
if
(
this
.
_status
.
current
!=
color
)
{
return
;
}
if
(
this
.
_status
.
letter
==
""
)
{
return
;
}
if
(
node
[
"
cantMove
"
])
{
return
;
}
node
[
"
cantMove
"
]
=
true
;
if
(
this
.
checkNodeInRightBlock
(
node
,
color
))
{
const
idx
=
this
.
getNextRightIdx
();
const
playerMe
=
this
.
allPlayerList
.
find
(
(
player
)
=>
player
.
uuid
==
this
.
playerId
);
this
.
networkHelper
.
sendFrame
({
type
:
"
right
"
,
idx
:
idx
,
uuid
:
playerMe
.
uuid
,
color
:
playerMe
.
color
,
});
}
else
{
const
playerMe
=
this
.
allPlayerList
.
find
(
(
player
)
=>
player
.
uuid
==
this
.
playerId
);
this
.
networkHelper
.
sendFrame
({
type
:
"
wrong
"
,
uuid
:
playerMe
.
uuid
,
color
:
playerMe
.
color
,
});
}
});
node
.
on
(
cc
.
Node
.
EventType
.
TOUCH_CANCEL
,
async
(
event
:
cc
.
Event
.
EventTouch
)
=>
{
const
playerMe
=
this
.
allPlayerList
.
find
(
(
player
)
=>
player
.
uuid
==
this
.
playerId
);
if
(
playerMe
.
color
!=
this
.
_status
.
current
)
{
return
;
return
;
}
// node.on(cc.Node.EventType.TOUCH_START, (event: cc.Event.EventTouch) => {
if
(
this
.
_status
.
current
!=
color
)
{
// const playerMe = this.allPlayerList.find(
return
;
// (player) => player.uuid == this.playerId
}
// );
if
(
this
.
_status
.
letter
==
""
)
{
// if (playerMe.color != this._status.current) {
return
;
// this.blinkPiece(node);
}
// return;
if
(
node
[
"
cantMove
"
])
{
// }
return
;
// if (this._status.current != color) {
}
// this.blinkPiece(node);
node
[
"
cantMove
"
]
=
true
;
// return;
if
(
this
.
checkNodeInRightBlock
(
node
,
color
))
{
// }
const
idx
=
this
.
getNextRightIdx
();
// if (this._status.letter == "") {
const
playerMe
=
this
.
allPlayerList
.
find
(
// this.blinkPiece(node);
(
player
)
=>
player
.
uuid
==
this
.
playerId
// return;
);
// }
this
.
networkHelper
.
sendFrame
({
// if (node["cantMove"]) {
type
:
"
right
"
,
// this.blinkPiece(node);
idx
:
idx
,
// return;
uuid
:
playerMe
.
uuid
,
// }
color
:
playerMe
.
color
,
// this.stopRollPiece(node);
});
// node["touchStartPos"] = {
}
else
{
// nodeX: node.x,
const
playerMe
=
this
.
allPlayerList
.
find
(
// nodeY: node.y,
(
player
)
=>
player
.
uuid
==
this
.
playerId
// touchX: event.getLocation().x,
);
// touchY: event.getLocation().y,
this
.
networkHelper
.
sendFrame
({
// };
type
:
"
wrong
"
,
// node.zIndex = 1;
uuid
:
playerMe
.
uuid
,
// this.showStars(node);
color
:
playerMe
.
color
,
// });
});
// node.on(cc.Node.EventType.TOUCH_MOVE, (event: cc.Event.EventTouch) => {
}
// const playerMe = this.allPlayerList.find(
});
// (player) => player.uuid == this.playerId
// );
// if (playerMe.color != this._status.current) {
// return;
// }
// if (this._status.current != color) {
// return;
// }
// if (this._status.letter == "") {
// return;
// }
// if (node["cantMove"]) {
// return;
// }
// const pos = event.getLocation();
// const touchStartPos = node["touchStartPos"];
// const worldNodePos = node.parent.convertToWorldSpaceAR(
// cc.v2(touchStartPos.nodeX, touchStartPos.nodeY)
// );
// const nodePos = node.parent.convertToNodeSpaceAR(
// cc.v2(
// worldNodePos.x + pos.x - touchStartPos.touchX,
// worldNodePos.y + pos.y - touchStartPos.touchY
// )
// );
// node.setPosition(nodePos);
// });
// node.on(cc.Node.EventType.TOUCH_END, async (event: cc.Event.EventTouch) => {
// const playerMe = this.allPlayerList.find(
// (player) => player.uuid == this.playerId
// );
// if (playerMe.color != this._status.current) {
// return;
// }
// if (this._status.current != color) {
// return;
// }
// if (this._status.letter == "") {
// return;
// }
// if (node["cantMove"]) {
// return;
// }
// node["cantMove"] = true;
// if (this.checkNodeInRightBlock(node, color)) {
// const idx = this.getNextRightIdx();
// const playerMe = this.allPlayerList.find(
// (player) => player.uuid == this.playerId
// );
// this.networkHelper.sendFrame({
// type: "right",
// idx: idx,
// uuid: playerMe.uuid,
// color: playerMe.color,
// });
// } else {
// const playerMe = this.allPlayerList.find(
// (player) => player.uuid == this.playerId
// );
// this.networkHelper.sendFrame({
// type: "wrong",
// uuid: playerMe.uuid,
// color: playerMe.color,
// });
// }
// });
// node.on(cc.Node.EventType.TOUCH_CANCEL, async (event: cc.Event.EventTouch) => {
// const playerMe = this.allPlayerList.find(
// (player) => player.uuid == this.playerId
// );
// if (playerMe.color != this._status.current) {
// return;
// }
// if (this._status.current != color) {
// return;
// }
// if (this._status.letter == "") {
// return;
// }
// if (node["cantMove"]) {
// return;
// }
// node["cantMove"] = true;
// if (this.checkNodeInRightBlock(node, color)) {
// const idx = this.getNextRightIdx();
// const playerMe = this.allPlayerList.find(
// (player) => player.uuid == this.playerId
// );
// this.networkHelper.sendFrame({
// type: "right",
// idx: idx,
// uuid: playerMe.uuid,
// color: playerMe.color,
// });
// } else {
// const playerMe = this.allPlayerList.find(
// (player) => player.uuid == this.playerId
// );
// this.networkHelper.sendFrame({
// type: "wrong",
// uuid: playerMe.uuid,
// color: playerMe.color,
// });
// }
// });
}
}
blinkPiece
(
node
)
{
blinkPiece
(
node
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment