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
912fb60f
Commit
912fb60f
authored
Nov 13, 2023
by
李维
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加课程简介音频播放动画
parent
4a07559d
Changes
13
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
1495 additions
and
1192 deletions
+1495
-1192
audioPlay.anim
assets/middleLayer_for_kyxq/audioPlay.anim
+43
-0
audioPlay.anim.meta
assets/middleLayer_for_kyxq/audioPlay.anim.meta
+5
-0
middleLayer_for_kyxq.fire
assets/middleLayer_for_kyxq/scene/middleLayer_for_kyxq.fire
+1324
-1189
LessonPreview.ts
assets/middleLayer_for_kyxq/script/LessonPreview.ts
+9
-3
util.ts
assets/middleLayer_for_kyxq/script/util.ts
+6
-0
ani_audio1.png
...iddleLayer_for_kyxq/textures/LessonPreview/ani_audio1.png
+0
-0
ani_audio1.png.meta
...Layer_for_kyxq/textures/LessonPreview/ani_audio1.png.meta
+36
-0
ani_audio2.png
...iddleLayer_for_kyxq/textures/LessonPreview/ani_audio2.png
+0
-0
ani_audio2.png.meta
...Layer_for_kyxq/textures/LessonPreview/ani_audio2.png.meta
+36
-0
ani_audio3.png
...iddleLayer_for_kyxq/textures/LessonPreview/ani_audio3.png
+0
-0
ani_audio3.png.meta
...Layer_for_kyxq/textures/LessonPreview/ani_audio3.png.meta
+36
-0
bg_di.png
assets/middleLayer_for_kyxq/textures/LessonPreview/bg_di.png
+0
-0
btn_audio.png
...middleLayer_for_kyxq/textures/LessonPreview/btn_audio.png
+0
-0
No files found.
assets/middleLayer_for_kyxq/audioPlay.anim
0 → 100644
View file @
912fb60f
{
"__type__": "cc.AnimationClip",
"_name": "audioPlay",
"_objFlags": 0,
"_native": "",
"_duration": 1.0166666666666666,
"sample": 60,
"speed": 1,
"wrapMode": 2,
"curveData": {
"comps": {
"cc.Sprite": {
"spriteFrame": [
{
"frame": 0,
"value": {
"__uuid__": "e7613ee0-6552-4685-9da2-2086a30f6ba5"
}
},
{
"frame": 0.3333333333333333,
"value": {
"__uuid__": "7d0546e8-bfc5-4f8d-949b-942460801e63"
}
},
{
"frame": 0.6666666666666666,
"value": {
"__uuid__": "bc4f5af0-f203-4851-8968-0f0a1e47103e"
}
},
{
"frame": 1,
"value": {
"__uuid__": "e7613ee0-6552-4685-9da2-2086a30f6ba5"
}
}
]
}
}
},
"events": []
}
\ No newline at end of file
assets/middleLayer_for_kyxq/audioPlay.anim.meta
0 → 100644
View file @
912fb60f
{
"ver": "2.1.0",
"uuid": "e061dd30-01a9-4011-bd01-594dd99fb4e1",
"subMetas": {}
}
\ No newline at end of file
assets/middleLayer_for_kyxq/scene/middleLayer_for_kyxq.fire
View file @
912fb60f
This diff is collapsed.
Click to expand it.
assets/middleLayer_for_kyxq/script/LessonPreview.ts
View file @
912fb60f
...
...
@@ -4,7 +4,7 @@
// - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
// - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html
import
{
playAudioByUrl
,
getSprNodeByUrl
,
setSprNodeMaxLen
,
asyncCallNetworkApiGet
,
asyncCallNetworkApiPost
,
getSpriteFrimeByUrl
,
asyncDelay
}
from
"
./util
"
;
import
{
playAudioByUrl
,
playAnimationOnNode
,
getSprNodeByUrl
,
setSprNodeMaxLen
,
asyncCallNetworkApiGet
,
asyncCallNetworkApiPost
,
getSpriteFrimeByUrl
,
asyncDelay
}
from
"
./util
"
;
const
{
ccclass
,
property
}
=
cc
.
_decorator
;
...
...
@@ -30,6 +30,8 @@ export default class LessonPreviewClass extends cc.Component {
btn_audio
:
cc
.
Node
=
null
;
@
property
(
cc
.
Label
)
lblAudio
:
cc
.
Label
=
null
;
@
property
(
cc
.
Node
)
AniAudio
:
cc
.
Node
=
null
;
onClickClose
()
{
this
.
audio_url
=
null
...
...
@@ -92,25 +94,29 @@ export default class LessonPreviewClass extends cc.Component {
if
(
this
.
curPageIndex
<
this
.
data
.
length
)
this
.
curPageIndex
++
this
.
refreshUI
()
}
isAudioPlaying
=
false
audio_url
playAudioId
aniPlay
=
null
;
onClickAudio
()
{
if
(
!
this
.
audio_url
)
{
return
;
}
if
(
this
.
isAudioPlaying
)
{
cc
.
audioEngine
.
stop
(
this
.
playAudioId
);
this
.
aniPlay
&&
this
.
aniPlay
.
stop
()
this
.
isAudioPlaying
=
false
;
}
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
"
);
cc
.
audioEngine
.
setFinishCallback
(
this
.
playAudioId
,
()
=>
{
this
.
playAudioId
=
null
this
.
playAudioId
=
null
;
this
.
isAudioPlaying
=
false
;
this
.
aniPlay
&&
this
.
aniPlay
.
stop
()
});
})
}
...
...
assets/middleLayer_for_kyxq/script/util.ts
View file @
912fb60f
...
...
@@ -46,6 +46,12 @@ export function exchangeNodePos(baseNode, targetNode) {
return
baseNode
.
convertToNodeSpaceAR
(
targetNode
.
_parent
.
convertToWorldSpaceAR
(
cc
.
v2
(
targetNode
.
x
,
targetNode
.
y
)));
}
export
function
playAnimationOnNode
(
node
,
aniName
)
{
const
animationState
=
node
.
getComponent
(
cc
.
Animation
).
getAnimationState
(
aniName
);
animationState
.
play
();
return
animationState
;
}
export
function
RandomInt
(
a
,
b
=
0
)
{
let
max
=
Math
.
max
(
a
,
b
);
let
min
=
Math
.
min
(
a
,
b
);
...
...
assets/middleLayer_for_kyxq/textures/LessonPreview/ani_audio1.png
0 → 100644
View file @
912fb60f
995 Bytes
assets/middleLayer_for_kyxq/textures/LessonPreview/ani_audio1.png.meta
0 → 100644
View file @
912fb60f
{
"ver": "2.3.5",
"uuid": "eac4f663-9a0a-4ce5-9d97-e8d9d1035566",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 106,
"height": 34,
"platformSettings": {},
"subMetas": {
"ani_audio1": {
"ver": "1.0.4",
"uuid": "e7613ee0-6552-4685-9da2-2086a30f6ba5",
"rawTextureUuid": "eac4f663-9a0a-4ce5-9d97-e8d9d1035566",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 106,
"height": 34,
"rawWidth": 106,
"rawHeight": 34,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
assets/middleLayer_for_kyxq/textures/LessonPreview/ani_audio2.png
0 → 100644
View file @
912fb60f
982 Bytes
assets/middleLayer_for_kyxq/textures/LessonPreview/ani_audio2.png.meta
0 → 100644
View file @
912fb60f
{
"ver": "2.3.5",
"uuid": "873c5b57-fa49-4b16-8a76-9edff9d503fc",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 106,
"height": 34,
"platformSettings": {},
"subMetas": {
"ani_audio2": {
"ver": "1.0.4",
"uuid": "7d0546e8-bfc5-4f8d-949b-942460801e63",
"rawTextureUuid": "873c5b57-fa49-4b16-8a76-9edff9d503fc",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 106,
"height": 34,
"rawWidth": 106,
"rawHeight": 34,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
assets/middleLayer_for_kyxq/textures/LessonPreview/ani_audio3.png
0 → 100644
View file @
912fb60f
974 Bytes
assets/middleLayer_for_kyxq/textures/LessonPreview/ani_audio3.png.meta
0 → 100644
View file @
912fb60f
{
"ver": "2.3.5",
"uuid": "67188343-4d8b-4eab-8d4f-e237a94229a8",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 106,
"height": 34,
"platformSettings": {},
"subMetas": {
"ani_audio3": {
"ver": "1.0.4",
"uuid": "bc4f5af0-f203-4851-8968-0f0a1e47103e",
"rawTextureUuid": "67188343-4d8b-4eab-8d4f-e237a94229a8",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 106,
"height": 34,
"rawWidth": 106,
"rawHeight": 34,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
assets/middleLayer_for_kyxq/textures/LessonPreview/bg_di.png
View replaced file @
4a07559d
View file @
912fb60f
248 KB
|
W:
|
H:
139 KB
|
W:
|
H:
2-up
Swipe
Onion skin
assets/middleLayer_for_kyxq/textures/LessonPreview/btn_audio.png
View replaced file @
4a07559d
View file @
912fb60f
2.04 KB
|
W:
|
H:
1.36 KB
|
W:
|
H:
2-up
Swipe
Onion skin
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