Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
JM04-3
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
template admin
JM04-3
Commits
d2e528a9
Commit
d2e528a9
authored
Jul 21, 2021
by
李维
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dev commit
parent
6d69b7f4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
42 additions
and
25 deletions
+42
-25
play.component.ts
src/app/play/play.component.ts
+42
-25
No files found.
src/app/play/play.component.ts
View file @
d2e528a9
...
...
@@ -141,6 +141,7 @@ export class PlayComponent implements OnInit, OnDestroy {
m_currentInputIndex
=
0
;
m_submited
=
false
;
m_wordLetterInputCatch
=
[];
m_canInput
=
true
;
// ------------------------------------
...
...
@@ -339,14 +340,17 @@ export class PlayComponent implements OnInit, OnDestroy {
this
.
subscribeMapDownEvent
(
btnNext
.
id
,
()
=>
{
this
.
switchQuestion
(
this
.
m_currentQuestionIndex
,
this
.
m_currentQuestionIndex
+
1
);
jelly
(
btnNext
.
ref
)
this
.
g_enableMapDown
=
true
;
this
.
showJellyAnimation
(
btnNext
.
id
,
()
=>
{
this
.
g_enableMapDown
=
true
;
})
})
this
.
subscribeMapDownEvent
(
btnPre
.
id
,
()
=>
{
this
.
switchQuestion
(
this
.
m_currentQuestionIndex
,
this
.
m_currentQuestionIndex
-
1
);
jelly
(
btnPre
.
ref
)
this
.
g_enableMapDown
=
true
;
this
.
showJellyAnimation
(
btnPre
.
id
,
()
=>
{
this
.
g_enableMapDown
=
true
;
})
})
element
.
ref
.
addChild
(
labelIndex
.
ref
)
...
...
@@ -401,14 +405,19 @@ export class PlayComponent implements OnInit, OnDestroy {
for
(
let
i
=
1
;
i
<=
letttes
.
length
;
i
++
)
{
let
le
=
createWord
(
letttes
[
i
-
1
],
baseX
,
baseY
)
this
.
subscribeMapDownEvent
(
le
.
id
,
()
=>
{
jelly
(
le
.
ref
)
this
.
showJellyAnimation
(
le
.
id
,
()
=>
{
this
.
g_enableMapDown
=
true
;
})
if
(
!
this
.
m_canInput
)
{
return
}
let
target
=
this
.
g_cartoon
.
getCartoonElement
(
this
.
m_currentInput
)
if
(
this
.
m_openShift
)
{
target
.
setContentText
(
letttes
[
i
-
1
].
toUpperCase
())
}
else
{
target
.
setContentText
(
letttes
[
i
-
1
].
toLocaleLowerCase
())
}
this
.
g_enableMapDown
=
true
;
this
.
jumpToNextActive
(
this
.
m_currentQuestionIndex
);
})
allLetterRefs
.
push
(
le
.
ref
.
children
[
1
])
...
...
@@ -457,8 +466,9 @@ export class PlayComponent implements OnInit, OnDestroy {
le
.
text
=
le
.
text
.
toLocaleLowerCase
()
})
}
jelly
(
btnShift
.
ref
)
this
.
g_enableMapDown
=
true
;
this
.
showJellyAnimation
(
btnShift
.
id
,
()
=>
{
this
.
g_enableMapDown
=
true
;
})
})
this
.
render
(
element
.
ref
)
...
...
@@ -605,15 +615,12 @@ export class PlayComponent implements OnInit, OnDestroy {
}
container
.
active
=
(
status
=
false
)
=>
{
console
.
log
(
"
DVDV
"
)
if
(
status
)
{
if
(
container
.
getContentText
()
==
""
)
{
bgFocus
.
ref
.
alpha
=
1
;
// bgDisable.ref.alpha = 0;
container
.
switchStatus
(
"
focus
"
)
}
}
else
{
bgFocus
.
ref
.
alpha
=
0
;
// bgDisable.ref.alpha = 1;
container
.
switchStatus
(
"
disable
"
)
}
if
(
status
)
{
this
.
m_currentInput
=
`block_
${
x
}
_
${
y
}
`
;
...
...
@@ -669,7 +676,6 @@ export class PlayComponent implements OnInit, OnDestroy {
if
(
!
this
.
m_submited
&&
questionIndex
==
fromIndex
)
{
container
.
setContentText
(
contentSaved
)
}
console
.
log
(
"
==A==
"
)
if
(
groupIndex
!=
this
.
m_currentQuestionIndex
)
{
if
(
container
.
getContentText
()
==
""
)
{
container
.
switchStatus
(
"
init
"
)
...
...
@@ -695,11 +701,16 @@ export class PlayComponent implements OnInit, OnDestroy {
}
}
}
console
.
log
(
this
.
m_currentInput
)
}
this
.
subscribeMapDownEvent
(
container
.
id
,
()
=>
{
container
.
switchStatus
(
"
wrong
"
)
if
(
container
.
canSetActive
())
{
if
(
this
.
m_currentInput
)
{
let
currentAcitveNode
=
this
.
g_cartoon
.
getCartoonElement
(
this
.
m_currentInput
)
currentAcitveNode
.
active
(
false
)
}
container
.
active
(
true
);
}
this
.
g_enableMapDown
=
true
;
})
return
container
...
...
@@ -763,15 +774,18 @@ export class PlayComponent implements OnInit, OnDestroy {
},
(
w
,
h
)
=>
{
return
{
x
:
this
.
g_canvasWidth
/
2
+
855
*
this
.
g_mapScale
/
2
+
118
*
this
.
g_mapScale
,
y
:
this
.
g_canvasHeight
/
2
+
8
00
*
this
.
g_mapScale
y
:
this
.
g_canvasHeight
/
2
+
7
00
*
this
.
g_mapScale
}
})
submit
.
ref
.
alpha
=
0
;
submit
.
switchActive
=
(
status
)
=>
{
if
(
status
)
{
submit
.
ref
.
alpha
=
1
;
this
.
m_canInput
=
false
;
}
else
{
submit
.
ref
.
alpha
=
0
;
this
.
m_canInput
=
true
;
}
}
...
...
@@ -781,7 +795,9 @@ export class PlayComponent implements OnInit, OnDestroy {
this
.
m_blockFirstSubmit
[
this
.
m_currentQuestionIndex
]
=
false
;
this
.
m_currentInputIndex
=
0
;
let
status
=
this
.
updateStatusByGroupIndex
(
this
.
m_currentQuestionIndex
);
this
.
switchQuestion
(
this
.
m_currentQuestionIndex
,
this
.
m_currentQuestionIndex
+
1
)
// console.log(status)
// this.switchQuestion(this.m_currentQuestionIndex, this.m_currentQuestionIndex+1)
submit
.
switchActive
(
false
)
// if(this.m_currentQuestionIndex == this.g_formData.dataArray.length-1) {
// // 最后一题提交以后 弹出结束按钮
// let btn = this.g_cartoon.getCartoonElement("FinishButton")
...
...
@@ -797,7 +813,9 @@ export class PlayComponent implements OnInit, OnDestroy {
}
this
.
subscribeMapDownEvent
(
submit
.
id
,
()
=>
{
handleSubmit
()
if
(
submit
.
ref
.
alpha
==
1
)
{
handleSubmit
()
}
this
.
g_enableMapDown
=
true
;
})
...
...
@@ -867,7 +885,7 @@ export class PlayComponent implements OnInit, OnDestroy {
// 跳转下一个焦点输入框
jumpToNextActive
(
index
)
{
console
.
log
(
"
jumpToNextActive
"
)
console
.
log
(
"
jumpToNextActive
m_currentInputIndex
"
,
this
.
m_currentInputIndex
)
let
blocks
=
this
.
m_blockGroup
[
index
];
this
.
m_hasActiveBlock
=
false
;
...
...
@@ -886,13 +904,12 @@ export class PlayComponent implements OnInit, OnDestroy {
}
checkNextActive
();
console
.
log
(
this
.
m_currentInputIndex
)
if
(
this
.
m_currentInputIndex
>=
blocks
.
length
)
{
// 没有获取焦点的输入框,启用提交功能
if
(
!
this
.
m_hasActiveBlock
)
{
let
btn
=
this
.
g_cartoon
.
getCartoonElement
(
"
button_submit
"
)
btn
.
switchActive
(
true
)
console
.
log
(
"
使能提交按钮
"
)
btn
.
switchActive
(
true
);
}
// 切换当前输入从头开始
...
...
@@ -1942,8 +1959,8 @@ export class PlayComponent implements OnInit, OnDestroy {
showJellyAnimation
(
element_id
,
callback
?){
let
element
=
this
.
g_cartoon
.
getCartoonElement
(
element_id
).
ref
tweenChange
(
element
,{
scaleX
:
this
.
g_mapScale
*
element
.
initScaleX
*
1.1
,
scaleY
:
this
.
g_mapScale
*
element
.
initScaleY
*
1.1
},
0.1
,
()
=>
{
tweenChange
(
element
,{
scaleX
:
this
.
g_mapScale
*
element
.
initScaleX
*
0.9
,
scaleY
:
this
.
g_mapScale
*
element
.
initScaleY
*
0.9
},
0.1
,
()
=>
{
tweenChange
(
element
,{
scaleX
:
element
.
initScaleX
*
1.02
,
scaleY
:
element
.
initScaleY
*
1.02
},
0.05
,
()
=>
{
tweenChange
(
element
,{
scaleX
:
element
.
initScaleX
*
0.98
,
scaleY
:
element
.
initScaleY
*
0.98
},
0.05
,
()
=>
{
tweenChange
(
element
,{
scaleX
:
element
.
initScaleX
,
scaleY
:
element
.
initScaleY
},
0.1
,
()
=>
{
callback
&&
callback
()
})
...
...
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