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
ecdfb99d
Commit
ecdfb99d
authored
Jul 18, 2019
by
18신대성
Committed by
Chae Ho Shin
Jul 18, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
페이즈 바뀌게 구현
parent
3050301f
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
1 deletion
+36
-1
GameServer.js
GameServer.js
+36
-1
No files found.
GameServer.js
View file @
ecdfb99d
...
...
@@ -81,11 +81,13 @@ class GameRoom
this
.
maxPlayer
=
100
;
this
.
nextRank
=
100
;
this
.
startTime
=
0
;
this
.
currentPlayer
=
[];
this
.
aliveCount
=
0
;
this
.
currentSocket
=
[];
this
.
currentPhase
=
GameServer
.
Phase
.
READY
;
this
.
phaseChanger
=
-
1
;
this
.
countEndTime
=
0
;
this
.
rateArrangePoint
=
300
;
this
.
maxTypingPlayer
=
null
;
...
...
@@ -201,6 +203,37 @@ class GameRoom
console
.
log
(
'
[ROOM#
'
+
this
.
roomId
+
'
] Game Start with
'
+
this
.
currentPlayer
.
length
+
'
players
'
);
this
.
announceToRoom
(
'
changePhase
'
,
GameServer
.
Phase
.
START
);
this
.
announceToRoom
(
'
startGame
'
);
this
.
startTime
=
Date
.
now
();
}
checkPhase
(
checkTime
)
{
if
(
this
.
currentPhase
===
GameServer
.
Phase
.
START
)
{
if
(
this
.
phaseChanger
<
0
&&
checkTime
-
this
.
startTime
>
60000
)
{
this
.
currentPhase
=
GameServer
.
Phase
.
MAIN
;
this
.
announceToRoom
(
'
changePhase
'
,
GameServer
.
Phase
.
MAIN
);
}
else
if
(
this
.
phaseChanger
<
0
)
{
this
.
phaseChanger
=
setTimeout
(
function
(
room
)
{
room
.
currentPhase
=
GameServer
.
Phase
.
MAIN
;
room
.
announceToRoom
(
'
changePhase
'
,
GameServer
.
Phase
.
MAIN
);
room
.
phaseChanger
=
-
1
;
},
60000
-
(
checkTime
-
this
.
startTime
),
this
);
}
}
else
if
(
this
.
currentPhase
===
GameServer
.
Phase
.
MAIN
)
{
let
playerLimit
=
Math
.
max
(
this
.
currentPlayer
.
length
/
10
,
3
);
if
(
this
.
aliveCount
<=
playerLimit
)
{
this
.
currentPhase
=
GameServer
.
Phase
.
MUSIC
;
this
.
announceToRoom
(
'
changePhase
'
,
GameServer
.
Phase
.
MUSIC
);
}
}
}
endRoom
()
...
...
@@ -274,6 +307,8 @@ class Player
socket
.
playerData
.
isReceivable
=
false
;
room
.
aliveCount
--
;
room
.
checkPhase
(
Date
.
now
());
if
(
this
.
lastAttacks
.
length
>
0
)
{
this
.
lastAttack
=
this
.
lastAttacks
[
this
.
lastAttacks
.
length
-
1
];
...
...
@@ -288,7 +323,7 @@ class Player
}
room
.
announceToRoom
(
'
defeat
'
,
this
);
console
.
log
(
'
[
'
+
this
.
id
+
'
] defeated, rank:
'
+
this
.
rank
);
console
.
log
(
'
[
'
+
this
.
id
+
'
] defeated, rank:
'
+
this
.
rank
+
'
,
'
+
room
.
currentPlayer
.
length
+
'
player left
'
);
if
(
socket
.
playerData
.
currentRoom
.
aliveCount
===
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