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
dfc5b272
Commit
dfc5b272
authored
Aug 14, 2019
by
18손재민
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
게임 종료 시 UI 구현 wip
parent
b54eea87
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
83 additions
and
16 deletions
+83
-16
GameServer.js
GameServer.js
+3
-1
Client.js
js/Client.js
+73
-14
FirebaseClient.js
js/FirebaseClient.js
+4
-0
WordObject.js
js/WordObject.js
+1
-0
WordSpace.js
js/WordSpace.js
+2
-1
No files found.
GameServer.js
View file @
dfc5b272
...
@@ -328,9 +328,11 @@ class Player
...
@@ -328,9 +328,11 @@ class Player
this
.
nickname
=
playerData
.
nickname
;
this
.
nickname
=
playerData
.
nickname
;
this
.
playerImage
=
null
;
this
.
playerImage
=
null
;
this
.
position
=
null
;
this
.
position
=
null
;
this
.
isInThisRoom
=
true
;
this
.
killCount
=
0
;
this
.
earnedStrongHopae
=
0
;
this
.
isAlive
=
false
;
this
.
isAlive
=
false
;
this
.
isInThisRoom
=
true
;
this
.
rank
=
-
1
;
this
.
rank
=
-
1
;
this
.
playerTyping
=
0
;
this
.
playerTyping
=
0
;
...
...
js/Client.js
View file @
dfc5b272
...
@@ -215,8 +215,6 @@ socket.on('defeat', function(msg) // object player
...
@@ -215,8 +215,6 @@ socket.on('defeat', function(msg) // object player
repeat
:
0
,
// -1: infinity
repeat
:
0
,
// -1: infinity
yoyo
:
false
,
yoyo
:
false
,
onComplete
:
function
()
{
onComplete
:
function
()
{
setTimeout
(
function
()
{
setTimeout
(
function
()
{
ScenesData
.
gameScene
.
tweens
.
add
({
ScenesData
.
gameScene
.
tweens
.
add
({
targets
:
itemBag
,
targets
:
itemBag
,
...
@@ -227,14 +225,13 @@ socket.on('defeat', function(msg) // object player
...
@@ -227,14 +225,13 @@ socket.on('defeat', function(msg) // object player
repeat
:
0
,
// -1: infinity
repeat
:
0
,
// -1: infinity
yoyo
:
false
});
yoyo
:
false
});
},
1500
);
},
1500
);
},
},
onCompleteScope
:
ScenesData
.
gameScene
onCompleteScope
:
ScenesData
.
gameScene
});
});
setTimeout
(
function
()
{
setTimeout
(
function
()
{
itemBag
.
destroy
();
itemBag
.
destroy
();
},
3000
);
},
3000
);
RoomData
.
myself
.
killCount
++
;
}
}
}
}
else
else
...
@@ -243,21 +240,16 @@ socket.on('defeat', function(msg) // object player
...
@@ -243,21 +240,16 @@ socket.on('defeat', function(msg) // object player
WordSpace
.
killLogForTest
+=
(
'
\n
--Suicide->
'
+
RoomData
.
findPlayer
(
msg
.
id
).
nickname
);
WordSpace
.
killLogForTest
+=
(
'
\n
--Suicide->
'
+
RoomData
.
findPlayer
(
msg
.
id
).
nickname
);
}
}
if
(
msg
.
id
==
RoomData
.
myself
.
id
)
if
(
msg
.
id
==
RoomData
.
myself
.
id
)
{
{
setTimeout
(()
=>
{
backToMenu
();
socket
.
emit
(
'
defeat
'
);
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!!!!!!
'
);
if
(
msg
.
id
==
RoomData
.
myself
.
id
)
if
(
msg
.
id
==
RoomData
.
myself
.
id
)
{
{
setTimeout
(()
=>
{
backToMenu
();
ScenesData
.
changeScene
(
'
menuScene
'
);
},
2000
);
}
}
});
});
...
@@ -277,4 +269,71 @@ socket.on('userDisconnect', function(msg) // {num index , num id, str nickname}
...
@@ -277,4 +269,71 @@ socket.on('userDisconnect', function(msg) // {num index , num id, str nickname}
//console.log(msg.index + ' / ' + msg.id + ' / ' + msg.nickname + ' disconnected');
//console.log(msg.index + ' / ' + msg.id + ' / ' + msg.nickname + ' disconnected');
RoomData
.
players
[
msg
.
index
]
=
msg
;
RoomData
.
players
[
msg
.
index
]
=
msg
;
RoomData
.
aliveCount
--
;
RoomData
.
aliveCount
--
;
});
});
\ No newline at end of file
var
backToMenu
=
function
()
{
ScenesData
.
gameScene
.
roomEnterDialog
=
ScenesData
.
gameScene
.
rexUI
.
add
.
dialog
({
x
:
game
.
config
.
width
/
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
),
content
:
ScenesData
.
gameScene
.
roomEnterDialog
=
ScenesData
.
gameScene
.
rexUI
.
add
.
dialog
({
x
:
game
.
config
.
width
/
2
,
y
:
game
.
config
.
height
/
2
,
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
-
150
,
0
,
'
button
'
,
1
,
'
center
'
,
'
등수 :
'
+
RoomData
.
myself
.
rank
+
'
등
'
,
30
),
UIObject
.
createLabel
(
ScenesData
.
gameScene
,
game
.
config
.
width
/
2
+
100
,
game
.
config
.
height
/
2
-
50
,
0
,
'
button
'
,
1
,
'
center
'
,
'
킬 수 :
'
+
RoomData
.
myself
.
killCount
+
'
킬
'
,
30
),
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
+
100
,
game
.
config
.
height
/
2
+
150
,
0
,
'
button
'
,
1
,
'
center
'
,
'
획득 골드 :
'
+
10
,
30
)
],
space
:
{
choice
:
20
,
left
:
20
,
right
:
20
,
top
:
300
,
bottom
:
20
,
},
align
:
{
choices
:
'
center
'
// 'center'|'left'|'right'
}
}),
space
:
{
action
:
0
,
left
:
20
,
right
:
20
,
top
:
20
,
bottom
:
20
,
},
align
:
{
actions
:
'
center
'
// 'center'|'left'|'right'
}
}).
setDepth
(
10
);
/*ScenesData.gameScene.roomEnterDialog
.on('button.click', function (button, groupName, index) {
if(index == 0) socket.emit('enterRoom', PlayerData.nickname);
else
{
ScenesData.gameScene.roomEnterDialog.setVisible(false);
ScenesData.gameScene.gameStartBtn.setEnable(true);
}
}, ScenesData.gameScene)
.on('button.over', function (button, groupName, index) {
//console.log('button over');
})
.on('button.out', function (button, groupName, index) {
//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/FirebaseClient.js
View file @
dfc5b272
...
@@ -230,6 +230,9 @@ FirebaseClient.prototype.updateUserData = function(key, valueChanged, replace =
...
@@ -230,6 +230,9 @@ FirebaseClient.prototype.updateUserData = function(key, valueChanged, replace =
if
(
beforeData
.
item
!=
null
)
beforeData
.
item
.
push
(
valueChanged
);
if
(
beforeData
.
item
!=
null
)
beforeData
.
item
.
push
(
valueChanged
);
else
beforeData
.
item
=
[
valueChanged
];
else
beforeData
.
item
=
[
valueChanged
];
break
;
break
;
case
'
killCount
'
:
beforeData
.
killCount
=
replace
?
(
valueChanged
)
:
(
beforeData
.
killCount
+
valueChanged
);
break
;
default
:
default
:
console
.
log
(
'
[ERROR] database has no key for
'
+
key
);
console
.
log
(
'
[ERROR] database has no key for
'
+
key
);
break
;
break
;
...
@@ -271,5 +274,6 @@ class UserData
...
@@ -271,5 +274,6 @@ class UserData
this
.
title
=
[];
this
.
title
=
[];
this
.
money
=
0
;
this
.
money
=
0
;
this
.
item
=
[];
this
.
item
=
[];
this
.
killCount
=
0
;
}
}
}
}
\ No newline at end of file
js/WordObject.js
View file @
dfc5b272
...
@@ -236,6 +236,7 @@ class NameWord extends WordObject
...
@@ -236,6 +236,7 @@ class NameWord extends WordObject
this
.
wordWeight
=
2
;
this
.
wordWeight
=
2
;
this
.
isStrong
=
_isStrong
;
this
.
isStrong
=
_isStrong
;
this
.
isActive
=
true
;
this
.
isActive
=
true
;
if
(
_isStrong
)
RoomData
.
myself
.
earnedStrongHopae
++
;
//console.log('Name : ' + player.nickname + ', Strong : ' + this.isStrong + ', Weight : ' + this.wordWeight);
//console.log('Name : ' + player.nickname + ', Strong : ' + this.isStrong + ', Weight : ' + this.wordWeight);
}
}
instantiate
(
scene
,
lenRate
)
instantiate
(
scene
,
lenRate
)
...
...
js/WordSpace.js
View file @
dfc5b272
...
@@ -225,7 +225,6 @@ function gameOver()
...
@@ -225,7 +225,6 @@ function gameOver()
ScenesData
.
gameScene
.
add
.
text
(
game
.
config
.
width
/
2
,
game
.
config
.
height
/
2
,
'
패배
'
,
{
fontSize
:
'
30pt
'
})
ScenesData
.
gameScene
.
add
.
text
(
game
.
config
.
width
/
2
,
game
.
config
.
height
/
2
,
'
패배
'
,
{
fontSize
:
'
30pt
'
})
.
setPadding
(
5
,
5
,
5
,
5
).
setOrigin
(
0.5
,
0.5
).
setDepth
(
10
)
.
setPadding
(
5
,
5
,
5
,
5
).
setOrigin
(
0.5
,
0.5
).
setDepth
(
10
)
.
setColor
(
'
#000000
'
).
setBackgroundColor
(
'
#ffffff
'
);
.
setColor
(
'
#000000
'
).
setBackgroundColor
(
'
#ffffff
'
);
//alert('defeat');
}
}
//게임 오버 판정을 위한 타이머
//게임 오버 판정을 위한 타이머
...
@@ -487,3 +486,5 @@ WordSpace.nameQueue =
...
@@ -487,3 +486,5 @@ WordSpace.nameQueue =
this
.
shuffle
();
this
.
shuffle
();
}
}
}
}
WordSpace
.
gameOverUI
\ No newline at end of file
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