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
eaeeecb9
Commit
eaeeecb9
authored
Aug 23, 2019
by
18손재민
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'wordspace' into release
parents
6f6149a7
2c245f69
Changes
14
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
63 additions
and
56 deletions
+63
-56
GameServer.js
GameServer.js
+9
-13
buy.png
assets/image/UI/decisionBtn/buy.png
+0
-0
equip.png
assets/image/UI/decisionBtn/equip.png
+0
-0
bought_item.png
assets/image/UI/shop/bought_item.png
+0
-0
shop_background.png
assets/image/UI/shop/shop_background.png
+0
-0
shop_example.png
assets/image/UI/shop/shop_example.png
+0
-0
BGMsound.js
js/BGMsound.js
+4
-2
Background.js
js/Background.js
+5
-0
Client.js
js/Client.js
+5
-14
FirebaseClient.js
js/FirebaseClient.js
+1
-0
Input.js
js/Input.js
+1
-1
ResourceLoader.js
js/ResourceLoader.js
+4
-2
ScenesData.js
js/ScenesData.js
+24
-21
WordSpace.js
js/WordSpace.js
+10
-3
No files found.
GameServer.js
View file @
eaeeecb9
...
...
@@ -143,7 +143,8 @@ class GameRoom
{
if
(
this
.
currentPhase
===
GameServer
.
Phase
.
READY
)
{
this
.
endTime
=
Date
.
now
()
+
30000
;
// 방 대기 시간
this
.
countStartTime
=
Date
.
now
();
this
.
endTime
=
30000
;
// 방 대기 시간
this
.
announceToRoom
(
'
setRoomCount
'
,
{
isEnable
:
true
,
endTime
:
this
.
endTime
,
playerCount
:
this
.
currentPlayer
.
length
,
...
...
@@ -153,6 +154,7 @@ class GameRoom
}
else
if
(
this
.
currentPhase
===
GameServer
.
Phase
.
COUNT
)
{
this
.
endTime
=
this
.
endTime
-
(
Time
.
now
()
-
this
.
countStartTime
);
this
.
announceToRoom
(
'
setRoomCount
'
,
{
isEnable
:
true
,
endTime
:
this
.
endTime
,
playerCount
:
this
.
currentPlayer
.
length
,
...
...
@@ -264,32 +266,26 @@ class GameRoom
console
.
table
(
this
.
currentPlayer
);
this
.
announceToRoom
(
'
startGame
'
);
this
.
startTime
=
Date
.
now
();
setTimeout
(
function
()
{
if
(
this
.
currentPhase
===
GameServer
.
Phase
.
START
)
this
.
checkPhase
(
Date
.
now
());
}.
bind
(
this
),
6000
);
}
checkPhase
(
checkTime
)
{
if
(
this
.
currentPhase
===
GameServer
.
Phase
.
START
)
{
if
(
this
.
phaseChanger
<
0
&&
checkTime
-
this
.
startTime
>
1
000
)
if
(
checkTime
-
this
.
startTime
>
6
000
)
{
this
.
currentPhase
=
GameServer
.
Phase
.
MAIN
;
this
.
rateArrangePoint
=
150
;
this
.
announceToRoom
(
'
changePhase
'
,
GameServer
.
Phase
.
MAIN
);
}
else
if
(
this
.
phaseChanger
<
0
)
{
this
.
phaseChanger
=
setTimeout
(
function
(
room
)
{
room
.
currentPhase
=
GameServer
.
Phase
.
MAIN
;
room
.
rateArrangePoint
=
150
;
room
.
announceToRoom
(
'
changePhase
'
,
GameServer
.
Phase
.
MAIN
);
room
.
phaseChanger
=
-
1
;
},
60000
-
(
checkTime
-
this
.
startTime
),
this
);
}
}
else
if
(
this
.
currentPhase
===
GameServer
.
Phase
.
MAIN
)
{
let
playerLimit
=
Math
.
m
in
(
Math
.
round
(
this
.
currentPlayer
.
length
/
5
),
3
);
let
playerLimit
=
Math
.
m
ax
(
Math
.
round
(
this
.
currentPlayer
.
length
/
5
),
3
);
if
(
this
.
aliveCount
<=
playerLimit
)
{
this
.
currentPhase
=
GameServer
.
Phase
.
MUSIC
;
...
...
assets/image/UI/decisionBtn/buy.png
0 → 100644
View file @
eaeeecb9
15.6 KB
assets/image/UI/decisionBtn/equip.png
0 → 100644
View file @
eaeeecb9
13.5 KB
assets/image/UI/shop/bought_item.png
0 → 100644
View file @
eaeeecb9
16.7 KB
assets/image/UI/shop/shop_background.png
0 → 100644
View file @
eaeeecb9
This diff is collapsed.
Click to expand it.
assets/image/UI/shop/shop_example.png
0 → 100644
View file @
eaeeecb9
This diff is collapsed.
Click to expand it.
js/BGMsound.js
View file @
eaeeecb9
...
...
@@ -29,12 +29,13 @@ Audio.loadSound = function(scene)
Audio
.
playSound
=
function
(
scene
,
title
)
// 한 번만 재생할 때 사용
{
bgm
=
scene
.
sound
.
add
(
title
);
bgm
.
play
();
let
sound
=
scene
.
sound
.
add
(
title
);
sound
.
play
();
}
Audio
.
loopSound
=
function
(
scene
,
title
)
// 반복재생할 때 사용
{
if
(
bgm
!=
null
)
this
.
killSound
(
scene
,
title
);
bgm
=
scene
.
sound
.
add
(
title
);
bgm
.
setLoop
(
true
);
bgm
.
play
();
...
...
@@ -56,3 +57,4 @@ Audio.killSound = function(scene, title)
bgm
.
stop
();
}
// 전반적으로 함수 수정 필요..
\ No newline at end of file
js/Background.js
View file @
eaeeecb9
...
...
@@ -52,6 +52,11 @@ BackGround.drawMenu = function(scene)
scene
.
add
.
sprite
(
game
.
config
.
width
/
2
,
game
.
config
.
height
/
2
,
'
menuBackground
'
).
setDisplaySize
(
game
.
config
.
width
,
game
.
config
.
height
).
setDepth
(
3
);
}
BackGround
.
drawShop
=
function
(
scene
)
{
scene
.
add
.
sprite
(
game
.
config
.
width
/
2
,
game
.
config
.
height
/
2
,
'
shopBackground
'
).
setDisplaySize
(
game
.
config
.
width
,
game
.
config
.
height
).
setDepth
(
3
);
}
BackGround
.
drawRoom
=
function
(
scene
)
{
scene
.
add
.
sprite
(
game
.
config
.
width
/
2
,
game
.
config
.
height
/
2
,
'
roomBackground
'
).
setDisplaySize
(
game
.
config
.
width
,
game
.
config
.
height
).
setDepth
(
5.2
);
...
...
js/Client.js
View file @
eaeeecb9
...
...
@@ -70,7 +70,7 @@ socket.on('setRoomCount', function(msg)
setTimeout
(
function
()
{
ScenesData
.
roomScene
.
isCounting
=
msg
.
isEnable
;
ScenesData
.
roomScene
.
endTime
=
msg
.
endTime
;
ScenesData
.
roomScene
.
endTime
=
Date
.
now
()
+
msg
.
endTime
;
ScenesData
.
roomScene
.
peopleCount
=
msg
.
playerCount
;
if
(
msg
.
isEnter
)
// generate character
...
...
@@ -207,14 +207,7 @@ socket.on('defeat', function(msg) // object player
let
nicknameText
=
RoomData
.
findPlayer
(
msg
.
id
).
nicknameText
;
let
earnedStrongHopae
=
RoomData
.
findPlayer
(
msg
.
id
).
earnedStrongHopae
;
if
(
WordSpace
.
CurrentPhase
==
1
)
Audio
.
killSound
(
ScenesData
.
gameScene
,
'
Phase1
'
);
if
(
WordSpace
.
CurrentPhase
==
2
)
Audio
.
killSound
(
ScenesData
.
gameScene
,
'
Phase2
'
);
if
(
WordSpace
.
CurrentPhase
==
3
)
Audio
.
killSound
(
ScenesData
.
gameScene
,
'
Phase3
'
);
Audio
.
playSound
(
ScenesData
.
gameScene
,
'
defeat
'
);
RoomData
.
players
[
msg
.
index
]
=
msg
;
RoomData
.
players
[
msg
.
index
].
playerImage
=
playerImage
;
RoomData
.
players
[
msg
.
index
].
position
=
position
;
...
...
@@ -361,6 +354,7 @@ socket.on('defeat', function(msg) // object player
}
if
(
msg
.
id
==
RoomData
.
myself
.
id
)
{
Audio
.
loopSound
(
ScenesData
.
gameScene
,
'
defeat
'
);
RoomData
.
myself
=
RoomData
.
players
[
msg
.
index
];
setTimeout
(()
=>
{
gameEndMenu
(
false
);
...
...
@@ -378,10 +372,10 @@ socket.on('gameEnd', function(msg) // number winnerId
if
(
WordSpace
.
CurrentPhase
==
3
)
Audio
.
killSound
(
ScenesData
.
gameScene
,
'
Phase3
'
);
Audio
.
playSound
(
ScenesData
.
gameScene
,
'
victory
'
);
console
.
log
(
winner
.
nickname
+
'
Win!!!!!!
'
);
if
(
msg
==
RoomData
.
myself
.
id
)
{
Audio
.
loopSound
(
ScenesData
.
gameScene
,
'
victory
'
);
RoomData
.
myself
.
rank
=
1
;
setTimeout
(()
=>
{
gameEndMenu
(
true
);
...
...
@@ -393,7 +387,6 @@ socket.on('attackSucceed', function(msg)
{
//console.log('client');
let
tempWord
=
WordSpace
.
generateWord
.
Name
(
ScenesData
.
gameScene
,
true
,
RoomData
.
findPlayer
(
msg
.
victimId
));
tempWord
.
instantiate
(
ScenesData
.
gameScene
);
let
victimPos
=
RoomData
.
findPlayer
(
msg
.
victimId
).
position
;
tempWord
.
physicsObj
.
setPosition
(
victimPos
.
x
,
victimPos
.
y
);
tempWord
.
wordObj
.
setPosition
(
tempWord
.
physicsObj
.
x
,
tempWord
.
physicsObj
.
y
);
...
...
@@ -417,10 +410,9 @@ var gameEndMenu = function(isWin)
let
earnedMoney
=
0
;
if
(
isWin
)
earnedMoney
+=
20
;
earnedMoney
+=
RoomData
.
myself
.
killCount
*
3
;
earnedMoney
+=
parseInt
(
WordSpace
.
playerTyping
/
1
0
);
earnedMoney
+=
parseInt
(
WordSpace
.
playerTyping
/
4
0
);
earnedMoney
+=
Math
.
max
(
20
,
Math
.
pow
(
RoomData
.
myself
.
attackSucceed
,
2
));
earnedMoney
+=
parseInt
(
20
*
(
1
-
(
RoomData
.
myself
.
rank
-
1
)
/
(
RoomData
.
players
.
length
-
1
)));
earnedMoney
=
parseInt
(
earnedMoney
/
40
);
Input
.
inputField
.
text
.
destroy
();
...
...
@@ -432,7 +424,6 @@ var gameEndMenu = function(isWin)
ScenesData
.
changeScene
(
'
menuScene
'
);
}
ScenesData
.
gameScene
.
backToMenuDialog
=
ScenesData
.
gameScene
.
rexUI
.
add
.
dialog
({
x
:
game
.
config
.
width
/
2
,
y
:
game
.
config
.
height
/
2
,
...
...
js/FirebaseClient.js
View file @
eaeeecb9
...
...
@@ -266,6 +266,7 @@ FirebaseClient.prototype.updateUserData = function(key, valueChanged, replace =
break
;
case
'
skin
'
:
beforeData
.
skin
=
valueChanged
;
break
;
default
:
console
.
log
(
'
[ERROR] database has no key for
'
+
key
);
break
;
...
...
js/Input.js
View file @
eaeeecb9
...
...
@@ -387,7 +387,7 @@ Input.inputField =
Input
.
pushInput
=
function
(
inputKey
)
{
if
(
(
ScenesData
.
currentScene
!=
'
gameScene
'
||
RoomData
.
myself
.
isAlive
)
&&
this
.
justPressed
!=
inputKey
)
if
(
!
WordSpace
.
isGameOver
&&
RoomData
.
myself
.
isAlive
&&
this
.
justPressed
!=
inputKey
)
{
this
.
justPressed
=
inputKey
;
let
output
;
...
...
js/ResourceLoader.js
View file @
eaeeecb9
...
...
@@ -7,6 +7,7 @@ ResourceLoader.loadBackGround = function(scene)
scene
.
load
.
image
(
'
gameBackground
'
,
'
assets/image/background/background_brain.png
'
);
scene
.
load
.
image
(
'
menuBackground
'
,
'
assets/image/UI/main/mainBackground.png
'
);
scene
.
load
.
image
(
'
roomBackground
'
,
'
assets/placeholder/roomBackground.png
'
);
scene
.
load
.
image
(
'
shopBackground
'
,
'
assets/image/UI/shop/shop_background.png
'
);
}
ResourceLoader
.
loadImage
=
function
(
scene
)
...
...
@@ -65,6 +66,7 @@ ResourceLoader.loadImage = function(scene)
scene
.
load
.
image
(
'
friendlyPlayBtn
'
,
'
assets/image/UI/main/friendlyPlay.png
'
);
scene
.
load
.
image
(
'
rankPlayBtn
'
,
'
assets/image/UI/main/rankPlay.png
'
);
scene
.
load
.
image
(
'
shopBtn
'
,
'
assets/image/UI/main/shop.png
'
);
scene
.
load
.
image
(
'
boughtItem
'
,
'
assets/image/UI/shop/bought_item.png
'
);
scene
.
load
.
image
(
'
hopaeManageBtn
'
,
'
assets/image/UI/main/hopaeManage.png
'
);
scene
.
load
.
image
(
'
helpBtn
'
,
'
assets/image/UI/main/help.png
'
);
...
...
@@ -75,6 +77,8 @@ ResourceLoader.loadImage = function(scene)
scene
.
load
.
image
(
'
noBtn
'
,
'
assets/image/UI/decisionBtn/no.png
'
);
scene
.
load
.
image
(
'
spectateBtn
'
,
'
assets/image/UI/decisionBtn/spectate.png
'
);
scene
.
load
.
image
(
'
yesBtn
'
,
'
assets/image/UI/decisionBtn/yes.png
'
);
scene
.
load
.
image
(
'
buyBtn
'
,
'
assets/image/UI/decisionBtn/buy.png
'
);
scene
.
load
.
image
(
'
equipBtn
'
,
'
assets/image/UI/decisionBtn/equip.png
'
);
...
...
@@ -156,6 +160,4 @@ ResourceLoader.loadAnimation = function(scene)
repeat
:
0
});
}
}
\ No newline at end of file
js/ScenesData.js
View file @
eaeeecb9
This diff is collapsed.
Click to expand it.
js/WordSpace.js
View file @
eaeeecb9
...
...
@@ -218,6 +218,13 @@ function gameOver()
{
WordSpace
.
pauseCycle
(
true
);
if
(
WordSpace
.
CurrentPhase
==
1
)
Audio
.
killSound
(
ScenesData
.
gameScene
,
'
Phase1
'
);
if
(
WordSpace
.
CurrentPhase
==
2
)
Audio
.
killSound
(
ScenesData
.
gameScene
,
'
Phase2
'
);
if
(
WordSpace
.
CurrentPhase
==
3
)
Audio
.
killSound
(
ScenesData
.
gameScene
,
'
Phase3
'
);
socket
.
emit
(
'
defeated
'
);
console
.
log
(
'
defeat
'
);
}
...
...
@@ -486,11 +493,11 @@ WordSpace.changePhase = function(newPhase)
WordSpace
.
CurrentPhase
=
newPhase
;
if
(
WordSpace
.
CurrentPhase
==
1
)
Audio
.
killSound
(
'
gameScene
'
,
'
Phase1
'
);
Audio
.
loopSound
(
ScenesData
.
currentScene
,
'
Phase1
'
);
else
if
(
WordSpace
.
CurrentPhase
==
2
)
Audio
.
killSound
(
'
gameScene
'
,
'
Phase2
'
);
Audio
.
loopSound
(
ScenesData
.
currentScene
,
'
Phase2
'
);
else
Audio
.
killSound
(
'
gameScene
'
,
'
Phase3
'
);
Audio
.
loopSound
(
ScenesData
.
currentScene
,
'
Phase3
'
);
//WordSpace.pauseCycle(true);
// 여기서 종이 드르륵 열면됨
...
...
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