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
6e58f527
Commit
6e58f527
authored
Aug 15, 2019
by
18손재민
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
반격 오류 수정
parent
4c0e1367
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
12 deletions
+22
-12
GameServer.js
GameServer.js
+1
-0
Client.js
js/Client.js
+20
-12
WordObject.js
js/WordObject.js
+1
-0
No files found.
GameServer.js
View file @
6e58f527
...
...
@@ -337,6 +337,7 @@ class Player
this
.
position
=
null
;
this
.
killCount
=
0
;
this
.
earnedStrongHopae
=
0
;
this
.
attackSucceed
=
0
;
this
.
isAlive
=
false
;
this
.
isInThisRoom
=
true
;
...
...
js/Client.js
View file @
6e58f527
...
...
@@ -167,7 +167,6 @@ socket.on('someoneAttacked', function(msg) // {Id attackerId, Id victimId}
});
socket
.
on
(
'
attacked
'
,
function
(
msg
)
// object attackData
{
//console.log('attacked by ' + msg.attacker.nickname);
let
attackedEvent
=
new
Cycle
(
function
()
{
if
(
!
WordSpace
.
isInvincible
)
...
...
@@ -242,7 +241,7 @@ socket.on('defeat', function(msg) // object player
if
(
msg
.
id
==
RoomData
.
myself
.
id
)
{
RoomData
.
myself
=
RoomData
.
players
[
msg
.
index
];
backToMenu
();
backToMenu
(
false
);
}
});
socket
.
on
(
'
gameEnd
'
,
function
(
msg
)
// object player
...
...
@@ -250,7 +249,7 @@ socket.on('gameEnd', function(msg) // object player
console
.
log
(
msg
.
nickname
+
'
Win!!!!!!
'
);
if
(
msg
.
id
==
RoomData
.
myself
.
id
)
{
backToMenu
();
backToMenu
(
true
);
}
});
...
...
@@ -262,6 +261,7 @@ socket.on('attackSucceed', function(msg)
tempWord
.
physicsObj
.
setPosition
(
victimPos
.
x
,
victimPos
.
y
);
tempWord
.
wordObj
.
setPosition
(
tempWord
.
physicsObj
.
x
,
tempWord
.
physicsObj
.
y
);
tempWord
.
destroy
();
RoomData
.
myself
.
attackSucceed
+=
1
;
});
// out game
...
...
@@ -272,8 +272,23 @@ socket.on('userDisconnect', function(msg) // {num index , num id, str nickname}
RoomData
.
aliveCount
--
;
});
var
backToMenu
=
function
()
var
backToMenu
=
function
(
isWin
)
{
let
earnedMoney
=
0
;
if
(
isWin
)
earnedMoney
+=
20
;
earnedMoney
+=
RoomData
.
myself
.
killCount
*
3
;
earnedMoney
+=
parseInt
(
WordSpace
.
playerTypingRate
/
10
);
earnedMoney
+=
Math
.
max
(
20
,
Math
.
pow
(
RoomData
.
myself
.
attackSucceed
,
2
));
earnedMoney
+=
parseInt
(
20
*
(
1
-
(
RoomData
.
myself
.
rank
-
1
)
/
(
RoomData
.
players
.
length
-
1
)));
var
temp
=
function
(){
socket
.
emit
(
'
exitFromRoom
'
,
RoomData
.
myself
.
id
);
fbClient
.
updateUserData
(
'
killCount
'
,
RoomData
.
myself
.
killCount
);
fbClient
.
updateUserData
(
'
money
'
,
earnedMoney
);
ScenesData
.
changeScene
(
'
menuScene
'
);
}
ScenesData
.
gameScene
.
backToMenuDialog
=
ScenesData
.
gameScene
.
rexUI
.
add
.
dialog
({
x
:
game
.
config
.
width
/
2
,
y
:
game
.
config
.
height
/
2
,
...
...
@@ -292,7 +307,7 @@ var backToMenu = function()
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
()
'
button
'
,
1
,
'
center
'
,
'
획득 골드 :
'
+
earnedMoney
+
'
원
'
,
30
).
layout
()
],
align
:
{
...
...
@@ -317,13 +332,6 @@ var backToMenu = function()
actions
:
'
center
'
// 'center'|'left'|'right'
}
}).
setDepth
(
10
);
var
temp
=
function
(){
//WordSpace.resetGame();
socket
.
emit
(
'
exitFromRoom
'
,
RoomData
.
myself
.
id
);
fbClient
.
updateUserData
(
'
killCount
'
,
RoomData
.
myself
.
killCount
);
fbClient
.
updateUserData
(
'
money
'
,
10
);
ScenesData
.
changeScene
(
'
menuScene
'
);
}
ScenesData
.
gameScene
.
backToMenuDialog
.
on
(
'
button.click
'
,
function
(
button
,
groupName
,
index
)
{
...
...
js/WordObject.js
View file @
6e58f527
...
...
@@ -210,6 +210,7 @@ class AttackWord extends WordObject
attackerId
:
RoomData
.
myself
.
id
,
victimId
:
this
.
attacker
.
id
,
text
:
this
.
wordText
,
multiple
:
1
,
grade
:
Math
.
min
(
3
,
this
.
wordGrade
+
1
),
attackOption
:
{
isStrong
:
false
,
...
...
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