Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
middleLayer_for_kyxq
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
middleLayer_for_kyxq
Commits
13fedd70
Commit
13fedd70
authored
Nov 13, 2023
by
李维
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加音频时长倒计时
parent
642a520d
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
61 additions
and
6 deletions
+61
-6
middleLayer_for_kyxq.meta
assets/middleLayer_for_kyxq.meta
+24
-1
LessonPreview.ts
assets/middleLayer_for_kyxq/script/LessonPreview.ts
+37
-4
UnitPage.ts
assets/middleLayer_for_kyxq/script/UnitPage.ts
+0
-1
No files found.
assets/middleLayer_for_kyxq.meta
View file @
13fedd70
{"ver":"1.1.2","uuid":"c35bb2f6-f24a-4850-ae44-643f2fdc7541","isBundle":false,"bundleName":"","priority":1,"compressionType":{"android":"default","ios":"default"},"optimizeHotUpdate":{"android":false,"ios":false},"inlineSpriteFrames":{"android":false,"ios":false},"isRemoteBundle":{"ios":false,"android":false},"subMetas":{}}
\ No newline at end of file
{
"ver": "1.1.2",
"uuid": "c35bb2f6-f24a-4850-ae44-643f2fdc7541",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {
"android": "default",
"ios": "default"
},
"optimizeHotUpdate": {
"android": false,
"ios": false
},
"inlineSpriteFrames": {
"android": false,
"ios": false
},
"isRemoteBundle": {
"ios": false,
"android": false
},
"subMetas": {}
}
\ No newline at end of file
assets/middleLayer_for_kyxq/script/LessonPreview.ts
View file @
13fedd70
...
...
@@ -57,6 +57,9 @@ export default class LessonPreviewClass extends cc.Component {
if
(
_data
.
sub_title
)
this
.
lessonTitle
.
string
=
_data
.
sub_title
this
.
btn_last
.
active
=
this
.
curPageIndex
>
0
this
.
btn_next
.
active
=
this
.
curPageIndex
<
(
this
.
data
.
length
-
1
)
this
.
aniPlay
&&
this
.
aniPlay
.
stop
();
getSprNodeByUrl
(
_data
.
image
,
(
spr
)
=>
{
this
.
mask
.
addChild
(
spr
.
node
);
spr
.
srcBlendFactor
=
cc
.
macro
.
BlendFactor
.
ONE
...
...
@@ -76,10 +79,12 @@ export default class LessonPreviewClass extends cc.Component {
setTimeout
(()
=>
{
audioClip
.
duration
=
cc
.
audioEngine
.
getDuration
(
audioId
)
cc
.
audioEngine
.
pause
(
audioId
)
this
.
lblAudio
.
string
=
String
(
Math
.
floor
(
audioClip
.
duration
))
this
.
lblAudio
.
string
=
String
(
Math
.
floor
(
audioClip
.
duration
))
+
"
s
"
this
.
currentAudioDuration
=
audioClip
.
duration
;
},
50
);
}
else
{
this
.
lblAudio
.
string
=
String
(
Math
.
floor
(
audioClip
.
duration
))
this
.
lblAudio
.
string
=
String
(
Math
.
floor
(
audioClip
.
duration
))
+
"
s
"
;
this
.
currentAudioDuration
=
audioClip
.
duration
;
}
});
}
...
...
@@ -89,6 +94,7 @@ export default class LessonPreviewClass extends cc.Component {
if
(
this
.
curPageIndex
>
0
)
this
.
curPageIndex
--
this
.
refreshUI
()
}
onClickRight
()
{
if
(
!
this
.
data
)
return
if
(
this
.
curPageIndex
<
this
.
data
.
length
)
this
.
curPageIndex
++
...
...
@@ -99,27 +105,54 @@ export default class LessonPreviewClass extends cc.Component {
audio_url
playAudioId
aniPlay
=
null
;
updateTimeLabelIntervalId
=
null
;
currentAudioDuration
=
null
;
onClickAudio
()
{
if
(
!
this
.
audio_url
)
{
return
;
}
if
(
this
.
isAudioPlaying
)
{
cc
.
audioEngine
.
stop
(
this
.
playAudioId
);
this
.
aniPlay
&&
this
.
aniPlay
.
stop
()
this
.
aniPlay
&&
this
.
aniPlay
.
stop
()
;
this
.
isAudioPlaying
=
false
;
if
(
this
.
updateTimeLabelIntervalId
)
{
clearInterval
(
this
.
updateTimeLabelIntervalId
)
this
.
updateTimeLabelIntervalId
=
null
;
}
this
.
lblAudio
.
string
=
String
(
Math
.
floor
(
this
.
currentAudioDuration
))
+
"
s
"
}
else
{
this
.
isAudioPlaying
=
true
;
if
(
this
.
audio_url
)
{
cc
.
assetManager
.
loadRemote
(
this
.
audio_url
,
(
err
,
audioClip
)
=>
{
this
.
playAudioId
=
cc
.
audioEngine
.
play
(
audioClip
,
false
,
0.8
);
this
.
aniPlay
=
playAnimationOnNode
(
this
.
AniAudio
,
"
audioPlay
"
);
this
.
updateTimeLabelIntervalId
=
setInterval
(()
=>
{
const
time
=
cc
.
audioEngine
.
getCurrentTime
(
this
.
playAudioId
);
this
.
lblAudio
.
string
=
String
(
Math
.
floor
(
this
.
currentAudioDuration
-
time
))
+
"
s
"
;
},
1000
)
cc
.
audioEngine
.
setFinishCallback
(
this
.
playAudioId
,
()
=>
{
this
.
playAudioId
=
null
;
this
.
isAudioPlaying
=
false
;
this
.
aniPlay
&&
this
.
aniPlay
.
stop
()
this
.
aniPlay
&&
this
.
aniPlay
.
stop
()
;
});
})
}
}
}
onDestroy
()
{
if
(
this
.
updateTimeLabelIntervalId
)
{
clearInterval
(
this
.
updateTimeLabelIntervalId
)
this
.
updateTimeLabelIntervalId
=
null
;
}
this
.
aniPlay
&&
this
.
aniPlay
.
stop
();
}
onDisable
()
{
if
(
this
.
updateTimeLabelIntervalId
)
{
clearInterval
(
this
.
updateTimeLabelIntervalId
)
this
.
updateTimeLabelIntervalId
=
null
;
}
this
.
aniPlay
&&
this
.
aniPlay
.
stop
();
}
}
assets/middleLayer_for_kyxq/script/UnitPage.ts
View file @
13fedd70
...
...
@@ -183,7 +183,6 @@ export default class UnitPageClass extends PageComponentBaseClass {
this
.
syllabusFinishedStore
[
row
.
id
]
=
row
.
end
==
0
?
'
unfinish
'
:
'
finished
'
;
}
}
}
configData
=
[];
...
...
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