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
71d38ba3
Commit
71d38ba3
authored
Jul 26, 2019
by
18손재민
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
암흑 단어 구현
parent
7d728b9e
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
46 additions
and
21 deletions
+46
-21
Client.js
js/Client.js
+1
-1
Input.js
js/Input.js
+6
-1
ScenesData.js
js/ScenesData.js
+2
-0
WordObject.js
js/WordObject.js
+22
-10
WordSpace.js
js/WordSpace.js
+15
-9
No files found.
js/Client.js
View file @
71d38ba3
...
@@ -154,7 +154,7 @@ socket.on('attacked', function(msg) // object attackData
...
@@ -154,7 +154,7 @@ socket.on('attacked', function(msg) // object attackData
let
attackedEvent
=
new
Cycle
(
function
()
let
attackedEvent
=
new
Cycle
(
function
()
{
{
if
(
!
WordSpace
.
isInvincible
)
if
(
!
WordSpace
.
isInvincible
)
for
(
let
i
=
0
;
i
<
msg
.
multiple
;
i
++
)
WordSpace
.
generateWord
.
Attack
(
ScenesData
.
gameScene
,
msg
.
text
,
msg
.
grade
,
msg
.
attacker
,
msg
.
isStrong
,
msg
.
isCountable
,
msg
.
isHeavy
);
for
(
let
i
=
0
;
i
<
msg
.
multiple
;
i
++
)
WordSpace
.
generateWord
.
Attack
(
ScenesData
.
gameScene
,
msg
.
text
,
msg
.
grade
,
msg
.
attacker
,
msg
.
attackOption
);
attackedEvent
.
currentCycle
.
destroy
();
attackedEvent
.
currentCycle
.
destroy
();
WordSpace
.
attackedEvents
.
splice
(
WordSpace
.
attackedEvents
.
findIndex
(
function
(
element
)
{
WordSpace
.
attackedEvents
.
splice
(
WordSpace
.
attackedEvents
.
findIndex
(
function
(
element
)
{
return
element
.
cert
===
(
msg
.
text
+
msg
.
attacker
);
return
element
.
cert
===
(
msg
.
text
+
msg
.
attacker
);
...
...
js/Input.js
View file @
71d38ba3
...
@@ -12,7 +12,12 @@ Input.justPressed = '';
...
@@ -12,7 +12,12 @@ Input.justPressed = '';
Input
.
maxInput
=
6
;
Input
.
maxInput
=
6
;
Input
.
attackMode
=
false
;
Input
.
attackMode
=
false
;
Input
.
attackOption
=
null
;
Input
.
attackOption
=
{
wordCount
:
0
,
wordGrade
:
0
,
isHeavy
:
false
,
isDark
:
false
};
Input
.
gameSceneEnterReaction
=
function
()
Input
.
gameSceneEnterReaction
=
function
()
{
{
...
...
js/ScenesData.js
View file @
71d38ba3
...
@@ -160,6 +160,8 @@ var gameScene = new Phaser.Class(
...
@@ -160,6 +160,8 @@ var gameScene = new Phaser.Class(
WordSpace
.
generateWord
.
Item
(
ScenesData
.
gameScene
,
Enums
.
item
.
clean
);
WordSpace
.
generateWord
.
Item
(
ScenesData
.
gameScene
,
Enums
.
item
.
clean
);
WordSpace
.
generateWord
.
Item
(
ScenesData
.
gameScene
,
Enums
.
item
.
heavy
);
WordSpace
.
generateWord
.
Item
(
ScenesData
.
gameScene
,
Enums
.
item
.
heavy
);
WordSpace
.
generateWord
.
Item
(
ScenesData
.
gameScene
,
Enums
.
item
.
heavy
);
WordSpace
.
generateWord
.
Item
(
ScenesData
.
gameScene
,
Enums
.
item
.
heavy
);
WordSpace
.
generateWord
.
Item
(
ScenesData
.
gameScene
,
Enums
.
item
.
dark
);
WordSpace
.
generateWord
.
Item
(
ScenesData
.
gameScene
,
Enums
.
item
.
dark
);
// for test
// for test
WordSpace
.
attackGauge
.
add
(
11
);
WordSpace
.
attackGauge
.
add
(
11
);
...
...
js/WordObject.js
View file @
71d38ba3
...
@@ -137,18 +137,19 @@ class NormalWord extends WordObject
...
@@ -137,18 +137,19 @@ class NormalWord extends WordObject
class
AttackWord
extends
WordObject
class
AttackWord
extends
WordObject
{
{
constructor
(
text
,
_wordGrade
,
_playerData
,
_
isStrong
,
_isCountable
=
true
,
_isHeavy
=
false
,
lenRate
)
constructor
(
text
,
_wordGrade
,
_playerData
,
_
attackOption
,
lenRate
)
{
{
super
(
text
);
super
(
text
);
this
.
wordGrade
=
_wordGrade
;
this
.
wordGrade
=
_wordGrade
;
this
.
wordWeight
=
_isStrong
?
WordReader
.
strongAttackWeight
[
3
-
this
.
wordGrade
]
:
WordReader
.
attackWeight
[
3
-
this
.
wordGrade
];
this
.
wordWeight
=
_
attackOption
.
isStrong
?
WordReader
.
strongAttackWeight
[
3
-
this
.
wordGrade
]
:
WordReader
.
attackWeight
[
3
-
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
+=
this
.
wordWeight
*
0.2
*
(
WordReader
.
getWordTyping
(
_playerData
.
nickname
)
-
9
);
if
(
_isHeavy
)
this
.
wordWeight
*=
2
;
if
(
_
attackOption
.
isHeavy
)
this
.
wordWeight
*=
2
;
this
.
attacker
=
_playerData
;
this
.
attacker
=
_playerData
;
if
(
!
_isCountable
)
this
.
counterTime
=
0
;
if
(
!
_
attackOption
.
isCountable
)
this
.
counterTime
=
0
;
else
this
.
counterTime
=
WordSpace
.
gameTimer
.
now
+
1000
*
(
this
.
wordTyping
<=
(
5
-
_wordGrade
)
*
2.5
?
this
.
wordTyping
/
(
Math
.
max
(
200
,
WordSpace
.
playerTyping
)
/
60
)
*
1.5
:
else
this
.
counterTime
=
WordSpace
.
gameTimer
.
now
+
1000
*
(
this
.
wordTyping
<=
(
5
-
_wordGrade
)
*
2.5
?
this
.
wordTyping
/
(
Math
.
max
(
200
,
WordSpace
.
playerTyping
)
/
60
)
*
1.5
:
((
5
-
_wordGrade
)
*
3
+
(
this
.
wordTyping
-
(
5
-
_wordGrade
)
*
2.5
)
*
2.5
)
/
(
Math
.
max
(
200
,
WordSpace
.
playerTyping
)
/
60
)
*
1.5
);
((
5
-
_wordGrade
)
*
3
+
(
this
.
wordTyping
-
(
5
-
_wordGrade
)
*
2.5
)
*
2.5
)
/
(
Math
.
max
(
200
,
WordSpace
.
playerTyping
)
/
60
)
*
1.5
);
this
.
isDark
=
_attackOption
.
isDark
;
console
.
log
(
'
Attack text :
'
+
text
+
'
, Attacker :
'
+
this
.
attacker
.
nickname
+
'
, Weight :
'
+
this
.
wordWeight
);
console
.
log
(
'
Attack text :
'
+
text
+
'
, Attacker :
'
+
this
.
attacker
.
nickname
+
'
, Weight :
'
+
this
.
wordWeight
);
console
.
log
(
'
Counter time :
'
+
this
.
counterTime
);
console
.
log
(
'
Counter time :
'
+
this
.
counterTime
);
}
}
...
@@ -157,16 +158,22 @@ class AttackWord extends WordObject
...
@@ -157,16 +158,22 @@ class AttackWord extends WordObject
super
.
instantiate
(
scene
,
lenRate
);
super
.
instantiate
(
scene
,
lenRate
);
this
.
maskBackground
=
scene
.
physics
.
add
.
sprite
(
this
.
physicsObj
.
x
,
this
.
physicsObj
.
y
,
'
wordBgr
'
+
this
.
wordGrade
+
'
_
'
+
Math
.
min
(
Math
.
max
(
2
,
this
.
wordText
.
length
),
6
))
this
.
maskBackground
=
scene
.
physics
.
add
.
sprite
(
this
.
physicsObj
.
x
,
this
.
physicsObj
.
y
,
'
wordBgr
'
+
this
.
wordGrade
+
'
_
'
+
Math
.
min
(
Math
.
max
(
2
,
this
.
wordText
.
length
),
6
))
.
setTint
(
Phaser
.
Display
.
Color
.
GetColor
(
120
,
120
,
120
)).
setScale
(
this
.
scale
);
.
setTint
(
Phaser
.
Display
.
Color
.
GetColor
(
120
,
120
,
120
)).
setScale
(
this
.
scale
);
this
.
maskBackground
.
alpha
=
0.5
;
this
.
maskBackground
.
alpha
=
this
.
isDark
?
1
:
0.5
;
this
.
shape
=
scene
.
make
.
graphics
();
this
.
shape
=
scene
.
make
.
graphics
();
var
rect
=
new
Phaser
.
Geom
.
Rectangle
(
0
,
0
,
this
.
maskBackground
.
width
*
this
.
scale
,
this
.
maskBackground
.
height
*
this
.
scale
);
var
rect
=
new
Phaser
.
Geom
.
Rectangle
(
0
,
0
,
this
.
maskBackground
.
width
*
this
.
scale
,
this
.
maskBackground
.
height
*
this
.
scale
);
this
.
shape
.
fillStyle
(
0xffffff
).
fillRectShape
(
rect
);
this
.
shape
.
fillStyle
(
0xffffff
).
fillRectShape
(
rect
);
this
.
mask
=
this
.
shape
.
createGeometryMask
();
this
.
mask
=
this
.
shape
.
createGeometryMask
();
this
.
maskBackground
.
setMask
(
this
.
mask
);
this
.
maskStart
=
this
.
physicsObj
.
x
;
this
.
maskStart
=
this
.
physicsObj
.
x
;
this
.
maskEnd
=
this
.
physicsObj
.
x
-
this
.
physicsObj
.
width
*
this
.
scale
;
this
.
maskEnd
=
this
.
physicsObj
.
x
-
this
.
physicsObj
.
width
*
this
.
scale
;
if
(
this
.
isDark
)
{
setTimeout
(()
=>
{
if
(
this
.
maskBackground
!=
null
&&
this
.
mask
!=
null
)
this
.
maskBackground
.
setMask
(
this
.
mask
);
},
4000
);
}
else
this
.
maskBackground
.
setMask
(
this
.
mask
);
}
}
attract
()
attract
()
...
@@ -205,8 +212,12 @@ class AttackWord extends WordObject
...
@@ -205,8 +212,12 @@ class AttackWord extends WordObject
target
:
this
.
attacker
.
id
,
target
:
this
.
attacker
.
id
,
text
:
this
.
wordText
,
text
:
this
.
wordText
,
grade
:
Math
.
min
(
3
,
this
.
wordGrade
+
1
),
grade
:
Math
.
min
(
3
,
this
.
wordGrade
+
1
),
attackOption
:
{
isStrong
:
false
,
isStrong
:
false
,
isCountable
:
false
isCountable
:
false
,
isHeavy
:
false
,
isDark
:
false
},
}
}
socket
.
emit
(
'
attack
'
,
attackData
);
socket
.
emit
(
'
attack
'
,
attackData
);
}
}
...
@@ -328,9 +339,10 @@ class ItemWord extends WordObject
...
@@ -328,9 +339,10 @@ class ItemWord extends WordObject
for
(
let
i
=
0
;
i
<
tempLenth
;
i
++
)
WordSpace
.
wordGroup
[
i
].
destroy
();
for
(
let
i
=
0
;
i
<
tempLenth
;
i
++
)
WordSpace
.
wordGroup
[
i
].
destroy
();
break
;
break
;
case
Enums
.
item
.
heavy
:
case
Enums
.
item
.
heavy
:
WordSpace
.
isHeavy
=
true
;
Input
.
attackOption
.
isHeavy
=
true
;
break
;
break
;
case
Enums
.
item
.
dark
:
case
Enums
.
item
.
dark
:
Input
.
attackOption
.
isDark
=
true
;
break
;
break
;
default
:
default
:
console
.
log
(
"
Item type is inappropriate. Item type :
"
+
this
.
itemType
);
console
.
log
(
"
Item type is inappropriate. Item type :
"
+
this
.
itemType
);
...
...
js/WordSpace.js
View file @
71d38ba3
...
@@ -13,7 +13,6 @@ WordSpace.brainCapacity = 200; //수용 가능한 단어 무게 최대치
...
@@ -13,7 +13,6 @@ WordSpace.brainCapacity = 200; //수용 가능한 단어 무게 최대치
WordSpace
.
gameTimer
=
null
;
//현재 게임 플레이 시간 타이머
WordSpace
.
gameTimer
=
null
;
//현재 게임 플레이 시간 타이머
WordSpace
.
isTimerOn
=
false
;
WordSpace
.
isTimerOn
=
false
;
WordSpace
.
isInvincible
=
false
;
WordSpace
.
isInvincible
=
false
;
WordSpace
.
isHeavy
=
false
;
WordSpace
.
pyeongminAnims
=
[];
WordSpace
.
pyeongminAnims
=
[];
WordSpace
.
wordGroup
=
[];
WordSpace
.
wordGroup
=
[];
...
@@ -236,9 +235,9 @@ WordSpace.generateWord =
...
@@ -236,9 +235,9 @@ WordSpace.generateWord =
WordSpace
.
pushWord
(
scene
,
word
,
lenRate
);
WordSpace
.
pushWord
(
scene
,
word
,
lenRate
);
return
word
;
return
word
;
},
},
Attack
:
function
(
scene
,
wordText
,
grade
,
attacker
,
isStrong
,
isCountable
,
isHeavy
,
lenRate
)
Attack
:
function
(
scene
,
wordText
,
grade
,
attacker
,
attackOption
,
lenRate
)
{
{
word
=
new
AttackWord
(
wordText
,
grade
,
attacker
,
isStrong
,
isCountable
,
isHeavy
);
word
=
new
AttackWord
(
wordText
,
grade
,
attacker
,
attackOption
);
WordSpace
.
pushWord
(
scene
,
word
,
lenRate
);
WordSpace
.
pushWord
(
scene
,
word
,
lenRate
);
return
word
;
return
word
;
},
},
...
@@ -333,13 +332,15 @@ WordSpace.findWord = function(wordText)
...
@@ -333,13 +332,15 @@ WordSpace.findWord = function(wordText)
else
if
(
wordText
===
'
공격
'
&&
WordSpace
.
attackGauge
.
value
>=
3
&&
WordSpace
.
nameGroup
.
length
>
0
)
// 공격모드 진입.
else
if
(
wordText
===
'
공격
'
&&
WordSpace
.
attackGauge
.
value
>=
3
&&
WordSpace
.
nameGroup
.
length
>
0
)
// 공격모드 진입.
{
{
console
.
log
(
'
attack mode
'
);
console
.
log
(
'
attack mode
'
);
Input
.
attackOption
=
this
.
attackGauge
.
getAttackOption
();
let
tempAttackOption
=
this
.
attackGauge
.
getAttackOption
();
Input
.
attackOption
.
wordCount
=
tempAttackOption
.
wordCount
;
Input
.
attackOption
.
wordGrade
=
tempAttackOption
.
wordGrade
;
Input
.
maxInput
=
Input
.
attackOption
.
wordCount
;
Input
.
maxInput
=
Input
.
attackOption
.
wordCount
;
Input
.
attackMode
=
true
;
Input
.
attackMode
=
true
;
WordSpace
.
attackGauge
.
pauseCycle
(
true
);
WordSpace
.
attackGauge
.
pauseCycle
(
true
);
WordSpace
.
setPlayerTyping
.
add
(
wordText
);
WordSpace
.
setPlayerTyping
.
add
(
wordText
);
RoomData
.
myself
.
playerImage
.
play
(
WordSpace
.
pyeongminAnims
[
Enums
.
characterAnim
.
attackWrite
]);
RoomData
.
myself
.
playerImage
.
play
(
WordSpace
.
pyeongminAnims
[
Enums
.
characterAnim
.
attackWrite
]);
RoomData
.
myself
.
playerImage
.
anims
.
msPerFrame
/=
(
4
-
WordSpace
.
attackGauge
.
getAttackOption
()
.
wordGrade
);
RoomData
.
myself
.
playerImage
.
anims
.
msPerFrame
/=
(
4
-
Input
.
attackOption
.
wordGrade
);
}
}
else
// 오타 체크
else
// 오타 체크
{
{
...
@@ -421,8 +422,12 @@ WordSpace.attack = function(wordText, grade)
...
@@ -421,8 +422,12 @@ WordSpace.attack = function(wordText, grade)
victim
:
target
,
victim
:
target
,
text
:
wordText
,
text
:
wordText
,
grade
:
grade
,
grade
:
grade
,
attackOption
:
{
isStrong
:
element
.
isStrong
,
isStrong
:
element
.
isStrong
,
isHeavy
:
WordSpace
.
isHeavy
,
isCountable
:
true
,
isHeavy
:
Input
.
attackOption
.
isHeavy
,
isDark
:
Input
.
attackOption
.
isDark
},
multiple
:
1
multiple
:
1
}
}
WordSpace
.
makeAttackPaper
(
ScenesData
.
gameScene
,
RoomData
.
myself
.
position
,
target
.
position
);
WordSpace
.
makeAttackPaper
(
ScenesData
.
gameScene
,
RoomData
.
myself
.
position
,
target
.
position
);
...
@@ -443,7 +448,8 @@ WordSpace.attack = function(wordText, grade)
...
@@ -443,7 +448,8 @@ WordSpace.attack = function(wordText, grade)
WordSpace
.
attackGauge
.
resetValue
();
WordSpace
.
attackGauge
.
resetValue
();
WordSpace
.
setPlayerTyping
.
add
(
wordText
);
WordSpace
.
setPlayerTyping
.
add
(
wordText
);
RoomData
.
myself
.
playerImage
.
play
(
WordSpace
.
pyeongminAnims
[
Enums
.
characterAnim
.
throw
]);
RoomData
.
myself
.
playerImage
.
play
(
WordSpace
.
pyeongminAnims
[
Enums
.
characterAnim
.
throw
]);
WordSpace
.
isHeavy
=
false
;
Input
.
attackOption
.
isHeavy
=
false
;
Input
.
attackOption
.
isDark
=
false
;
}
}
else
WordSpace
.
attackGauge
.
cutValue
(
0.3
);
else
WordSpace
.
attackGauge
.
cutValue
(
0.3
);
Input
.
maxInput
=
6
;
Input
.
maxInput
=
6
;
...
...
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