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
a1ff4ffd
Commit
a1ff4ffd
authored
Jul 10, 2019
by
18류지석
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'wordgen'
parents
47bb8f98
e250620e
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
30 additions
and
11 deletions
+30
-11
Client.js
js/Client.js
+5
-0
Input.js
js/Input.js
+1
-2
ScenesData.js
js/ScenesData.js
+1
-1
WordObject.js
js/WordObject.js
+7
-5
WordSpace.js
js/WordSpace.js
+11
-3
server.js
server.js
+5
-0
No files found.
js/Client.js
View file @
a1ff4ffd
...
...
@@ -51,6 +51,11 @@ socket.on('defeat', function(msg) // object player
console
.
log
(
RoomData
.
players
[
msg
.
index
].
nickname
+
'
defeated
'
);
});
socket
.
on
(
'
attackSucceed
'
,
function
(
msg
)
{
WordSpace
.
nameGroup
.
push
(
new
NameWord
(
msg
.
victim
,
true
));
});
// out game
socket
.
on
(
'
userDisconnect
'
,
function
(
msg
)
// {num index , num id, str nickname}
{
...
...
js/Input.js
View file @
a1ff4ffd
...
...
@@ -16,8 +16,7 @@ Input.gameSceneEnterReaction = function()
{
if
(
!
Input
.
isEntered
)
{
Input
.
convInput
=
Input
.
removeConVow
(
Input
.
convInput
);
if
(
Input
.
attackMode
)
WordSpace
.
attack
(
Input
.
convInput
,
Input
.
attackOption
.
wordGrade
);
if
(
Input
.
attackMode
)
WordSpace
.
attack
(
Input
.
removeConVow
(
Input
.
convInput
),
Input
.
attackOption
.
wordGrade
);
else
WordSpace
.
findWord
(
Input
.
convInput
);
Input
.
reset
();
Input
.
isEntered
=
true
;
...
...
js/ScenesData.js
View file @
a1ff4ffd
...
...
@@ -85,7 +85,7 @@ var gameScene = new Phaser.Class(
let
tempNames
=
''
;
WordSpace
.
nameGroup
.
forEach
(
function
(
element
)
{
tempNames
+=
element
.
wordText
+
element
.
isStrong
+
'
\n
'
;
tempNames
+=
element
.
wordText
+
(
element
.
isStrong
?
'
[강]
'
:
''
)
+
'
\n
'
;
});
WordSpace
.
nameWordTextForTest
.
setText
(
'
현재 가진 호패들 :
\n
'
+
tempNames
);
...
...
js/WordObject.js
View file @
a1ff4ffd
...
...
@@ -135,13 +135,12 @@ class AttackWord extends WordObject
super
(
text
);
this
.
wordGrade
=
_wordGrade
;
this
.
wordWeight
=
WordReader
.
getWordWeight
(
this
.
wordGrade
);
if
(
WordReader
.
getWordTyping
(
_playerData
.
nickname
)
<=
9
)
if
(
WordReader
.
getWordTyping
(
_playerData
.
nickname
)
>
9
)
this
.
wordWeight
+=
this
.
wordWeight
*
0.2
*
(
WordReader
.
getWordTyping
(
_playerData
.
nickname
)
-
9
);
this
.
wordWeight
*=
isStrong
?
3
:
2
;
this
.
attacker
=
_playerData
;
//서버 사용하게 되면 PlayerTyping을 피격자의 것으로 바꿔야 함
this
.
counterTime
=
WordSpace
.
gameTimer
.
now
+
1000
*
(
this
.
wordTyping
<=
(
5
-
_wordGrade
)
*
2.5
?
this
.
wordTyping
*
(
WordSpace
.
playerTyping
/
60
)
*
2
:
((
5
-
_wordGrade
)
*
2.5
+
(
this
.
wordTyping
-
(
5
-
_wordGrade
)
*
2.5
)
*
3
)
*
(
WordSpace
.
playerTyping
/
60
)
*
2
);
this
.
counterTime
=
WordSpace
.
gameTimer
.
now
+
1000
*
(
this
.
wordTyping
<=
(
5
-
_wordGrade
)
*
2.5
?
this
.
wordTyping
/
(
Math
.
max
(
200
,
WordSpace
.
playerTyping
)
/
60
)
*
1.5
:
((
5
-
_wordGrade
)
*
2.5
+
(
this
.
wordTyping
-
(
5
-
_wordGrade
)
*
2.5
)
*
2.5
)
/
(
Math
.
max
(
200
,
WordSpace
.
playerTyping
)
/
60
)
*
1.5
);
console
.
log
(
'
Attack text :
'
+
text
+
'
, Attacker :
'
+
this
.
attacker
.
nickname
+
'
, Weight :
'
+
this
.
wordWeight
);
console
.
log
(
'
Counter time :
'
+
this
.
counterTime
);
}
...
...
@@ -155,7 +154,10 @@ class AttackWord extends WordObject
case
3
:
WordSpace
.
attackGauge
.
add
(
0.5
);
break
;
default
:
console
.
log
(
'
[ERR] wrong grade of word
'
);
break
;
}
if
(
WordSpace
.
gameTimer
.
now
<
this
.
counterTime
)
WordSpace
.
nameGroup
.
push
(
new
NameWord
(
this
.
attacker
,
true
));
if
(
WordSpace
.
gameTimer
.
now
<
this
.
counterTime
)
{
WordSpace
.
nameGroup
.
push
(
new
NameWord
(
this
.
attacker
,
true
));
}
//강호패 넣기 구현해야됨
//WordSpace.generateWord.Name(WordSpace.gameSceneForTest, true);
super
.
destroy
();
...
...
js/WordSpace.js
View file @
a1ff4ffd
...
...
@@ -354,8 +354,14 @@ WordSpace.findWord = function(wordText)
{
if
(
WordSpace
.
getEditDistance
(
wordText
,
element
.
wordText
)
==
minDist
)
{
//강호패 보내야 함
console
.
log
(
'
Attack word :
'
+
element
.
wordText
+
'
of
'
+
element
.
attacker
.
nickname
+
'
오타임
'
);
let
victimData
=
{
roomNum
:
RoomData
.
roomNum
,
victim
:
RoomData
.
myself
,
target
:
element
.
attacker
.
idNum
}
socket
.
emit
(
'
defenseFailed
'
,
victimData
);
}
});
this
.
attackGauge
.
sub
(
2
);
...
...
@@ -400,6 +406,8 @@ WordSpace.attack = function(wordText, grade)
});
//테스트용, 자기 자신에게 공격함
//WordSpace.generateWord.Attack(WordSpace.gameSceneForTest, wordText, grade, PlayerData, false);
WordSpace
.
generateWord
.
Name
(
WordSpace
.
gameSceneForTest
,
false
);
WordSpace
.
generateWord
.
Name
(
WordSpace
.
gameSceneForTest
,
false
);
WordSpace
.
nameGroup
=
[];
WordSpace
.
attackGauge
.
resetValue
();
...
...
@@ -425,8 +433,8 @@ WordSpace.nameQueue =
tempQueue
[
tempLength
-
1
]
=
tempQueue
[
tempIdx
];
tempQueue
[
tempIdx
]
=
tempElement
;
}
tempQueue
.
forEach
(
function
(
element
)
{
//console.log(element.id + ' ' + PlayerData.idNum);
tempQueue
.
forEach
(
function
(
element
)
{
if
(
element
.
id
!=
PlayerData
.
idNum
&&
element
.
isAlive
)
WordSpace
.
nameQueue
.
queue
.
push
(
element
);
});
...
...
server.js
View file @
a1ff4ffd
...
...
@@ -87,6 +87,11 @@ io.on('connection', function(socket)
console
.
log
(
'
[
'
+
socket
.
playerData
.
id
+
'
]
'
+
'
defeated
'
);
});
socket
.
on
(
'
defenseFailed
'
,
function
(
msg
)
{
GameServer
.
announceToTarget
(
GameServer
.
findRoomIndex
(
msg
.
roomNum
),
msg
.
target
,
'
attackSucceed
'
,
msg
);
});
socket
.
on
(
'
disconnect
'
,
function
(
reason
)
{
let
data
=
socket
.
playerData
;
...
...
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