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
36e44d27
Commit
36e44d27
authored
Jul 08, 2019
by
18신대성
Committed by
18류지석
Jul 08, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
플레이어 Disconnect시 isAlive false로 바꾸게 구현
parent
4f461a07
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
17 deletions
+7
-17
Client.js
js/Client.js
+3
-2
server.js
server.js
+4
-15
No files found.
js/Client.js
View file @
36e44d27
...
@@ -29,7 +29,8 @@ socket.on('changePhase', function(msg) // number Phase
...
@@ -29,7 +29,8 @@ socket.on('changePhase', function(msg) // number Phase
WordSpace
.
CurrentPhase
=
msg
;
WordSpace
.
CurrentPhase
=
msg
;
});
});
socket
.
on
(
'
userDisconnect
'
,
function
(
msg
)
// {num id, str nickname}
socket
.
on
(
'
userDisconnect
'
,
function
(
msg
)
// {num i
ndex , num i
d, str nickname}
{
{
console
.
log
(
msg
.
id
+
'
/
'
+
msg
.
nickname
+
'
disconnected
'
);
console
.
log
(
msg
.
index
+
'
/
'
+
msg
.
id
+
'
/
'
+
msg
.
nickname
+
'
disconnected
'
);
RoomData
.
players
[
msg
.
index
].
isAlive
=
false
;
});
});
\ No newline at end of file
server.js
View file @
36e44d27
...
@@ -74,21 +74,10 @@ io.on('connection', function(socket)
...
@@ -74,21 +74,10 @@ io.on('connection', function(socket)
// 룸에서도 제거
// 룸에서도 제거
if
(
socket
.
playerData
.
currentRoom
!=
null
)
if
(
socket
.
playerData
.
currentRoom
!=
null
)
{
{
GameServer
.
announceToRoom
(
GameServer
.
findRoomIndex
(
socket
.
playerData
.
currentRoom
.
roomNum
),
'
userDisconnect
'
,
socket
.
playerData
.
playingData
.
isAlive
=
false
;
{
socket
.
playerData
.
playingData
.
rank
=
socket
.
playerData
.
currentRoom
.
nextRank
--
;
id
:
socket
.
playerData
.
id
,
socket
.
playerData
.
currentRoom
.
currentSocket
.
splice
(
socket
.
playerData
.
playingData
.
index
,
1
);
nickname
:
socket
.
playerData
.
nickname
GameServer
.
announceToRoom
(
GameServer
.
findRoomIndex
(
socket
.
playerData
.
currentRoom
.
roomNum
),
'
userDisconnect
'
,
socket
.
playerData
.
playingData
);
});
let
_idxToDel
=
socket
.
playerData
.
currentRoom
.
currentPlayer
.
findIndex
(
function
(
element
)
{
return
element
.
id
===
socket
.
playerData
.
id
;
});
if
(
_idxToDel
!=
-
1
)
{
socket
.
playerData
.
currentRoom
.
currentPlayer
[
_idxToDel
].
isAlive
=
false
;
socket
.
playerData
.
currentRoom
.
currentPlayer
[
_idxToDel
].
rank
=
socket
.
playerData
.
currentRoom
.
nextRank
--
;
socket
.
playerData
.
currentRoom
.
currentSocket
.
splice
(
_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