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
a8be6d42
Commit
a8be6d42
authored
Feb 22, 2022
by
范雪寒
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 连点问题
parent
fe3b3169
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
37 additions
and
29 deletions
+37
-29
op_16.ts
assets/op_16/scene/op_16.ts
+1
-2
NetworkHelper.ts
assets/op_16/script/NetworkHelper.ts
+1
-0
Server.ts
assets/op_16/script/Server.ts
+35
-27
No files found.
assets/op_16/scene/op_16.ts
View file @
a8be6d42
...
...
@@ -192,7 +192,6 @@ export default class SceneComponent extends MyCocosSceneComponent {
btn
.
on
(
"
click
"
,
async
()
=>
{
const
idx
=
RandomInt
(
6
);
await
this
.
rollTheDice
(
idx
);
console
.
log
(
"
汪汪汪 194
"
);
this
.
_status
.
letter
=
[
"
A
"
,
"
B
"
,
"
C
"
,
"
D
"
,
"
E
"
,
"
F
"
][
idx
];
});
...
...
@@ -318,6 +317,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
if
(
node
[
"
cantMove
"
])
{
return
;
}
node
[
"
cantMove
"
]
=
true
;
if
(
this
.
checkNodeInRightBlock
(
node
,
color
))
{
const
idx
=
this
.
getNextRightIdx
();
const
playerMe
=
this
.
allPlayerList
.
find
(
...
...
@@ -330,7 +330,6 @@ export default class SceneComponent extends MyCocosSceneComponent {
color
:
playerMe
.
color
,
});
}
else
{
node
[
"
cantMove
"
]
=
true
;
const
playerMe
=
this
.
allPlayerList
.
find
(
(
player
)
=>
player
.
uuid
==
this
.
playerId
);
...
...
assets/op_16/script/NetworkHelper.ts
View file @
a8be6d42
...
...
@@ -261,6 +261,7 @@ export class NetworkHelper {
}
sendFrame
(
data
:
any
)
{
console
.
log
(
'
sendFrame:
'
+
JSON
.
stringify
(
data
));
this
.
room
.
sendFrame
({
data
},
(
err
)
=>
{
if
(
err
.
code
!=
0
)
{
console
.
log
(
"
err
"
,
err
);
...
...
assets/op_16/script/Server.ts
View file @
a8be6d42
...
...
@@ -113,12 +113,14 @@ export class GameServer {
if
(
data
.
type
==
"
roll
"
)
{
const
letterList
=
this
.
getLetterList
();
if
(
letterList
.
length
>
0
)
{
if
(
this
.
gameStatus
.
letter
==
""
)
{
const
letter
=
letterList
[
RandomInt
(
letterList
.
length
)];
this
.
gameStatus
.
letter
=
letter
;
this
.
networkHelper
.
sendFrame
({
type
:
"
SERVER_playerRoll
"
,
letter
:
letter
,
});
}
}
else
{
this
.
networkHelper
.
sendFrame
({
type
:
"
SERVER_playerWin
"
,
...
...
@@ -127,6 +129,8 @@ export class GameServer {
this
.
gameStatus
.
gameOver
=
true
;
}
}
else
if
(
data
.
type
==
"
right
"
)
{
if
(
this
.
gameStatus
.
letter
!=
""
)
{
this
.
gameStatus
.
letter
=
""
;
this
.
gameStatus
[
data
.
color
]
=
data
.
idx
;
const
letterList
=
this
.
getLetterList
();
console
.
log
(
"
letterList =
"
+
JSON
.
stringify
(
letterList
));
...
...
@@ -145,7 +149,10 @@ export class GameServer {
});
this
.
gameStatus
.
gameOver
=
true
;
}
}
}
else
if
(
data
.
type
==
"
wrong
"
)
{
if
(
this
.
gameStatus
.
letter
!=
""
)
{
this
.
gameStatus
.
letter
=
""
;
console
.
log
(
"
data =
"
+
JSON
.
stringify
(
data
));
// this.gameStatus[data.color] = data.idx;
this
.
changeSide
();
...
...
@@ -154,6 +161,7 @@ export class GameServer {
uuid
:
data
.
uuid
,
color
:
data
.
color
,
});
}
}
else
{
this
.
_aiPlayerList
.
forEach
((
ai
:
AI
)
=>
{
ai
.
onFrameEvent
(
data
);
...
...
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