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
85326296
Commit
85326296
authored
Aug 14, 2019
by
18손재민
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
패배하면 2초 후 방에서 나가지도록 함. 승리 UI 만들것
parent
edc03cf9
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
35 additions
and
29 deletions
+35
-29
GameServer.js
GameServer.js
+3
-3
Client.js
js/Client.js
+8
-2
ScenesData.js
js/ScenesData.js
+19
-24
server.js
server.js
+5
-0
No files found.
GameServer.js
View file @
85326296
...
@@ -80,7 +80,7 @@ class GameRoom
...
@@ -80,7 +80,7 @@ class GameRoom
{
{
this
.
roomId
=
GameServer
.
getRoomNumber
();
this
.
roomId
=
GameServer
.
getRoomNumber
();
this
.
roomIndex
=
-
1
;
this
.
roomIndex
=
-
1
;
this
.
startCount
=
5
;
this
.
startCount
=
2
;
this
.
maxPlayer
=
100
;
this
.
maxPlayer
=
100
;
this
.
nextRank
=
100
;
this
.
nextRank
=
100
;
...
@@ -176,7 +176,7 @@ class GameRoom
...
@@ -176,7 +176,7 @@ class GameRoom
}
}
this
.
currentPlayer
.
splice
(
i
,
1
);
this
.
currentPlayer
.
splice
(
i
,
1
);
this
.
currentSocket
.
splice
(
i
,
1
);
this
.
currentSocket
.
splice
(
i
,
1
);
this
.
aliveCount
--
;
//
this.aliveCount--;
return
;
return
;
}
}
}
}
...
...
js/Client.js
View file @
85326296
...
@@ -190,8 +190,6 @@ socket.on('defeat', function(msg) // object player
...
@@ -190,8 +190,6 @@ socket.on('defeat', function(msg) // object player
RoomData
.
players
[
msg
.
index
].
nicknameText
=
nicknameText
;
RoomData
.
players
[
msg
.
index
].
nicknameText
=
nicknameText
;
RoomData
.
aliveCount
--
;
RoomData
.
aliveCount
--
;
console
.
log
(
msg
.
id
);
console
.
log
(
RoomData
.
findPlayer
(
msg
.
id
));
RoomData
.
findPlayer
(
msg
.
id
).
playerImage
.
play
(
WordSpace
.
pyeongminAnims
[
Enums
.
characterAnim
.
gameOver
]);
RoomData
.
findPlayer
(
msg
.
id
).
playerImage
.
play
(
WordSpace
.
pyeongminAnims
[
Enums
.
characterAnim
.
gameOver
]);
if
(
msg
.
lastAttack
!=
null
)
if
(
msg
.
lastAttack
!=
null
)
{
{
...
@@ -239,11 +237,19 @@ socket.on('defeat', function(msg) // object player
...
@@ -239,11 +237,19 @@ socket.on('defeat', function(msg) // object player
console
.
log
(
RoomData
.
findPlayer
(
msg
.
id
).
nickname
+
'
defeated
'
);
console
.
log
(
RoomData
.
findPlayer
(
msg
.
id
).
nickname
+
'
defeated
'
);
WordSpace
.
killLogForTest
+=
(
'
\n
--Suicide->
'
+
RoomData
.
findPlayer
(
msg
.
id
).
nickname
);
WordSpace
.
killLogForTest
+=
(
'
\n
--Suicide->
'
+
RoomData
.
findPlayer
(
msg
.
id
).
nickname
);
}
}
if
(
msg
.
id
==
RoomData
.
myself
.
id
)
{
setTimeout
(()
=>
{
socket
.
emit
(
'
exitRoom
'
,
{
roomId
:
RoomData
.
myself
.
gameRoomId
,
playerId
:
RoomData
.
myself
.
id
});
ScenesData
.
changeScene
(
'
menuScene
'
);
},
2000
);
}
});
});
socket
.
on
(
'
gameEnd
'
,
function
(
msg
)
// object player
socket
.
on
(
'
gameEnd
'
,
function
(
msg
)
// object player
{
{
console
.
log
(
msg
.
nickname
+
'
Win!!!!!!
'
);
console
.
log
(
msg
.
nickname
+
'
Win!!!!!!
'
);
});
});
socket
.
on
(
'
attackSucceed
'
,
function
(
msg
)
socket
.
on
(
'
attackSucceed
'
,
function
(
msg
)
{
{
//console.log('client');
//console.log('client');
...
...
js/ScenesData.js
View file @
85326296
...
@@ -438,13 +438,14 @@ var gameScene = new Phaser.Class(
...
@@ -438,13 +438,14 @@ var gameScene = new Phaser.Class(
WordSpace
.
setPlayerTyping
.
initiate
(
this
);
WordSpace
.
setPlayerTyping
.
initiate
(
this
);
WordSpace
.
nameWordTextForTest
=
this
.
add
.
text
(
50
,
400
,
'
현재 가진 호패들 : 없음
'
).
setDepth
(
10
).
setColor
(
'
#000000
'
);
WordSpace
.
nameQueue
.
initiate
();
WordSpace
.
nameQueue
.
initiate
();
//WordSpace.attackGauge.add(11);
//WordSpace.attackGauge.add(11);
},
},
update
:
function
()
update
:
function
()
{
if
(
ScenesData
.
currentScene
==
ScenesData
.
gameScene
)
{
{
WordSpace
.
deltaTime
=
this
.
sys
.
game
.
loop
.
delta
;
WordSpace
.
deltaTime
=
this
.
sys
.
game
.
loop
.
delta
;
WordSpace
.
wordForcedGroup
.
forEach
(
function
(
element
)
WordSpace
.
wordForcedGroup
.
forEach
(
function
(
element
)
...
@@ -458,18 +459,12 @@ var gameScene = new Phaser.Class(
...
@@ -458,18 +459,12 @@ var gameScene = new Phaser.Class(
WordSpace
.
attackPaperGroup
.
forEach
(
function
(
element
){
WordSpace
.
attackPaperGroup
.
forEach
(
function
(
element
){
element
.
moveObject
(
element
);
element
.
moveObject
(
element
);
});
});
let
tempNames
=
''
;
WordSpace
.
nameGroup
.
forEach
(
function
(
element
)
{
//테스트용
tempNames
+=
element
.
wordText
+
(
element
.
isStrong
?
'
[강]
'
:
''
)
+
'
\n
'
;
});
WordSpace
.
nameWordTextForTest
.
setText
(
'
현재 가진 호패들 :
\n
'
+
tempNames
);
WordSpace
.
weightTextObjForTest
.
setText
(
'
뇌의 무게: (현재)
'
+
WordSpace
.
totalWeight
+
'
/
'
+
WordSpace
.
brainCapacity
+
'
(전체)
'
);
WordSpace
.
weightTextObjForTest
.
setText
(
'
뇌의 무게: (현재)
'
+
WordSpace
.
totalWeight
+
'
/
'
+
WordSpace
.
brainCapacity
+
'
(전체)
'
);
WordSpace
.
killLogTextForTest
.
setText
(
WordSpace
.
killLogForTest
);
WordSpace
.
killLogTextForTest
.
setText
(
WordSpace
.
killLogForTest
);
WordSpace
.
setPlayerTyping
.
add
(
''
);
WordSpace
.
setPlayerTyping
.
add
(
''
);
}
}
}
});
});
ScenesData
.
changeScene
=
function
(
sceneKey
)
ScenesData
.
changeScene
=
function
(
sceneKey
)
...
...
server.js
View file @
85326296
...
@@ -63,6 +63,11 @@ io.on('connection', function(socket)
...
@@ -63,6 +63,11 @@ io.on('connection', function(socket)
}
}
});
});
socket
.
on
(
'
exitRoom
'
,
function
(
msg
)
// string new_nickname
{
GameServer
.
findRoom
(
msg
.
roomId
).
exitRoom
(
msg
.
playerId
);
});
socket
.
on
(
'
setPlayerTyping
'
,
function
(
msg
)
// number playerTyping
socket
.
on
(
'
setPlayerTyping
'
,
function
(
msg
)
// number playerTyping
{
{
try
try
...
...
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