Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OP_03_1
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
OP_03_1
Commits
2fb2c068
Commit
2fb2c068
authored
Dec 16, 2021
by
Chen Jiping
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:逻辑调整
parent
0c5730f2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
110 additions
and
65 deletions
+110
-65
OP_03_1.js
play/assets/OP_03_1/scene/OP_03_1.js
+49
-16
defaultData.js
play/assets/OP_03_1/script/defaultData.js
+61
-49
No files found.
play/assets/OP_03_1/scene/OP_03_1.js
View file @
2fb2c068
...
...
@@ -383,7 +383,7 @@ cc.Class({
return
;
}
let
wordNode
=
wordNodeArr
[
2
*
i
ndex
];
let
wordNode
=
wordNodeArr
[
2
*
this
.
_curI
ndex
];
this
.
playTextAutio
(
wordNode
,
wordNode
.
data
.
lrcData
.
audio_url
,
()
=>
{
this
.
_cantouch
=
true
;
...
...
@@ -585,30 +585,16 @@ cc.Class({
//停止监听动画
this
.
_stopAni
=
true
;
this
.
_cantouch
=
true
;
state
.
stop
();
//播放待机动画
this
.
playAni
(
'
normal
'
,
0
);
this
.
_curIndex
++
;
this
.
moveHand
(
this
.
_curIndex
,
()
=>
{
this
.
_cantouch
=
true
;
this
.
showEnd
();
})
if
(
callback
)
{
callback
();
}
},
(
audioId
)
=>
{
//显示完成,不再播放动画
if
(
this
.
_shown
)
{
return
;
}
//设置可播放动画
this
.
_stopAni
=
false
;
...
...
@@ -765,7 +751,54 @@ cc.Class({
if
(
time
<
currentTime
)
{
this
.
textTwinkle
(
node
);
//如果是最后一个匹配,则移动手指
if
(
len
==
1
)
{
const
showNext
=
()
=>
{
this
.
_cantouch
=
true
;
if
(
this
.
_shown
){
return
;
}
this
.
_curIndex
++
;
if
(
this
.
_curIndex
>=
this
.
data
.
exercises
.
wordArr
.
length
&&
!
this
.
_times
){
this
.
_times
=
1
;
this
.
_curIndex
=
0
;
console
.
log
(
"
the first time
"
);
}
this
.
playAni
(
'
normal
'
,
0
);
this
.
moveHand
(
this
.
_curIndex
,
()
=>
{
this
.
_cantouch
=
true
;
this
.
showEnd
();
})
}
let
duration
=
cc
.
audioEngine
.
getDuration
(
audioId
);
duration
=
Math
.
round
(
duration
*
1000
)
/
1000
;
console
.
log
(
'
Remaining time:
'
,
duration
-
currentTime
);
//如果超过动画时长,则等音频播放完成后再移动手指
if
(
duration
-
currentTime
>
0.6
){
this
.
textTwinkle
(
node
);
cc
.
audioEngine
.
setFinishCallback
(
audioId
,
()
=>
{
showNext
();
});
}
else
{
this
.
textTwinkle
(
node
,
()
=>
{
showNext
();
});
}
}
else
{
this
.
textTwinkle
(
node
);
}
//移除匹配上的元素
arr
.
splice
(
i
,
1
);
...
...
play/assets/OP_03_1/script/defaultData.js
View file @
2fb2c068
export
const
defaultData
=
{
"
exercises
"
:
{
"
wordArr
"
:
[{
"
val
"
:
"
A
"
,
"
lrcData
"
:
{
"
audio_url
"
:
"
http://staging-teach.cdn.ireadabc.com/e896863da284cf8ba738caf98d568d39.mp3
"
,
"
fontSize
"
:
24
,
"
lineHeight
"
:
32
,
"
lyrics
"
:
[{
"
time
"
:
0
,
"
data
"
:
""
,
"
newLine
"
:
false
},
{
"
time
"
:
1.211424
,
"
data
"
:
""
,
"
newLine
"
:
false
},
{
"
time
"
:
2.411394
,
"
data
"
:
""
,
"
newLine
"
:
false
}]
},
"
audioUrl
"
:
"
http://staging-teach.cdn.ireadabc.com/e896863da284cf8ba738caf98d568d39.mp3
"
},
{
"
val
"
:
"
a
"
,
"
lrcData
"
:
{
"
audio_url
"
:
"
http://staging-teach.cdn.ireadabc.com/9747c77fc914684e151aac636e1b47b6.mp3
"
,
"
fontSize
"
:
24
,
"
lineHeight
"
:
32
,
"
lyrics
"
:
[{
"
time
"
:
0
,
"
data
"
:
""
,
"
newLine
"
:
false
},
{
"
time
"
:
1.258075
,
"
data
"
:
""
,
"
newLine
"
:
false
},
{
"
time
"
:
2.532695
,
"
data
"
:
""
,
"
newLine
"
:
false
}]
},
"
audioUrl
"
:
"
http://staging-teach.cdn.ireadabc.com/9747c77fc914684e151aac636e1b47b6.mp3
"
}],
"
picUrl
"
:
"
http://staging-teach.cdn.ireadabc.com/d125fe9022b0528cfbb621dd5b9f701a.png
"
}
}
"
exercises
"
:{
"
wordArr
"
:[
{
"
val
"
:
"
A
"
,
"
lrcData
"
:{
"
audio_url
"
:
"
http://staging-teach.cdn.ireadabc.com/e896863da284cf8ba738caf98d568d39.mp3
"
,
"
fontSize
"
:
24
,
"
lineHeight
"
:
32
,
"
lyrics
"
:[
{
"
time
"
:
0.040271
,
"
data
"
:
""
,
"
newLine
"
:
false
},
{
"
time
"
:
1.277515
,
"
data
"
:
""
,
"
newLine
"
:
false
},
{
"
time
"
:
2.574908
,
"
data
"
:
""
,
"
newLine
"
:
false
}
]
}
},
{
"
val
"
:
"
a
"
,
"
lrcData
"
:{
"
audio_url
"
:
"
http://staging-teach.cdn.ireadabc.com/9747c77fc914684e151aac636e1b47b6.mp3
"
,
"
fontSize
"
:
24
,
"
lineHeight
"
:
32
,
"
lyrics
"
:[
{
"
time
"
:
0.120777
,
"
data
"
:
""
,
"
newLine
"
:
false
},
{
"
time
"
:
1.158266
,
"
data
"
:
""
,
"
newLine
"
:
false
},
{
"
time
"
:
2.447526
,
"
data
"
:
""
,
"
newLine
"
:
false
}
]
}
}
],
"
picUrl
"
:
"
http://staging-teach.cdn.ireadabc.com/101cdabba6404b73292d3b676f4683b1.png
"
,
"
audioUrl
"
:
"
http://staging-teach.cdn.ireadabc.com/bbab99eb9f5fe3cbe2d24cf80594d8c9.mp3
"
},
"
audioUrl
"
:
"
http://staging-teach.cdn.ireadabc.com/bbab99eb9f5fe3cbe2d24cf80594d8c9.mp3
"
,
"
guideAudioUrl1
"
:
"
http://staging-teach.cdn.ireadabc.com/c3b83a24fd8f9b37ee72409cdb45e3f7.mp3
"
,
"
guideAudioUrl2
"
:
"
http://staging-teach.cdn.ireadabc.com/9f6ff5d0617bf274ee2d9af4cfc93c62.mp3
"
,
"
guideAudioUrl3
"
:
"
http://staging-teach.cdn.ireadabc.com/c3b83a24fd8f9b37ee72409cdb45e3f7.mp3
"
};
\ 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