Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OP32_PLUS
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
OP32_PLUS
Commits
b4a01ee5
Commit
b4a01ee5
authored
Jul 13, 2022
by
范雪寒
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: addPlayer null
parent
8f6f4d2a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
0 deletions
+5
-0
NetworkHelper.ts
assets/OP32_PLUS/scene/NetworkHelper.ts
+5
-0
No files found.
assets/OP32_PLUS/scene/NetworkHelper.ts
View file @
b4a01ee5
import
{
Client
}
from
"
../leanCloud/play
"
;
import
{
RandomInt
}
from
"
../script/util
"
;
export
class
NetworkHelper
{
...
...
@@ -83,12 +84,15 @@ export class NetworkHelper {
this
.
room
.
players
.
push
(
this
.
room
.
player
);
this
.
player
=
this
.
room
.
player
;
this
.
client
.
off
(
globalThis
.
Play
.
Event
.
PLAYER_ROOM_LEFT
);
this
.
client
.
on
(
globalThis
.
Play
.
Event
.
PLAYER_ROOM_LEFT
,
(
event
)
=>
{
this
.
onLeaveRoom
({
data
:
{
leavePlayerId
:
event
.
leftPlayer
.
userId
}
});
});
this
.
client
.
off
(
globalThis
.
Play
.
Event
.
PLAYER_ROOM_JOINED
);
this
.
client
.
on
(
globalThis
.
Play
.
Event
.
PLAYER_ROOM_JOINED
,
(
event
)
=>
{
this
.
onJoinRoom
({
playerId
:
event
.
newPlayer
.
userId
});
});
this
.
client
.
off
(
globalThis
.
Play
.
Event
.
CUSTOM_EVENT
);
this
.
client
.
on
(
globalThis
.
Play
.
Event
.
CUSTOM_EVENT
,
(
event
)
=>
{
this
.
onRecvFrame
({
data
:
event
.
eventData
});
});
...
...
@@ -175,6 +179,7 @@ export class NetworkHelper {
this
.
closeRoom
();
this
.
dismissRoom
();
this
.
leaveRoom
();
await
this
.
client
.
close
();
console
.
log
(
"
onDestroy2
"
);
}
catch
(
e
)
{
console
.
log
(
JSON
.
stringify
(
e
));
...
...
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