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
f6cbf77f
Commit
f6cbf77f
authored
Aug 07, 2019
by
18손재민
Committed by
18신대성
Aug 07, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
최근 사용한 호패를 서버에 갱신함
parent
f8ecc5f1
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
35 additions
and
13 deletions
+35
-13
Client.js
js/Client.js
+1
-0
FirebaseClient.js
js/FirebaseClient.js
+26
-4
Input.js
js/Input.js
+2
-2
ScenesData.js
js/ScenesData.js
+6
-7
No files found.
js/Client.js
View file @
f6cbf77f
...
...
@@ -29,6 +29,7 @@ socket.on('setId', function(msg) // {str, num playerNum}
// init game
socket
.
on
(
'
enterRoom
'
,
function
()
{
fbClient
.
updateUserData
(
'
recentHopae
'
,
PlayerData
.
nickname
);
Audio
.
killSound
(
ScenesData
.
menuScene
,
'
login
'
);
ScenesData
.
changeScene
(
'
roomScene
'
);
/*game.scene.stop('menuScene');
...
...
js/FirebaseClient.js
View file @
f6cbf77f
...
...
@@ -206,9 +206,9 @@ FirebaseClient.prototype.updateUserData = function(key, valueChanged, replace =
updates
.
exp
=
replace
?
(
valueChanged
)
:
(
beforeData
.
exp
+
valueChanged
);
beforeData
.
exp
=
updates
.
exp
;
break
;
case
'
money
'
:
updates
.
money
=
replace
?
(
valueChanged
)
:
(
beforeData
.
money
+
valueChanged
);
beforeData
.
money
=
updates
.
money
;
case
'
rank
'
:
updates
.
rank
=
replace
?
(
valueChanged
)
:
(
beforeData
.
rank
+
valueChanged
);
beforeData
.
rank
=
updates
.
rank
;
break
;
case
'
hopae
'
:
if
(
beforeData
.
hopae
!=
null
)
...
...
@@ -222,6 +222,26 @@ FirebaseClient.prototype.updateUserData = function(key, valueChanged, replace =
updates
.
hopae
=
[
valueChanged
];
}
break
;
case
'
recentHopae
'
:
updates
.
recentHopae
=
valueChanged
;
beforeData
.
recentHopae
=
updates
.
recentHopae
;
break
;
case
'
title
'
:
if
(
beforeData
.
title
!=
null
)
{
updates
.
title
.
push
(
valueChanged
);
beforeData
.
title
.
push
(
valueChanged
);
}
else
{
beforeData
.
title
=
[
valueChanged
];
updates
.
title
=
[
valueChanged
];
}
break
;
case
'
money
'
:
updates
.
money
=
replace
?
(
valueChanged
)
:
(
beforeData
.
money
+
valueChanged
);
beforeData
.
money
=
updates
.
money
;
break
;
case
'
item
'
:
if
(
beforeData
.
item
!=
null
)
{
...
...
@@ -238,6 +258,8 @@ FirebaseClient.prototype.updateUserData = function(key, valueChanged, replace =
console
.
log
(
'
[ERROR] database has no key for
'
+
key
);
break
;
}
PlayerData
.
userData
=
beforeData
;
console
.
log
(
updates
.
recentHopae
);
return
this
.
database
.
ref
(
'
/user-data/
'
+
this
.
auth
.
currentUser
.
uid
).
update
(
updates
);
}
...
...
@@ -258,7 +280,7 @@ class UserData
[
{
name
:
prompt
(
"
첫번째 호패의 닉네임을 입력해주세요.
"
),
type
:
'
wood
'
}
];
this
.
recent
Nam
e
=
''
;
this
.
recent
Hopa
e
=
''
;
this
.
title
=
[];
this
.
money
=
0
;
this
.
item
=
[];
...
...
js/Input.js
View file @
f6cbf77f
...
...
@@ -33,9 +33,9 @@ Input.menuSceneEnterReaction = function()
{
Input
.
finalInput
=
Input
.
removeConVow
(
Input
.
finalInput
);
if
(
Input
.
finalInput
.
length
>
1
)
{
{
PlayerData
.
nickname
=
Input
.
finalInput
;
ScenesData
.
menuScene
.
myName
.
setText
(
'
내 이름
:
'
+
PlayerData
.
nickname
);
ScenesData
.
menuScene
.
hopae
.
setText
(
'
내 호패
:
'
+
PlayerData
.
nickname
);
Input
.
reset
();
}
else
...
...
js/ScenesData.js
View file @
f6cbf77f
...
...
@@ -28,21 +28,20 @@ var menuScene = new Phaser.Class(
Audio
.
loopSound
(
this
,
'
login
'
);
Input
.
inputField
.
generate
(
this
,
Input
.
menuSceneEnterReaction
);
//BackGround.drawMenu(this);
this
.
myName
=
this
.
add
.
text
(
game
.
config
.
width
/
2
,
200
,
'
이름을 입력해주세요.
'
).
setOrigin
(
0.5
,
0.5
).
setColor
(
'
#000000
'
).
setDepth
(
10
).
setPadding
(
5
,
5
,
5
,
5
);
this
.
myName
.
setFontSize
(
40
);
this
.
userName
=
this
.
add
.
text
(
100
,
100
,
'
내 이름 :
'
+
PlayerData
.
userData
.
userName
).
setOrigin
(
0
,
0.5
).
setColor
(
'
#000000
'
).
setDepth
(
10
).
setPadding
(
5
,
5
,
5
,
5
).
setFontSize
(
40
);
this
.
money
=
this
.
add
.
text
(
100
,
200
,
'
소지 엽전 :
'
+
PlayerData
.
userData
.
money
).
setOrigin
(
0
,
0.5
).
setColor
(
'
#000000
'
).
setDepth
(
10
).
setPadding
(
5
,
5
,
5
,
5
).
setFontSize
(
40
);
this
.
hopae
=
this
.
add
.
text
(
100
,
300
,
'
내 호패 :
'
+
PlayerData
.
userData
.
recentHopae
).
setOrigin
(
0
,
0.5
).
setColor
(
'
#000000
'
).
setDepth
(
10
).
setPadding
(
5
,
5
,
5
,
5
).
setFontSize
(
40
);
this
.
myCharacter
=
this
.
add
.
sprite
(
game
.
config
.
width
/
2
,
game
.
config
.
height
/
2
,
'
pyeongminStand
'
).
setOrigin
(
0.5
,
0.5
).
setDepth
(
5
);
PlayerData
.
nickname
=
PlayerData
.
userData
.
recentHopae
;
const
actionOnClick
=
()
=>
{
console
.
log
(
'
click
'
);
socket
.
emit
(
'
enterRoom
'
,
PlayerData
.
nickname
);
}
let
btn1
=
new
Button
(
this
,
game
.
config
.
width
/
2
,
800
,
'
pyeongminWrite
'
,
actionOnClick
,
2
,
1
,
0
)
btn1
.
onInputOut
=
()
=>
{
console
.
log
(
'
Btn1: onInputOut
'
)
}
btn1
.
setScale
(
0.5
).
setDepth
(
10
);
let
gameStartBtn
=
new
Button
(
this
,
game
.
config
.
width
/
2
,
800
,
'
pyeongminWrite
'
,
actionOnClick
,
2
,
1
,
0
)
gameStartBtn
.
setScale
(
0.5
).
setDepth
(
10
);
}
});
...
...
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