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
332c0b9c
Commit
332c0b9c
authored
Aug 15, 2019
by
18손재민
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
게임 종료 시 관전하거나 나갈 수 있는 UI 제작함
parent
dfc5b272
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
40 additions
and
27 deletions
+40
-27
GameServer.js
GameServer.js
+0
-1
Client.js
js/Client.js
+34
-24
ScenesData.js
js/ScenesData.js
+1
-1
server.js
server.js
+5
-1
No files found.
GameServer.js
View file @
332c0b9c
...
@@ -386,7 +386,6 @@ class Player
...
@@ -386,7 +386,6 @@ class Player
console
.
log
(
'
[
'
+
winner
.
id
+
'
]
'
+
'
winner!
'
+
winner
.
nickname
);
console
.
log
(
'
[
'
+
winner
.
id
+
'
]
'
+
'
winner!
'
+
winner
.
nickname
);
}
}
}
}
this
.
isInThisRoom
=
false
;
}
}
}
}
...
...
js/Client.js
View file @
332c0b9c
...
@@ -241,6 +241,7 @@ socket.on('defeat', function(msg) // object player
...
@@ -241,6 +241,7 @@ socket.on('defeat', function(msg) // object player
}
}
if
(
msg
.
id
==
RoomData
.
myself
.
id
)
if
(
msg
.
id
==
RoomData
.
myself
.
id
)
{
{
RoomData
.
myself
=
RoomData
.
players
[
msg
.
index
];
backToMenu
();
backToMenu
();
}
}
});
});
...
@@ -273,37 +274,38 @@ socket.on('userDisconnect', function(msg) // {num index , num id, str nickname}
...
@@ -273,37 +274,38 @@ socket.on('userDisconnect', function(msg) // {num index , num id, str nickname}
var
backToMenu
=
function
()
var
backToMenu
=
function
()
{
{
ScenesData
.
gameScene
.
roomEnter
Dialog
=
ScenesData
.
gameScene
.
rexUI
.
add
.
dialog
({
ScenesData
.
gameScene
.
backToMenu
Dialog
=
ScenesData
.
gameScene
.
rexUI
.
add
.
dialog
({
x
:
game
.
config
.
width
/
2
,
x
:
game
.
config
.
width
/
2
,
y
:
game
.
config
.
height
/
2
,
y
:
game
.
config
.
height
/
2
,
background
:
ScenesData
.
gameScene
.
add
.
sprite
(
game
.
config
.
width
/
2
,
game
.
config
.
height
/
2
,
'
panel
'
).
setOrigin
(
0.5
,
0.5
),
background
:
ScenesData
.
gameScene
.
add
.
sprite
(
game
.
config
.
width
/
2
,
game
.
config
.
height
/
2
,
'
panel
'
).
setOrigin
(
0.5
,
0.5
),
content
:
ScenesData
.
gameScene
.
r
oomEnterDialog
=
ScenesData
.
gameScene
.
r
exUI
.
add
.
dialog
({
content
:
ScenesData
.
gameScene
.
rexUI
.
add
.
dialog
({
x
:
game
.
config
.
width
/
2
,
x
:
game
.
config
.
width
/
2
,
y
:
game
.
config
.
height
/
2
,
y
:
game
.
config
.
height
/
2
,
choices
:
[
choices
:
[
UIObject
.
createLabel
(
ScenesData
.
gameScene
,
game
.
config
.
width
/
2
-
100
,
game
.
config
.
height
/
2
-
100
,
0
,
'
playerStand
'
,
1
,
'
center
'
),
UIObject
.
createLabel
(
ScenesData
.
gameScene
,
game
.
config
.
width
/
2
-
100
,
game
.
config
.
height
/
2
-
100
,
0
,
'
playerStand
'
,
0.7
,
'
center
'
),
UIObject
.
createLabel
(
ScenesData
.
gameScene
,
game
.
config
.
width
/
2
+
100
,
game
.
config
.
height
/
2
-
150
,
0
,
'
button
'
,
1
,
'
center
'
,
'
등수 :
'
+
RoomData
.
myself
.
rank
+
'
등
'
,
30
),
UIObject
.
createLabel
(
ScenesData
.
gameScene
,
game
.
config
.
width
/
2
+
120
,
game
.
config
.
height
/
2
-
150
,
0
,
UIObject
.
createLabel
(
ScenesData
.
gameScene
,
game
.
config
.
width
/
2
+
100
,
game
.
config
.
height
/
2
-
50
,
0
,
'
button
'
,
1
,
'
center
'
,
'
킬 수 :
'
+
RoomData
.
myself
.
killCount
+
'
킬
'
,
30
),
'
button
'
,
1
,
'
center
'
,
'
등수 :
'
+
RoomData
.
myself
.
rank
+
'
등
'
,
30
).
layout
(),
UIObject
.
createLabel
(
ScenesData
.
gameScene
,
game
.
config
.
width
/
2
+
100
,
game
.
config
.
height
/
2
+
50
,
0
,
'
button
'
,
1
,
'
center
'
,
'
획득 강호패 :
'
+
RoomData
.
myself
.
earnedStrongHopae
+
'
개
'
,
30
),
UIObject
.
createLabel
(
ScenesData
.
gameScene
,
game
.
config
.
width
/
2
+
120
,
game
.
config
.
height
/
2
-
50
,
0
,
UIObject
.
createLabel
(
ScenesData
.
gameScene
,
game
.
config
.
width
/
2
+
100
,
game
.
config
.
height
/
2
+
150
,
0
,
'
button
'
,
1
,
'
center
'
,
'
획득 골드 :
'
+
10
,
30
)
'
button
'
,
1
,
'
center
'
,
'
킬 수 :
'
+
RoomData
.
myself
.
killCount
+
'
킬
'
,
30
).
layout
(),
UIObject
.
createLabel
(
ScenesData
.
gameScene
,
game
.
config
.
width
/
2
+
120
,
game
.
config
.
height
/
2
+
50
,
0
,
'
button
'
,
1
,
'
center
'
,
'
획득 강호패 :
'
+
RoomData
.
myself
.
earnedStrongHopae
+
'
개
'
,
30
).
layout
(),
UIObject
.
createLabel
(
ScenesData
.
gameScene
,
game
.
config
.
width
/
2
+
120
,
game
.
config
.
height
/
2
+
150
,
0
,
'
button
'
,
1
,
'
center
'
,
'
획득 골드 :
'
+
10
,
30
).
layout
()
],
],
space
:
{
choice
:
20
,
left
:
20
,
right
:
20
,
top
:
300
,
bottom
:
20
,
},
align
:
{
align
:
{
choices
:
'
center
'
// 'center'|'left'|'right'
choices
:
'
center
'
// 'center'|'left'|'right'
}
}
}),
}),
actions
:
[
UIObject
.
createLabel
(
ScenesData
.
gameScene
,
game
.
config
.
width
/
2
-
120
,
game
.
config
.
height
/
2
+
300
,
10
,
'
button
'
,
1
,
'
center
'
,
'
나가기
'
).
layout
(),
UIObject
.
createLabel
(
ScenesData
.
gameScene
,
game
.
config
.
width
/
2
+
120
,
game
.
config
.
height
/
2
+
300
,
10
,
'
button
'
,
1
,
'
center
'
,
'
관전하기
'
).
layout
()
],
space
:
{
space
:
{
action
:
0
,
action
:
1
0
,
left
:
20
,
left
:
20
,
right
:
20
,
right
:
20
,
...
@@ -316,13 +318,26 @@ var backToMenu = function()
...
@@ -316,13 +318,26 @@ var backToMenu = function()
}
}
}).
setDepth
(
10
);
}).
setDepth
(
10
);
/*ScenesData.gameScene.roomEnter
Dialog
ScenesData
.
gameScene
.
backToMenu
Dialog
.
on
(
'
button.click
'
,
function
(
button
,
groupName
,
index
)
{
.
on
(
'
button.click
'
,
function
(
button
,
groupName
,
index
)
{
if(index == 0) socket.emit('enterRoom', PlayerData.nickname);
if
(
index
==
0
)
{
socket
.
emit
(
'
exitFromRoom
'
,
RoomData
.
myself
.
id
);
fbClient
.
updateUserData
(
'
killCount
'
,
RoomData
.
myself
.
killCount
);
fbClient
.
updateUserData
(
'
money
'
,
10
);
ScenesData
.
changeScene
(
'
menuScene
'
);
}
else
else
{
{
ScenesData.gameScene.roomEnterDialog.setVisible(false);
ScenesData
.
gameScene
.
backToMenuDialog
.
setVisible
(
false
);
ScenesData.gameScene.gameStartBtn.setEnable(true);
ScenesData
.
gameScene
.
backToMenuBtn
=
UIObject
.
createButton
(
ScenesData
.
gameScene
,
UIObject
.
createLabel
(
ScenesData
.
gameScene
,
100
,
900
,
5
,
'
pyeongminThrow
'
,
0.5
,
'
center
'
),
1
,
0
,
2
,
function
()
{
socket
.
emit
(
'
exitFromRoom
'
,
RoomData
.
myself
.
id
);
fbClient
.
updateUserData
(
'
killCount
'
,
RoomData
.
myself
.
killCount
);
fbClient
.
updateUserData
(
'
money
'
,
10
);
ScenesData
.
changeScene
(
'
menuScene
'
);
});
}
}
},
ScenesData
.
gameScene
)
},
ScenesData
.
gameScene
)
.
on
(
'
button.over
'
,
function
(
button
,
groupName
,
index
)
{
.
on
(
'
button.over
'
,
function
(
button
,
groupName
,
index
)
{
...
@@ -331,9 +346,4 @@ var backToMenu = function()
...
@@ -331,9 +346,4 @@ var backToMenu = function()
.
on
(
'
button.out
'
,
function
(
button
,
groupName
,
index
)
{
.
on
(
'
button.out
'
,
function
(
button
,
groupName
,
index
)
{
//console.log('button out');
//console.log('button out');
});
});
setTimeout(() => {
socket.emit('defeat');
fbClient.updateUserData('killCount', RoomData.myself.killCount);
ScenesData.changeScene('menuScene');
}, 2000);*/
}
}
\ No newline at end of file
js/ScenesData.js
View file @
332c0b9c
...
@@ -448,7 +448,7 @@ var gameScene = new Phaser.Class(
...
@@ -448,7 +448,7 @@ var gameScene = new Phaser.Class(
WordSpace
.
nameQueue
.
initiate
();
WordSpace
.
nameQueue
.
initiate
();
//WordSpace.attackGauge.add(11);
//WordSpace.attackGauge.add(11);
},
},
update
:
function
()
update
:
function
()
...
...
server.js
View file @
332c0b9c
...
@@ -13,7 +13,7 @@ app.get('/', function(req, res) {
...
@@ -13,7 +13,7 @@ app.get('/', function(req, res) {
});
});
// http 기본 포트(80)에 서버 열기
// http 기본 포트(80)에 서버 열기
server
.
listen
(
80
,
function
()
{
server
.
listen
(
80
80
,
function
()
{
console
.
log
(
'
[SERVER] Listening on port
'
+
server
.
address
().
port
);
console
.
log
(
'
[SERVER] Listening on port
'
+
server
.
address
().
port
);
GameServer
.
serverNumber
=
Math
.
floor
(
Math
.
random
()
*
1000
+
1
);
GameServer
.
serverNumber
=
Math
.
floor
(
Math
.
random
()
*
1000
+
1
);
console
.
log
(
'
[SERVER] server number is
'
+
GameServer
.
serverNumber
);
console
.
log
(
'
[SERVER] server number is
'
+
GameServer
.
serverNumber
);
...
@@ -62,6 +62,10 @@ io.on('connection', function(socket)
...
@@ -62,6 +62,10 @@ io.on('connection', function(socket)
}
}
}
}
});
});
socket
.
on
(
'
exitFromRoom
'
,
function
(
msg
){
GameServer
.
findPlayerSocket
(
msg
).
playerData
.
playingData
.
isInThisRoom
=
false
;
});
socket
.
on
(
'
setPlayerTyping
'
,
function
(
msg
)
// number playerTyping
socket
.
on
(
'
setPlayerTyping
'
,
function
(
msg
)
// number playerTyping
{
{
...
...
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