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
21bb0da7
Commit
21bb0da7
authored
Jul 18, 2019
by
18신대성
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'word'
parents
11a48a49
609fdfc3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
13 deletions
+32
-13
Input.js
js/Input.js
+32
-13
No files found.
js/Input.js
View file @
21bb0da7
var
Input
=
Input
||
{};
Input
.
input
=
[];
Input
.
converted
=
''
;
Input
.
convInput
=
''
;
// converted input
Input
.
finalInput
=
''
;
Input
.
isShifted
=
false
;
Input
.
isEntered
=
false
;
...
...
@@ -16,19 +18,19 @@ Input.gameSceneEnterReaction = function()
{
if
(
!
Input
.
isEntered
)
{
if
(
Input
.
attackMode
)
WordSpace
.
attack
(
Input
.
removeConVow
(
Input
.
conv
Input
),
Input
.
attackOption
.
wordGrade
);
else
WordSpace
.
findWord
(
Input
.
conv
Input
);
if
(
Input
.
attackMode
)
WordSpace
.
attack
(
Input
.
removeConVow
(
Input
.
final
Input
),
Input
.
attackOption
.
wordGrade
);
else
WordSpace
.
findWord
(
Input
.
final
Input
);
Input
.
reset
();
Input
.
isEntered
=
true
;
}
}
Input
.
menuSceneEnterReaction
=
function
()
{
Input
.
convInput
=
Input
.
removeConVow
(
Input
.
conv
Input
);
if
(
Input
.
conv
Input
.
length
>
1
)
Input
.
finalInput
=
Input
.
removeConVow
(
Input
.
final
Input
);
if
(
Input
.
final
Input
.
length
>
1
)
{
socket
.
emit
(
'
setNickname
'
,
Input
.
conv
Input
);
PlayerData
.
nickname
=
Input
.
conv
Input
;
socket
.
emit
(
'
setNickname
'
,
Input
.
final
Input
);
PlayerData
.
nickname
=
Input
.
final
Input
;
Input
.
reset
();
}
else
...
...
@@ -41,11 +43,13 @@ Input.menuSceneEnterReaction = function()
Input
.
reset
=
function
()
{
Input
.
input
=
[];
Input
.
convInput
=
[];
Input
.
inputField
.
text
.
setText
(
Input
.
convInput
);
Input
.
converted
=
''
;
Input
.
convInput
=
''
;
Input
.
finalInput
=
''
;
Input
.
inputField
.
text
.
setText
(
Input
.
finalInput
);
}
// convert input to
conv
Input
// convert input to
final
Input
Input
.
convert
=
function
()
{
// input -> krInput with vowels
...
...
@@ -95,7 +99,7 @@ Input.convert = function()
//console.log(vowels);
//console.log(krInput);
this
.
convInput
=
""
;
this
.
convInput
=
''
;
let
vowelIdx
=
0
;
if
(
vowelIdx
===
vowels
.
length
)
this
.
convInput
=
krInput
;
// 모음이 없을때
else
// 모음이 존재할때
...
...
@@ -193,6 +197,14 @@ Input.convert = function()
}
}
}
if
(
this
.
convInput
.
length
>
1
)
{
if
(
this
.
convInput
[
1
].
charCodeAt
(
0
)
>
'
가
'
.
charCodeAt
(
0
))
Input
.
input
.
splice
(
0
,
this
.
input
.
length
-
2
);
else
Input
.
input
.
splice
(
0
,
this
.
input
.
length
-
1
);
this
.
converted
+=
this
.
convInput
.
slice
(
0
,
1
);
this
.
convInput
=
this
.
convInput
.
slice
(
1
,
2
);
}
Input
.
finalInput
=
Input
.
converted
+
Input
.
convInput
;
return
true
;
//console.log('_____end_convert_____');
}
...
...
@@ -317,8 +329,15 @@ Input.inputField =
{
Input
.
input
.
pop
();
Input
.
convert
();
Input
.
inputField
.
text
.
setText
(
Input
.
convInput
);
Input
.
inputField
.
text
.
setText
(
Input
.
finalInput
);
}
else
if
(
Input
.
converted
.
length
>
0
)
{
Input
.
converted
=
Input
.
converted
.
slice
(
0
,
Input
.
converted
.
length
-
1
);
Input
.
finalInput
=
Input
.
converted
+
Input
.
convInput
;
Input
.
inputField
.
text
.
setText
(
Input
.
finalInput
);
}
else
Input
.
reset
();
});
scene
.
input
.
keyboard
.
on
(
'
keydown-ENTER
'
,
enterCallback
);
scene
.
input
.
keyboard
.
on
(
'
keyup-ENTER
'
,
function
(){
Input
.
isEntered
=
false
;})
...
...
@@ -381,11 +400,11 @@ Input.pushInput = function(inputKey)
else
output
=
inputKey
.
charCodeAt
(
0
);
this
.
input
.
push
(
output
);
//console.log(Input.input);
if
(
!
this
.
convert
()
||
this
.
conv
Input
.
length
>
this
.
maxInput
)
if
(
!
this
.
convert
()
||
this
.
final
Input
.
length
>
this
.
maxInput
)
{
this
.
input
.
pop
();
this
.
convert
();
}
this
.
inputField
.
text
.
setText
(
Input
.
conv
Input
);
this
.
inputField
.
text
.
setText
(
Input
.
final
Input
);
}
}
\ 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