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
Hide 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
)
=>
{
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
)
{
...
...
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