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
3fe7e321
Commit
3fe7e321
authored
Jul 14, 2019
by
18신대성
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
대기실 카운터 구현완료
parent
d7bf6857
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
11 deletions
+12
-11
GameServer.js
GameServer.js
+6
-5
server.js
server.js
+6
-6
No files found.
GameServer.js
View file @
3fe7e321
...
...
@@ -34,12 +34,13 @@ GameServer.makeRoom = function()
var
roomOption
=
{
roomNum
:
GameServer
.
nextRoomNumber
++
,
maxPlayer
:
5
,
nextRank
:
0
,
maxPlayer
:
100
,
nextRank
:
10
0
,
currentPlayer
:
[],
aliveCount
:
0
,
currentSocket
:
[],
currentPhase
:
GameServer
.
Phase
.
READY
,
endTime
:
0
,
rateArrangePoint
:
300
,
maxTypingPlayer
:
null
,
...
...
@@ -86,16 +87,16 @@ GameServer.enterRoom = function(roomIdx, playerData)
console
.
log
(
'
[
'
+
playerData
.
id
+
'
] entered to room #
'
+
room
.
roomNum
);
playerData
.
socketId
.
emit
(
'
enterRoom
'
);
let
endTimeToAnnounce
=
Date
.
now
()
+
6000
;
room
.
endTime
=
Date
.
now
()
+
6000
;
// 테스트로 6초로 남겨둠
if
(
room
.
currentPlayer
.
length
>=
this
.
startCount
)
{
if
(
room
.
currentPhase
===
this
.
Phase
.
READY
)
// start count
{
this
.
announceToRoom
(
room
.
roomNum
,
'
setCount
'
,
{
isEnable
:
true
,
endTime
:
endTimeToAnnounc
e
});
this
.
announceToRoom
(
room
.
roomNum
,
'
setCount
'
,
{
isEnable
:
true
,
endTime
:
room
.
endTim
e
});
}
else
if
(
room
.
currentPhase
===
this
.
Phase
.
COUNT
)
// countinue count
{
playerData
.
socketId
.
emit
(
'
setCount
'
,
{
isEnable
:
true
,
endTime
:
endTimeToAnnounc
e
});
playerData
.
socketId
.
emit
(
'
setCount
'
,
{
isEnable
:
true
,
endTime
:
room
.
endTim
e
});
}
}
else
// stop count
...
...
server.js
View file @
3fe7e321
...
...
@@ -72,14 +72,14 @@ io.on('connection', function(socket)
socket
.
emit
(
'
setPlayerTypingRate
'
,
playerTypingRate
);
});
socket
.
on
(
'
endCount
'
)
socket
.
on
(
'
endCount
'
,
function
(
)
{
socket
.
currentRoom
.
aliveCount
--
;
if
(
socket
.
currentRoom
.
aliveCount
===
0
)
socket
.
playerData
.
currentRoom
.
aliveCount
--
;
if
(
socket
.
playerData
.
currentRoom
.
aliveCount
===
0
)
{
GameServer
.
startRoom
(
GameServer
.
findRoomIndex
(
socket
.
currentRoom
.
roomNum
));
GameServer
.
startRoom
(
GameServer
.
findRoomIndex
(
socket
.
playerData
.
currentRoom
.
roomNum
));
}
}
}
);
socket
.
on
(
'
attack
'
,
function
(
msg
)
{
...
...
@@ -118,7 +118,6 @@ io.on('connection', function(socket)
socket
.
on
(
'
disconnect
'
,
function
(
reason
)
{
let
data
=
socket
.
playerData
;
console
.
log
(
'
[
'
+
data
.
id
+
'
] client disconnected, reason:
'
+
reason
);
if
(
typeof
data
.
id
===
undefined
)
{
console
.
log
(
'
[ERROR] data.id is undefined
'
);
...
...
@@ -126,6 +125,7 @@ io.on('connection', function(socket)
}
else
// data.id is not undefined
{
console
.
log
(
'
[
'
+
data
.
id
+
'
] client disconnected, reason:
'
+
reason
);
let
idxToDel
=
GameServer
.
currentPlayer
.
findIndex
(
function
(
element
)
{
return
element
.
id
===
data
.
id
;
...
...
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