Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
sejong25
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Tear of Sejong
sejong25
Commits
dadf43ce
Commit
dadf43ce
authored
Jul 04, 2019
by
18신대성
Committed by
16이지혜
Jul 04, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
findPlayer 함수 추가
잡다한거 고침
parent
47103550
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
1 deletion
+14
-1
server.js
server.js
+14
-1
No files found.
server.js
View file @
dadf43ce
...
...
@@ -28,6 +28,19 @@ GameServer.getPlayerNumber = function()
if
(
!
this
.
waitingRoom
.
includes
(
num
))
return
num
;
}
while
(
true
)
}
GameServer
.
findPlayer
=
function
(
playerId
)
{
var
idx
=
this
.
waitingRoom
.
findIndex
(
function
(
element
)
{
return
element
.
id
===
socket
;
});
if
(
idx
!=
-
1
)
return
this
.
waitingRoom
[
idx
];
else
{
console
.
log
(
'
[ERR] wrong playerId to find
'
);
return
null
;
}
}
// 클라이언트 요청에 대한 콜백 정의
io
.
on
(
'
connection
'
,
function
(
socket
)
...
...
@@ -51,7 +64,7 @@ io.on('connection', function(socket)
{
var
idxToDel
=
GameServer
.
waitingRoom
.
findIndex
(
function
(
element
)
{
return
element
.
socketId
==
socket
;
return
element
.
socketId
==
=
socket
;
}
);
if
(
idxToDel
!=
-
1
)
...
...
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