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
daa7b642
Commit
daa7b642
authored
Jul 21, 2019
by
18손재민
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
이제 공격 시 종이 뭉치가 날아감
parent
8e41673e
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
82 additions
and
36 deletions
+82
-36
Background.js
js/Background.js
+1
-1
ScenesData.js
js/ScenesData.js
+14
-0
WordObject.js
js/WordObject.js
+3
-0
WordReader.js
js/WordReader.js
+33
-3
WordSpace.js
js/WordSpace.js
+31
-32
No files found.
js/Background.js
View file @
daa7b642
...
@@ -31,7 +31,7 @@ BackGround.drawCharacter = function(scene)
...
@@ -31,7 +31,7 @@ BackGround.drawCharacter = function(scene)
element
.
playerImage
.
flipX
=
element
.
position
.
x
<
game
.
config
.
width
/
2
?
true
:
false
;
element
.
playerImage
.
flipX
=
element
.
position
.
x
<
game
.
config
.
width
/
2
?
true
:
false
;
element
.
nicknameText
=
scene
.
add
.
text
(
element
.
position
.
x
,
element
.
position
.
y
-
90
,
element
.
nickname
)
element
.
nicknameText
=
scene
.
add
.
text
(
element
.
position
.
x
,
element
.
position
.
y
-
90
,
element
.
nickname
)
.
setOrigin
(
0.5
,
0.5
).
setColor
(
'
#000000
'
).
setPadding
(
0.5
,
0.5
,
0.5
,
0.5
).
setDepth
(
1
);
.
setOrigin
(
0.5
,
0.5
).
setColor
(
'
#000000
'
).
setPadding
(
0.5
,
0.5
,
0.5
,
0.5
).
setDepth
(
1
);
}
6
}
});
});
}
}
...
...
js/ScenesData.js
View file @
daa7b642
...
@@ -153,6 +153,17 @@ var gameScene = new Phaser.Class(
...
@@ -153,6 +153,17 @@ var gameScene = new Phaser.Class(
// for test
// for test
WordSpace
.
attackGauge
.
add
(
11
);
WordSpace
.
attackGauge
.
add
(
11
);
WordSpace
.
generateWord
.
Name
(
ScenesData
.
gameScene
,
false
,
null
);
WordSpace
.
generateWord
.
Name
(
ScenesData
.
gameScene
,
false
,
null
);
WordSpace
.
generateWord
.
Name
(
ScenesData
.
gameScene
,
false
,
null
);
WordSpace
.
generateWord
.
Name
(
ScenesData
.
gameScene
,
false
,
null
);
WordSpace
.
generateWord
.
Name
(
ScenesData
.
gameScene
,
false
,
null
);
WordSpace
.
generateWord
.
Name
(
ScenesData
.
gameScene
,
false
,
null
);
WordSpace
.
generateWord
.
Name
(
ScenesData
.
gameScene
,
false
,
null
);
WordSpace
.
generateWord
.
Name
(
ScenesData
.
gameScene
,
false
,
null
);
WordSpace
.
generateWord
.
Name
(
ScenesData
.
gameScene
,
false
,
null
);
WordSpace
.
generateWord
.
Name
(
ScenesData
.
gameScene
,
false
,
null
);
WordSpace
.
generateWord
.
Name
(
ScenesData
.
gameScene
,
false
,
null
);
},
},
update
:
function
()
update
:
function
()
...
@@ -172,6 +183,9 @@ var gameScene = new Phaser.Class(
...
@@ -172,6 +183,9 @@ var gameScene = new Phaser.Class(
//테스트용
//테스트용
tempNames
+=
element
.
wordText
+
(
element
.
isStrong
?
'
[강]
'
:
''
)
+
'
\n
'
;
tempNames
+=
element
.
wordText
+
(
element
.
isStrong
?
'
[강]
'
:
''
)
+
'
\n
'
;
});
});
WordSpace
.
attackPaperGroup
.
forEach
(
function
(
element
){
element
.
moveObject
(
element
);
});
WordSpace
.
nameWordTextForTest
.
setText
(
'
현재 가진 호패들 :
\n
'
+
tempNames
);
WordSpace
.
nameWordTextForTest
.
setText
(
'
현재 가진 호패들 :
\n
'
+
tempNames
);
WordSpace
.
weightTextObjForTest
.
setText
(
'
뇌의 무게: (현재)
'
+
WordSpace
.
totalWeight
+
'
/
'
+
WordSpace
.
brainCapacity
+
'
(전체)
'
);
WordSpace
.
weightTextObjForTest
.
setText
(
'
뇌의 무게: (현재)
'
+
WordSpace
.
totalWeight
+
'
/
'
+
WordSpace
.
brainCapacity
+
'
(전체)
'
);
...
...
js/WordObject.js
View file @
daa7b642
...
@@ -276,6 +276,9 @@ class NameWord extends WordObject
...
@@ -276,6 +276,9 @@ class NameWord extends WordObject
duration
:
2000
,
duration
:
2000
,
repeat
:
0
repeat
:
0
});
});
/*setTimeout(() => {
WordSpace.movingObjects.pop();
}, 2000);*/
//이동경로 디버그
//이동경로 디버그
/*var graphics = ScenesData.gameScene.add.graphics();
/*var graphics = ScenesData.gameScene.add.graphics();
...
...
js/WordReader.js
View file @
daa7b642
var
WordReader
=
WordReader
||
{};
var
WordReader
=
WordReader
||
{};
WordReader
.
normalWeight
=
[
3
,
5
,
7
,
10
];
WordReader
.
attackWeight
=
[
6
,
8
,
12
,
15
];
WordReader
.
strongAttackWeight
=
[
10
,
13
,
16
,
20
];
//초성의 타수를 반환함
//초성의 타수를 반환함
WordReader
.
firstSound
=
function
(
charText
)
WordReader
.
firstSound
=
function
(
charText
)
{
{
...
@@ -54,6 +58,32 @@ WordReader.getWordGrade = function(_wordTyping)
...
@@ -54,6 +58,32 @@ WordReader.getWordGrade = function(_wordTyping)
17
<=
_wordTyping
&&
_wordTyping
<
26
?
0
:
-
1
;
17
<=
_wordTyping
&&
_wordTyping
<
26
?
0
:
-
1
;
}
}
WordReader
.
normalWeight
=
[
3
,
5
,
7
,
10
];
WordReader
.
getEditDistance
=
function
(
input
,
check
)
{
WordReader
.
attackWeight
=
[
6
,
8
,
12
,
15
];
var
inputWords
=
[],
checkWords
=
[]
WordReader
.
strongAttackWeight
=
[
10
,
13
,
16
,
20
];
for
(
let
i
=
0
;
i
<
input
.
length
;
i
++
)
\ No newline at end of file
{
inputWords
.
push
(
parseInt
(((
input
[
i
].
charCodeAt
(
0
)
-
parseInt
(
'
0xac00
'
,
16
))
/
28
)
/
21
)
+
parseInt
(
'
0x1100
'
,
16
));
inputWords
.
push
(
parseInt
(((
input
[
i
].
charCodeAt
(
0
)
-
parseInt
(
'
0xac00
'
,
16
))
/
28
)
%
21
)
+
parseInt
(
'
0x1161
'
,
16
));
inputWords
.
push
(
parseInt
((
input
[
i
].
charCodeAt
(
0
)
-
parseInt
(
'
0xac00
'
,
16
))
%
28
)
+
parseInt
(
'
0x11A8
'
)
-
1
);
}
for
(
let
i
=
0
;
i
<
check
.
length
;
i
++
)
{
checkWords
.
push
(
parseInt
(((
check
[
i
].
charCodeAt
(
0
)
-
parseInt
(
'
0xac00
'
,
16
))
/
28
)
/
21
)
+
parseInt
(
'
0x1100
'
,
16
));
checkWords
.
push
(
parseInt
(((
check
[
i
].
charCodeAt
(
0
)
-
parseInt
(
'
0xac00
'
,
16
))
/
28
)
%
21
)
+
parseInt
(
'
0x1161
'
,
16
));
checkWords
.
push
(
parseInt
((
check
[
i
].
charCodeAt
(
0
)
-
parseInt
(
'
0xac00
'
,
16
))
%
28
)
+
parseInt
(
'
0x11A8
'
)
-
1
);
}
var
matrix
=
[];
var
i
,
j
;
for
(
i
=
0
;
i
<=
checkWords
.
length
;
i
++
)
// increment along the first column of each row
matrix
[
i
]
=
[
i
];
for
(
j
=
0
;
j
<=
inputWords
.
length
;
j
++
)
// increment each column in the first row
matrix
[
0
][
j
]
=
j
;
for
(
i
=
1
;
i
<=
checkWords
.
length
;
i
++
)
// Fill in the rest of the matrix
for
(
j
=
1
;
j
<=
inputWords
.
length
;
j
++
){
if
(
checkWords
[
i
-
1
]
==
inputWords
[
j
-
1
])
matrix
[
i
][
j
]
=
matrix
[
i
-
1
][
j
-
1
];
else
matrix
[
i
][
j
]
=
Math
.
min
(
matrix
[
i
-
1
][
j
-
1
]
+
1
,
// substitution
Math
.
min
(
matrix
[
i
][
j
-
1
]
+
1
,
// insertion
matrix
[
i
-
1
][
j
]
+
1
));
// deletion
}
return
matrix
[
checkWords
.
length
][
inputWords
.
length
];
}
\ No newline at end of file
js/WordSpace.js
View file @
daa7b642
...
@@ -16,6 +16,7 @@ WordSpace.pyeongminAnims = [];
...
@@ -16,6 +16,7 @@ WordSpace.pyeongminAnims = [];
WordSpace
.
wordGroup
=
[];
WordSpace
.
wordGroup
=
[];
WordSpace
.
nameGroup
=
[];
WordSpace
.
nameGroup
=
[];
WordSpace
.
attackPaperGroup
=
[];
WordSpace
.
wordForcedGroup
=
[];
WordSpace
.
wordForcedGroup
=
[];
WordSpace
.
wordPhysicsGroup
=
null
;
WordSpace
.
wordPhysicsGroup
=
null
;
...
@@ -196,6 +197,7 @@ WordSpace.loadImage = function(scene)
...
@@ -196,6 +197,7 @@ WordSpace.loadImage = function(scene)
scene
.
load
.
spritesheet
(
'
wordBreak
'
,
'
assets/image/word/wordbreak.png
'
,
{
frameWidth
:
180
,
frameHeight
:
180
});
scene
.
load
.
spritesheet
(
'
wordBreak
'
,
'
assets/image/word/wordbreak.png
'
,
{
frameWidth
:
180
,
frameHeight
:
180
});
scene
.
load
.
spritesheet
(
'
pyeongminWrite
'
,
'
assets/image/character/pyeongmin/write/pyeong_write.png
'
,
{
frameWidth
:
490
,
frameHeight
:
423
});
scene
.
load
.
spritesheet
(
'
pyeongminWrite
'
,
'
assets/image/character/pyeongmin/write/pyeong_write.png
'
,
{
frameWidth
:
490
,
frameHeight
:
423
});
scene
.
load
.
spritesheet
(
'
pyeongminThrow
'
,
'
assets/image/character/pyeongmin/throw/pyeong_throw.png
'
,
{
frameWidth
:
490
,
frameHeight
:
423
});
scene
.
load
.
spritesheet
(
'
pyeongminThrow
'
,
'
assets/image/character/pyeongmin/throw/pyeong_throw.png
'
,
{
frameWidth
:
490
,
frameHeight
:
423
});
scene
.
load
.
image
(
'
attackPapaer
'
,
'
assets/image/etc/paper_crumbled.png
'
);
WordSpace
.
weightTextObjForTest
=
scene
.
add
.
text
(
100
,
75
,
'
뇌의 무게: (현재) 0 /
'
+
this
.
brainCapacity
+
'
(전체)
'
).
setDepth
(
10
).
setColor
(
'
#000000
'
);
WordSpace
.
weightTextObjForTest
=
scene
.
add
.
text
(
100
,
75
,
'
뇌의 무게: (현재) 0 /
'
+
this
.
brainCapacity
+
'
(전체)
'
).
setDepth
(
10
).
setColor
(
'
#000000
'
);
WordSpace
.
killLogTextForTest
=
scene
.
add
.
text
(
1000
,
50
,
WordSpace
.
killLogForTest
).
setDepth
(
10
).
setColor
(
'
#000000
'
).
setAlign
(
'
right
'
);
WordSpace
.
killLogTextForTest
=
scene
.
add
.
text
(
1000
,
50
,
WordSpace
.
killLogForTest
).
setDepth
(
10
).
setColor
(
'
#000000
'
).
setAlign
(
'
right
'
);
...
@@ -345,14 +347,14 @@ WordSpace.findWord = function(wordText)
...
@@ -345,14 +347,14 @@ WordSpace.findWord = function(wordText)
{
{
if
(
element
instanceof
AttackWord
)
if
(
element
instanceof
AttackWord
)
{
{
tempDist
=
Word
Space
.
getEditDistance
(
wordText
,
element
.
wordText
);
tempDist
=
Word
Reader
.
getEditDistance
(
wordText
,
element
.
wordText
);
attackWords
.
push
(
element
);
attackWords
.
push
(
element
);
if
(
tempDist
<=
minDist
)
minDist
=
tempDist
;
if
(
tempDist
<=
minDist
)
minDist
=
tempDist
;
}
}
});
});
attackWords
.
some
(
function
(
element
)
attackWords
.
some
(
function
(
element
)
{
{
if
(
Word
Space
.
getEditDistance
(
wordText
,
element
.
wordText
)
==
minDist
)
if
(
Word
Reader
.
getEditDistance
(
wordText
,
element
.
wordText
)
==
minDist
)
{
{
console
.
log
(
'
Attack word :
'
+
element
.
wordText
+
'
of
'
+
element
.
attacker
.
nickname
+
'
오타임
'
);
console
.
log
(
'
Attack word :
'
+
element
.
wordText
+
'
of
'
+
element
.
attacker
.
nickname
+
'
오타임
'
);
let
victimData
=
let
victimData
=
...
@@ -405,6 +407,33 @@ WordSpace.attack = function(wordText, grade)
...
@@ -405,6 +407,33 @@ WordSpace.attack = function(wordText, grade)
socket
.
emit
(
'
attack
'
,
attackData
);
socket
.
emit
(
'
attack
'
,
attackData
);
element
.
physicsObj
.
destroy
();
element
.
physicsObj
.
destroy
();
element
.
wordObj
.
destroy
();
element
.
wordObj
.
destroy
();
var
attackPaper
=
ScenesData
.
gameScene
.
add
.
sprite
(
BackGround
.
myCharacter
.
x
,
BackGround
.
myCharacter
.
y
,
'
attackPapaer
'
).
setScale
(
0.5
).
setDepth
(
3
);
attackPaper
.
throwTarget
=
RoomData
.
players
.
find
(
function
(
_element
)
{
return
_element
.
id
==
element
.
ownerId
;
}).
playerImage
;
attackPaper
.
follower
=
{
t
:
0
,
vec
:
new
Phaser
.
Math
.
Vector2
()
};
attackPaper
.
path
=
new
Phaser
.
Curves
.
Spline
([
BackGround
.
myCharacter
.
x
,
BackGround
.
myCharacter
.
y
,
(
BackGround
.
myCharacter
.
x
+
attackPaper
.
throwTarget
.
x
)
/
2
,
Math
.
min
(
BackGround
.
myCharacter
.
y
,
attackPaper
.
throwTarget
.
y
)
-
100
,
attackPaper
.
throwTarget
.
x
,
attackPaper
.
throwTarget
.
y
-
10
]);
ScenesData
.
gameScene
.
tweens
.
add
({
targets
:
attackPaper
.
follower
,
t
:
1
,
ease
:
'
Linear
'
,
duration
:
4000
,
repeat
:
0
,
onComplete
:
function
()
{
attackPaper
.
destroy
();
WordSpace
.
attackPaperGroup
=
[];
}
});
attackPaper
.
moveObject
=
function
(
obj
)
{
obj
.
path
.
getPoint
(
obj
.
follower
.
t
,
obj
.
follower
.
vec
);
obj
.
setPosition
(
obj
.
follower
.
vec
.
x
,
obj
.
follower
.
vec
.
y
);
}
WordSpace
.
attackPaperGroup
.
push
(
attackPaper
);
});
});
WordSpace
.
generateWord
.
Name
(
ScenesData
.
gameScene
,
false
,
null
);
WordSpace
.
generateWord
.
Name
(
ScenesData
.
gameScene
,
false
,
null
);
WordSpace
.
generateWord
.
Name
(
ScenesData
.
gameScene
,
false
,
null
);
WordSpace
.
generateWord
.
Name
(
ScenesData
.
gameScene
,
false
,
null
);
...
@@ -449,33 +478,3 @@ WordSpace.nameQueue =
...
@@ -449,33 +478,3 @@ WordSpace.nameQueue =
this
.
shuffle
();
this
.
shuffle
();
}
}
}
}
WordSpace
.
getEditDistance
=
function
(
input
,
check
)
{
var
inputWords
=
[],
checkWords
=
[]
for
(
let
i
=
0
;
i
<
input
.
length
;
i
++
)
{
inputWords
.
push
(
parseInt
(((
input
[
i
].
charCodeAt
(
0
)
-
parseInt
(
'
0xac00
'
,
16
))
/
28
)
/
21
)
+
parseInt
(
'
0x1100
'
,
16
));
inputWords
.
push
(
parseInt
(((
input
[
i
].
charCodeAt
(
0
)
-
parseInt
(
'
0xac00
'
,
16
))
/
28
)
%
21
)
+
parseInt
(
'
0x1161
'
,
16
));
inputWords
.
push
(
parseInt
((
input
[
i
].
charCodeAt
(
0
)
-
parseInt
(
'
0xac00
'
,
16
))
%
28
)
+
parseInt
(
'
0x11A8
'
)
-
1
);
}
for
(
let
i
=
0
;
i
<
check
.
length
;
i
++
)
{
checkWords
.
push
(
parseInt
(((
check
[
i
].
charCodeAt
(
0
)
-
parseInt
(
'
0xac00
'
,
16
))
/
28
)
/
21
)
+
parseInt
(
'
0x1100
'
,
16
));
checkWords
.
push
(
parseInt
(((
check
[
i
].
charCodeAt
(
0
)
-
parseInt
(
'
0xac00
'
,
16
))
/
28
)
%
21
)
+
parseInt
(
'
0x1161
'
,
16
));
checkWords
.
push
(
parseInt
((
check
[
i
].
charCodeAt
(
0
)
-
parseInt
(
'
0xac00
'
,
16
))
%
28
)
+
parseInt
(
'
0x11A8
'
)
-
1
);
}
var
matrix
=
[];
var
i
,
j
;
for
(
i
=
0
;
i
<=
checkWords
.
length
;
i
++
)
// increment along the first column of each row
matrix
[
i
]
=
[
i
];
for
(
j
=
0
;
j
<=
inputWords
.
length
;
j
++
)
// increment each column in the first row
matrix
[
0
][
j
]
=
j
;
for
(
i
=
1
;
i
<=
checkWords
.
length
;
i
++
)
// Fill in the rest of the matrix
for
(
j
=
1
;
j
<=
inputWords
.
length
;
j
++
){
if
(
checkWords
[
i
-
1
]
==
inputWords
[
j
-
1
])
matrix
[
i
][
j
]
=
matrix
[
i
-
1
][
j
-
1
];
else
matrix
[
i
][
j
]
=
Math
.
min
(
matrix
[
i
-
1
][
j
-
1
]
+
1
,
// substitution
Math
.
min
(
matrix
[
i
][
j
-
1
]
+
1
,
// insertion
matrix
[
i
-
1
][
j
]
+
1
));
// deletion
}
return
matrix
[
checkWords
.
length
][
inputWords
.
length
];
}
\ No newline at end of file
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