Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
sn19_read
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
sn19_read
Commits
ddede972
Commit
ddede972
authored
Nov 10, 2023
by
Tt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
待提供无黑边图片
parent
eb692f80
Changes
2
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
250 additions
and
124 deletions
+250
-124
sn19_read.fire
assets/sn19_read/scene/sn19_read.fire
+218
-118
sn19_read.ts
assets/sn19_read/scene/sn19_read.ts
+32
-6
No files found.
assets/sn19_read/scene/sn19_read.fire
View file @
ddede972
This diff is collapsed.
Click to expand it.
assets/sn19_read/scene/sn19_read.ts
View file @
ddede972
...
...
@@ -76,6 +76,8 @@ export default class SceneComponent extends MyCocosSceneComponent {
this
.
scoreList
=
this
.
list
.
map
(()
=>
3
);
this
.
maxCurrent
=
0
;
this
.
layers
=
[];
this
.
readyNext
=
false
;
this
.
readyTime
=
99999
;
}
private
layers
:
Array
<
cc
.
Node
>
;
...
...
@@ -91,6 +93,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
pg
.
view
.
touchOn
(
this
.
btn_last
,
this
.
preLayer
,
this
);
pg
.
view
.
touchOn
(
this
.
btn_next
,
this
.
nextLayer
,
this
);
pg
.
view
.
touchOn
(
this
.
btn_record
,
this
.
onTouchRecord
,
this
);
pg
.
view
.
touchOn
(
this
.
img_npc
,
this
.
onPlayNpc
,
this
);
pg
.
view
.
touchOn
(
this
.
ani_npc
,
this
.
onPlayNpc
,
this
);
let
layout_btns
=
pg
.
view
.
find
(
this
.
btn_record
,
"
mask/layout_btns
"
);
...
...
@@ -171,9 +174,17 @@ export default class SceneComponent extends MyCocosSceneComponent {
this
.
btn_last
.
active
=
this
.
showLastNext
>
0
&&
!!
this
.
LastData
;
this
.
btn_next
.
active
=
this
.
showLastNext
>
0
&&
!!
this
.
NextData
;
}
private
readyNext
:
boolean
;
private
readyTime
:
number
;
update
(
dt
)
{
if
(
!
this
.
list
)
return
;
this
.
updateBtns
(
dt
);
this
.
readyTime
-=
dt
;
if
(
this
.
readyNext
&&
this
.
readyTime
<=
0
)
{
this
.
readyNext
=
false
;
this
.
readyTime
=
999999
;
this
.
nextLayer
();
}
}
//--------------------------------Record-----------------------------
private
recordAudio
:
string
;
...
...
@@ -205,6 +216,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
showRecordHide
()
{
this
.
showRecordWaitEnd
();
this
.
img_npc
.
active
=
false
;
this
.
showLastNext
=
3
;
// 3秒显示时间
let
img_voice
=
pg
.
view
.
find
(
this
.
btn_record
,
"
img_voice
"
);
img_voice
.
active
=
false
;
...
...
@@ -252,6 +264,8 @@ export default class SceneComponent extends MyCocosSceneComponent {
private
recordAudioId
:
any
;
async
showRecorAudioPlay
()
{
if
(
!
this
.
recordAudio
)
return
;
this
.
readyNext
=
false
;
this
.
readyTime
=
999999
;
let
layout_btns
=
pg
.
view
.
find
(
this
.
btn_record
,
"
mask/layout_btns
"
);
let
btn_right
=
pg
.
view
.
find
(
layout_btns
,
'
btn_right
'
)
...
...
@@ -266,7 +280,8 @@ export default class SceneComponent extends MyCocosSceneComponent {
this
.
showRecorAudioPlayEnd
().
then
(()
=>
{
this
.
showNpcAudioPlay
().
then
(()
=>
{
this
.
showNpcAudioPlayEnd
();
this
.
nextLayer
();
this
.
readyNext
=
true
;
this
.
readyTime
=
3
;
})
})
},
audioId
=>
{
...
...
@@ -311,13 +326,18 @@ export default class SceneComponent extends MyCocosSceneComponent {
ani_good
:
cc
.
Node
=
null
;
@
property
(
cc
.
Node
)
ani_npc
:
cc
.
Node
=
null
;
@
property
(
cc
.
Node
)
img_npc
:
cc
.
Node
=
null
;
private
npcAudioId
:
any
;
showNpcAudioPlay
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
this
.
ani_npc
.
active
=
true
;
this
.
img_npc
.
active
=
false
;
pg
.
view
.
playDBAnimation
(
this
.
ani_npc
,
'
newAnimation
'
,
0
);
pg
.
audio
.
playAudioByUrl
(
this
.
CurrentData
.
npcAudio
,
()
=>
{
pg
.
view
.
playDBAnimation
(
this
.
ani_npc
,
'
newAnimation
'
,
1
);
this
.
ani_npc
.
active
=
false
;
this
.
img_npc
.
active
=
true
;
this
.
npcAudioId
=
null
;
resolve
(
''
);
},
audioId
=>
{
...
...
@@ -339,10 +359,13 @@ export default class SceneComponent extends MyCocosSceneComponent {
}
// 停止播放录音
onTouchRecordStop
()
{
this
.
readyNext
=
false
;
this
.
readyTime
=
999999
;
this
.
showRecorAudioPlayEnd
().
then
(()
=>
{
this
.
showNpcAudioPlay
().
then
(()
=>
{
this
.
showNpcAudioPlayEnd
();
this
.
nextLayer
();
this
.
readyNext
=
true
;
this
.
readyTime
=
3
;
})
})
}
...
...
@@ -352,10 +375,13 @@ export default class SceneComponent extends MyCocosSceneComponent {
this
.
showRecorAudioPlay
();
}
onPlayNpc
()
{
this
.
readyNext
=
false
;
this
.
readyTime
=
999999
;
this
.
showNpcAudioPlayEnd
();
this
.
showNpcAudioPlay
().
then
(()
=>
{
this
.
showNpcAudioPlayEnd
();
this
.
nextLayer
();
this
.
readyNext
=
true
;
this
.
readyTime
=
3
;
})
}
//按钮触发,使用的方法
...
...
@@ -378,7 +404,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
this
.
showRecordEnd
();
let
testData
=
{
"
text
"
:
"
Yes, there is.Yes, there is.Yes, there is.Yes, there is.Yes, there is.Yes, there is.Yes, there is.
"
,
"
audio
"
:
"
https://staging-teach.cdn.ireadabc.com/6ee3ccaa831a884f02c6a75c6f647cb5.wav
"
"
audio
Url
"
:
"
https://staging-teach.cdn.ireadabc.com/6ee3ccaa831a884f02c6a75c6f647cb5.wav
"
}
if
(
!
courseware
)
return
this
.
recrodEnd
(
testData
)
courseware
&&
courseware
.
stopRecord
(
0
,
(
data
)
=>
{
...
...
@@ -389,7 +415,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
}
async
recrodEnd
(
data
)
{
this
.
voiceTouchForbid
=
false
;
this
.
recordAudio
=
data
.
audio
;
this
.
recordAudio
=
data
.
audio
Url
;
this
.
recordAudioWord
=
data
.
text
;
this
.
recording
=
false
;
this
.
showRecorAudioPlay
();
...
...
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