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
2d389e71
Commit
2d389e71
authored
Jun 27, 2019
by
18손재민
Browse files
Options
Browse Files
Download
Plain Diff
비정상적인 단어 판별 후 고치는 함수 구현
parents
a92e3634
0a5b6941
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
89 additions
and
25 deletions
+89
-25
inputFieldBackground.png
assets/inputFieldBackground.png
+0
-0
index.html
index.html
+2
-1
Input.js
js/Input.js
+43
-0
WordSpace.js
js/WordSpace.js
+38
-1
main.js
js/main.js
+6
-23
No files found.
assets/inputFieldBackground.png
0 → 100644
View file @
2d389e71
1.48 KB
index.html
View file @
2d389e71
...
...
@@ -4,7 +4,8 @@
<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>
</head>
...
...
js/Input.js
0 → 100644
View file @
2d389e71
var
Input
=
Input
||
{};
Input
.
input
=
[];
Input
.
convInput
=
""
;
// converted input
Input
.
reset
=
function
()
{
Input
.
input
=
[];
}
Input
.
convert
=
function
()
{
// convert input to convInput
}
Input
.
isEqual
=
function
(
inputWord
,
wordText
)
{
return
inputWord
===
wordText
;
}
Input
.
checkProperInput
=
function
(
inputWord
)
{
return
inputWord
===
this
.
removeConVow
(
inputWord
);
}
Input
.
removeConVow
=
function
(
_wordText
)
{
var
tempStr
=
_wordText
;
for
(
var
i
=
0
;
i
<
_wordText
.
length
;
i
++
)
{
var
tempCharCode
=
_wordText
.
charCodeAt
(
i
);
if
(
tempCharCode
<
44032
||
tempCharCode
>
55203
)
tempStr
=
tempStr
.
replace
(
String
.
fromCharCode
(
parseInt
(
tempCharCode
.
toString
(
16
),
16
)),
''
);
}
return
tempStr
;
}
Input
.
inputField
=
{
generate
:
function
(
scene
)
{
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
'
);
},
loadImage
:
function
(
scene
)
{
scene
.
load
.
image
(
'
inputFieldBackground
'
,
'
assets/inputFieldBackground.png
'
);
}
}
\ No newline at end of file
js/WordSpace.js
View file @
2d389e71
...
...
@@ -2,11 +2,37 @@ var WordSpace = WordSpace || {};
WordSpace
.
isImageLoaded
=
false
;
WordSpace
.
wordGroup
=
null
;
WordSpace
.
nextWordCode
=
0
;
WordSpace
.
wordGroup
=
[];
WordSpace
.
wordForcedGroup
=
[];
WordSpace
.
wordPhysicsGroup
=
null
;
WordSpace
.
gravityPoint
=
{
x
:
400
,
y
:
300
};
WordSpace
.
wordCycle
=
null
;
WordSpace
.
resetCycle
=
function
(
scene
,
_delay
)
{
var
option
=
{
delay
:
_delay
,
callback
:
function
()
{
WordSpace
.
generateWord
(
this
)
},
callbackScope
:
scene
,
loop
:
true
};
if
(
this
.
wordCycle
!=
null
)
{
this
.
wordCycle
=
this
.
wordCycle
.
reset
(
option
);
}
else
{
this
.
wordCycle
=
scene
.
time
.
addEvent
(
option
);
}
}
WordSpace
.
loadImage
=
function
(
scene
)
{
if
(
!
this
.
isImageLoaded
)
...
...
@@ -14,3 +40,14 @@ WordSpace.loadImage = function(scene)
scene
.
load
.
image
(
'
wordBackground
'
,
'
assets/wordBackground.png
'
);
}
}
WordSpace
.
generateWord
=
function
(
scene
)
{
word
=
new
WordObject
(
"
솽젠커
"
);
word
.
instantiate
(
scene
);
WordSpace
.
wordGroup
.
push
(
word
);
WordSpace
.
wordForcedGroup
.
push
(
word
);
scene
.
physics
.
add
.
collider
(
word
.
physicsObj
,
WordSpace
.
wordPhysicsGroup
);
scene
.
physics
.
add
.
collider
(
word
.
physicsObj
,
BackGround
.
brainGroup
);
WordSpace
.
wordPhysicsGroup
.
add
(
word
.
physicsObj
);
}
\ No newline at end of file
js/main.js
View file @
2d389e71
...
...
@@ -18,45 +18,28 @@ var config = {
var
game
=
new
Phaser
.
Game
(
config
);
var
tec
;
// load assets
function
preload
()
{
BackGround
.
loadImage
(
this
);
WordSpace
.
loadImage
(
this
);
Input
.
inputField
.
loadImage
(
this
);
}
function
create
()
{
BackGround
.
drawBrain
(
this
);
WordSpace
.
wordGroup
=
[]
;
Input
.
inputField
.
generate
(
this
)
;
WordSpace
.
wordPhysicsGroup
=
this
.
physics
.
add
.
group
();
this
.
time
.
addEvent
(
{
delay
:
2000
,
callback
:
function
()
{
var
word
=
new
WordObject
(
"
치또이쯔
"
);
word
.
generate
(
this
);
console
.
log
(
word
.
getWordWeight
()
+
"
"
+
word
.
wordTyping
);
WordSpace
.
wordGroup
.
push
(
word
);
this
.
physics
.
add
.
collider
(
word
.
physicsObj
,
WordSpace
.
wordPhysicsGroup
);
WordSpace
.
wordPhysicsGroup
.
add
(
word
.
physicsObj
);
},
callbackScope
:
this
,
repeat
:
10
}
);
WordSpace
.
resetCycle
(
this
,
2000
);
}
function
update
()
{
for
(
i
=
0
;
i
<
WordSpace
.
wordGroup
.
length
;
i
++
)
WordSpace
.
wordForcedGroup
.
forEach
(
function
(
element
)
{
WordSpace
.
wordGroup
[
i
]
.
attract
(
0.3
);
}
element
.
attract
(
0.3
);
}
);
}
var
socket
=
io
.
connect
();
...
...
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