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
c4009ceb
Commit
c4009ceb
authored
Feb 21, 2022
by
范雪寒
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test:
parent
e9b3f3af
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
2 deletions
+4
-2
NetworkHelper.ts
assets/op_16/script/NetworkHelper.ts
+4
-2
No files found.
assets/op_16/script/NetworkHelper.ts
View file @
c4009ceb
...
...
@@ -123,6 +123,7 @@ export class NetworkHelper {
console
.
log
(
"
this.room =
"
+
JSON
.
stringify
(
this
.
room
.
roomInfo
));
}
player
:
MGOBE
.
Player
;
joinRoom
(
roomType
:
string
,
maxPlayers
:
number
,
customData
:
string
=
""
)
{
return
new
Promise
((
resolve
,
reject
)
=>
{
const
playerName
=
"
Tom
"
+
Math
.
random
();
...
...
@@ -149,6 +150,7 @@ export class NetworkHelper {
const
player
=
event
.
data
.
roomInfo
.
playerList
.
find
(
(
player
)
=>
player
.
name
==
playerName
);
this
.
player
=
player
;
if
(
this
.
checkRoomOwnerOffLine
())
{
if
(
this
.
_eventListeners
[
"
playerOffLine
"
])
{
this
.
_eventListeners
[
"
playerOffLine
"
](
event
);
...
...
@@ -180,7 +182,7 @@ export class NetworkHelper {
dismissRoom
()
{
const
roomInfo
=
this
.
room
.
roomInfo
;
const
player
=
roomInfo
.
playerList
.
find
(
(
player
)
=>
player
.
name
==
playerN
ame
(
player
)
=>
player
.
name
==
this
.
player
.
n
ame
);
if
(
roomInfo
.
owner
==
player
.
id
)
{
return
new
Promise
((
resolve
,
reject
)
=>
{
...
...
@@ -312,10 +314,10 @@ export class NetworkHelper {
async
onDestroy
()
{
try
{
console
.
log
(
"
onDestroy1
"
);
this
.
dismissRoom
();
MGOBE
.
Listener
.
clear
();
this
.
stopFrameSync
();
this
.
closeRoom
();
this
.
dismissRoom
();
this
.
leaveRoom
();
console
.
log
(
"
onDestroy2
"
);
}
catch
(
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