Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
op_16
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
op_16
Commits
3f4f7cff
Commit
3f4f7cff
authored
Feb 22, 2022
by
范雪寒
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 连点导致的报错问题
parent
176a5498
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
6 deletions
+18
-6
op_16.ts
assets/op_16/scene/op_16.ts
+16
-5
AI.ts
assets/op_16/script/AI.ts
+2
-1
No files found.
assets/op_16/scene/op_16.ts
View file @
3f4f7cff
...
...
@@ -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
();
...
...
assets/op_16/script/AI.ts
View file @
3f4f7cff
...
...
@@ -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
=
""
;
...
...
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