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
842dd18f
Commit
842dd18f
authored
Jun 27, 2019
by
18신대성
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
단어 치고 엔터치면 단어블럭이 없어짐.
parent
d820b053
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
27 additions
and
20 deletions
+27
-20
index.html
index.html
+1
-1
Input.js
js/Input.js
+11
-14
WordObject.js
js/WordObject.js
+3
-5
WordSpace.js
js/WordSpace.js
+12
-0
No files found.
index.html
View file @
842dd18f
...
...
@@ -4,7 +4,7 @@
<meta
charset=
"utf-8"
/>
<script
src=
"/socket.io/socket.io.js"
></script>
<script
src=
"js/phaser.js"
></script>
<script
src=
"js/Background.js"
></script>
]
<script
src=
"js/Background.js"
></script>
<script
src=
"js/Input.js"
></script>
<script
src=
"js/WordSpace.js"
></script>
<script
src=
"js/WordObject.js"
></script>
...
...
js/Input.js
View file @
842dd18f
var
Input
=
Input
||
{};
Input
.
input
=
[];
Input
.
convInput
=
""
;
// converted input
Input
.
convInput
=
''
;
// converted input
Input
.
isShifted
=
false
;
Input
.
pressCount
=
0
;
Input
.
justPressed
=
''
;
Input
.
reset
=
function
()
{
Input
.
input
=
[];
Input
.
convInput
=
[];
Input
.
inputField
.
text
.
setText
(
Input
.
convInput
);
console
.
log
(
Input
.
input
);
}
// convert input to convInput
...
...
@@ -25,7 +25,7 @@ Input.convert = function()
// 쌍자음, Shift쓰는 모음 체크
if
(
this
.
input
[
i
]
<
0
)
{
console
.
log
(
-
1
*
this
.
input
[
i
]);
//
console.log(-1 * this.input[i]);
switch
(
String
.
fromCharCode
(
-
1
*
this
.
input
[
i
]))
{
case
'
ㅂ
'
:
krInput
+=
'
ㅃ
'
;
break
;
...
...
@@ -60,7 +60,7 @@ Input.convert = function()
if
(
this
.
input
[
i
]
>=
'
ㅏ
'
.
charCodeAt
(
0
))
vowels
.
push
(
krInput
.
length
-
1
);
// 모음일 경우
}
}
console
.
log
(
vowels
);
//
console.log(vowels);
this
.
convInput
=
""
;
let
vowelIdx
=
0
;
...
...
@@ -150,7 +150,7 @@ Input.convert = function()
}
}
}
console
.
log
(
'
__________
'
);
console
.
log
(
'
_____
end_convert
_____
'
);
}
Input
.
convertToLast
=
function
(
word
)
...
...
@@ -181,11 +181,8 @@ Input.convertToLast = function(word)
Input
.
convertToCharCode
=
function
(
first
,
middle
,
last
)
{
// 'last' must be code of last words
console
.
log
(
first
+
'
'
+
(
middle
.
charCodeAt
(
0
)
-
'
ㅏ
'
.
charCodeAt
(
0
))
+
'
'
+
last
);
var
returnCode
=
0xac00
+
28
*
21
*
first
+
28
*
(
middle
.
charCodeAt
(
0
)
-
'
ㅏ
'
.
charCodeAt
(
0
))
+
last
;
console
.
log
(
returnCode
);
return
returnCode
;
// 'last' and 'first' must be code of last words
return
0xac00
+
28
*
21
*
first
+
28
*
(
middle
.
charCodeAt
(
0
)
-
'
ㅏ
'
.
charCodeAt
(
0
))
+
last
;
}
Input
.
combineLast
=
function
(
left
,
right
)
...
...
@@ -250,7 +247,7 @@ Input.inputField =
this
.
background
=
scene
.
add
.
sprite
(
400
,
500
,
'
inputFieldBackground
'
).
setScale
(
0.2
);
this
.
text
=
scene
.
add
.
text
(
400
,
500
,
"
안녕하세요
"
,
{
font
:
'
15pt 궁서
'
}).
setOrigin
(
0.5
,
0.5
).
setColor
(
'
#000000
'
);
scene
.
input
.
keyboard
.
on
(
'
keyup
'
,
function
()
{
Input
.
pressCount
--
})
scene
.
input
.
keyboard
.
on
(
'
keyup
'
,
function
()
{
Input
.
pressCount
--
;
Input
.
justPressed
=
''
})
scene
.
input
.
keyboard
.
on
(
'
keydown-SHIFT
'
,
function
()
{
Input
.
isShifted
=
true
});
scene
.
input
.
keyboard
.
on
(
'
keyup-SHIFT
'
,
function
()
{
Input
.
isShifted
=
false
});
scene
.
input
.
keyboard
.
on
(
'
keydown-DELETE
'
,
function
()
{
Input
.
reset
()});
...
...
@@ -261,13 +258,12 @@ Input.inputField =
Input
.
input
.
pop
();
Input
.
convert
();
Input
.
inputField
.
text
.
setText
(
Input
.
convInput
);
console
.
log
(
Input
.
input
);
}
});
scene
.
input
.
keyboard
.
on
(
'
keydown-ENTER
'
,
function
()
{
WordSpace
.
findWord
(
Input
.
convInput
);
Input
.
reset
();
// do something
});
// upside 10 keys
scene
.
input
.
keyboard
.
on
(
'
keydown-Q
'
,
function
()
{
Input
.
pushInput
(
'
ㅂ
'
)});
...
...
@@ -307,8 +303,9 @@ Input.inputField =
Input
.
pushInput
=
function
(
inputKey
)
{
if
(
this
.
pressCount
<
3
)
if
(
this
.
justPressed
!=
inputKey
)
{
this
.
justPressed
=
inputKey
;
let
output
;
if
(
Input
.
isShifted
)
{
...
...
js/WordObject.js
View file @
842dd18f
...
...
@@ -38,6 +38,7 @@ class WordObject
destroy
()
{
console
.
log
(
this
.
generationCode
+
'
:
'
+
this
.
wordText
+
'
destroyed
'
);
this
.
wordObj
.
destroy
();
const
groupIdx
=
WordSpace
.
wordGroup
.
findIndex
(
function
(
item
)
{
return
this
.
isEqualObject
(
item
.
generationCode
)},
this
);
if
(
groupIdx
>
-
1
)
WordSpace
.
wordGroup
.
splice
(
groupIdx
,
1
);
...
...
@@ -62,16 +63,13 @@ class WordObject
isEqualObject
(
_generationCode
)
{
return
_generationCode
===
this
.
_
generationCode
;
return
_generationCode
===
this
.
generationCode
;
}
//***********ToDo*************
isEqual
(
inputWord
)
{
if
(
inputWord
===
this
.
wordText
)
{
this
.
destroy
();
}
return
this
.
wordText
===
inputWord
;
}
//****************************
}
...
...
js/WordSpace.js
View file @
842dd18f
...
...
@@ -50,4 +50,16 @@ WordSpace.generateWord = function(scene)
scene
.
physics
.
add
.
collider
(
word
.
physicsObj
,
WordSpace
.
wordPhysicsGroup
);
scene
.
physics
.
add
.
collider
(
word
.
physicsObj
,
BackGround
.
brainGroup
);
WordSpace
.
wordPhysicsGroup
.
add
(
word
.
physicsObj
);
}
WordSpace
.
findWord
=
function
(
word
)
{
var
found
=
WordSpace
.
wordGroup
.
find
(
function
(
element
)
{
return
element
.
isEqual
(
word
);
});
if
(
found
!=
undefined
)
{
found
.
destroy
();
}
}
\ 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