Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
sn02_playAudio
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
sn02_playAudio
Commits
d7929c87
Commit
d7929c87
authored
Sep 27, 2023
by
yu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
7fc6d2af
Changes
8
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
383 additions
and
187 deletions
+383
-187
sn02_playAudio.fire
assets/sn02_playAudio/scene/sn02_playAudio.fire
+226
-126
sn02_playAudio.ts
assets/sn02_playAudio/scene/sn02_playAudio.ts
+18
-7
Game_sn02_playAudio.ts
assets/sn02_playAudio/scene/tool/Game_sn02_playAudio.ts
+2
-3
defaultData_sn02_playAudio.ts
assets/sn02_playAudio/script/defaultData_sn02_playAudio.ts
+71
-32
rect_sn02_audio.png
assets/sn02_playAudio/textures/rect_sn02_audio.png
+0
-0
rect_sn02_audio.png.meta
assets/sn02_playAudio/textures/rect_sn02_audio.png.meta
+36
-0
form.component.html
form/src/app/form/form.component.html
+27
-18
form.component.ts
form/src/app/form/form.component.ts
+3
-1
No files found.
assets/sn02_playAudio/scene/sn02_playAudio.fire
View file @
d7929c87
This diff is collapsed.
Click to expand it.
assets/sn02_playAudio/scene/sn02_playAudio.ts
View file @
d7929c87
...
...
@@ -85,6 +85,8 @@ export default class SceneComponent extends MyCocosSceneComponent {
@
property
(
cc
.
Node
)
btn_playall
:
cc
.
Node
=
null
;
@
property
(
cc
.
Node
)
btn_replay
:
cc
.
Node
=
null
;
@
property
(
cc
.
Node
)
label_title
:
cc
.
Node
=
null
;
@
property
(
cc
.
Node
)
label_t2
:
cc
.
Node
=
null
;
...
...
@@ -164,6 +166,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
})
this
.
showLeft
();
this
.
btn_playall
.
on
(
cc
.
Node
.
EventType
.
TOUCH_END
,
this
.
onPlayAll
,
this
);
this
.
btn_replay
.
on
(
cc
.
Node
.
EventType
.
TOUCH_END
,
this
.
onReplay
,
this
);
cc
.
find
(
"
label_len
"
,
this
.
btn_playall
).
getComponent
(
cc
.
Label
).
string
=
"
(
"
+
op
.
length
+
"
)
"
;
cc
.
find
(
"
scrollView
"
,
this
.
layout_game
).
on
(
"
scroll-began
"
,
()
=>
{
this
.
playLocalAudio
(
"
gun
"
);
...
...
@@ -175,9 +178,17 @@ export default class SceneComponent extends MyCocosSceneComponent {
if
(
this
.
isPlayAudio
)
return
;
this
.
autoPlayAudio
();
}
private
onReplay
()
{
this
.
btn_replay
.
active
=
false
;
this
.
itemIdx
=
0
;
this
.
autoPlayAudio
();
}
private
autoPlayAudio
()
{
let
op
=
Game
.
getIns
().
getCurrentPage
().
optionList
[
this
.
itemIdx
];
if
(
!
op
)
return
;
if
(
!
op
)
{
this
.
btn_replay
.
active
=
true
;
return
;
}
pg
.
audio
.
playAudioByUrl
(
Game
.
getIns
().
getCurrentPage
().
optionList
[
this
.
itemIdx
].
audioUrl
,
(
id
)
=>
{
this
.
itemAudioId
=
id
;
this
.
updateTime
();
...
...
@@ -187,7 +198,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
this
.
autoPlayAudio
();
}
});
this
.
showLeft
();
//
this.showLeft();
this
.
updateItems
();
}
private
itemAudioId
;
...
...
@@ -229,7 +240,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
}
});
this
.
itemIdx
=
idx
;
this
.
showLeft
();
//
this.showLeft();
this
.
updateItems
();
})
...
...
@@ -253,10 +264,10 @@ export default class SceneComponent extends MyCocosSceneComponent {
}
private
showLeft
()
{
let
data
=
Game
.
getIns
().
getCurrentPage
()
.
optionList
[
this
.
itemIdx
]
;
this
.
label_title
.
getComponent
(
cc
.
Label
).
string
=
data
.
text
;
this
.
label_t2
.
getComponent
(
cc
.
Label
).
string
=
data
.
desc
;
pg
.
view
.
setNetImg
(
this
.
bg_img
,
data
.
picUrl
,
{
w
:
305
,
h
:
382
})
let
data
=
Game
.
getIns
().
getCurrentPage
();
this
.
label_title
.
getComponent
(
cc
.
Label
).
string
=
data
.
desc
;
this
.
label_t2
.
getComponent
(
cc
.
Label
).
string
=
data
.
text
;
pg
.
view
.
setNetImg
(
this
.
bg_img
,
data
.
image
,
{
w
:
305
,
h
:
382
})
}
private
itemDuration
=
0
;
private
updateTime
()
{
...
...
assets/sn02_playAudio/scene/tool/Game_sn02_playAudio.ts
View file @
d7929c87
...
...
@@ -48,7 +48,7 @@ export class Item {
public
optionList
;
public
bgItem
;
public
hotZoneItemArr
;
public
pointsArr
;
public
desc
;
public
text
:
string
;
public
isClick
:
boolean
;
public
type
;
...
...
@@ -56,8 +56,7 @@ export class Item {
constructor
(
data
,
page
)
{
this
.
audio
=
data
.
audio
;
this
.
text
=
data
.
text
;
this
.
bgItem
=
data
.
bgItem
;
this
.
hotZoneItemArr
=
data
.
hotZoneItemArr
;
this
.
desc
=
data
.
desc
;
this
.
page
=
page
;
this
.
type
=
data
.
type
||
"
txt
"
;
this
.
image
=
data
.
image
||
""
;
...
...
assets/sn02_playAudio/script/defaultData_sn02_playAudio.ts
View file @
d7929c87
...
...
@@ -2,82 +2,121 @@ export const defaultData = {
"
questions
"
:
[{
"
options
"
:
[{
"
type
"
:
"
txt
"
,
"
image
"
:
"
http://staging-teach.cdn.ireadabc.com/95df6e27bfce8b01a4250e877ba6aa3e.png
"
,
"
image
"
:
""
,
"
audio
"
:
"
http://staging-teach.cdn.ireadabc.com/83268f4def70e408cf9243bc214592b6_l.mp3
"
,
"
text
"
:
"
startstart
"
,
"
text
"
:
"
Theme sone - Track 1
"
,
"
desc
"
:
""
,
"
audioTitle
"
:
""
,
"
time
"
:
""
,
"
right
"
:
false
,
"
audioName
"
:
"
bear_1.mp3
"
,
"
desc
"
:
"
start
"
"
audioName
"
:
"
bear_1.mp3
"
},
{
"
type
"
:
"
txt
"
,
"
image
"
:
"
http://staging-teach.cdn.ireadabc.com/274e8acd17edf25f9fc610f650ea37a2.png
"
,
"
image
"
:
""
,
"
audio
"
:
"
http://staging-teach.cdn.ireadabc.com/944ae51b57fb9390dd03104d9651e5f4_l.mp3
"
,
"
text
"
:
"
fast fast
"
,
"
text
"
:
"
Theme sone - Track 2
"
,
"
desc
"
:
""
,
"
audioTitle
"
:
""
,
"
time
"
:
""
,
"
right
"
:
false
,
"
audioName
"
:
"
bear_2.mp3
"
,
"
desc
"
:
"
fast
"
"
audioName
"
:
"
bear_2.mp3
"
},
{
"
type
"
:
"
txt
"
,
"
image
"
:
"
http://staging-teach.cdn.ireadabc.com/c0bb6a1eca5c75522010a4d26c519d33.png
"
,
"
image
"
:
""
,
"
audio
"
:
"
http://staging-teach.cdn.ireadabc.com/36067f9e2415d59fa37c3795a3929087_l.mp3
"
,
"
text
"
:
"
bbtime
"
,
"
text
"
:
"
Theme sone - Track 3
"
,
"
desc
"
:
""
,
"
audioTitle
"
:
""
,
"
time
"
:
""
,
"
right
"
:
false
,
"
audioName
"
:
"
bear_3.mp3
"
,
"
desc
"
:
"
time
"
"
audioName
"
:
"
bear_3.mp3
"
},
{
"
type
"
:
"
txt
"
,
"
image
"
:
"
http://staging-teach.cdn.ireadabc.com/557ae63f493c63f51ee745f9b491280d.png
"
,
"
image
"
:
""
,
"
audio
"
:
"
http://staging-teach.cdn.ireadabc.com/449e65975d358514cc3494f9f67bc012_l.mp3
"
,
"
text
"
:
"
seven seven
"
,
"
text
"
:
"
Theme sone - Track 4
"
,
"
desc
"
:
""
,
"
audioTitle
"
:
""
,
"
time
"
:
""
,
"
right
"
:
false
,
"
audioName
"
:
"
cape.mp3
"
},
{
"
type
"
:
"
txt
"
,
"
image
"
:
""
,
"
audio
"
:
"
http://staging-teach.cdn.ireadabc.com/7934cdcec68eabe639020bad5420d7f8_l.mp3
"
,
"
text
"
:
"
Theme sone - Track 5
"
,
"
desc
"
:
""
,
"
audioTitle
"
:
""
,
"
time
"
:
""
,
"
right
"
:
false
,
"
audioName
"
:
"
cape.mp3
"
,
"
desc
"
:
"
seven
"
"
audioName
"
:
"
dsdasdsdasdsdasdsdasdsdasdsdasdsdasdsdasdsdasdsdasdsdasdsdas.mp3
"
},
{
"
type
"
:
"
txt
"
,
"
image
"
:
"
http://staging-teach.cdn.ireadabc.com/6b0f46f023aca058732e6b8a9057d3f0.png
"
,
"
image
"
:
""
,
"
audio
"
:
"
http://staging-teach.cdn.ireadabc.com/c3b69ad3d51385eac7d4195773ef59f7_l.mp3
"
,
"
text
"
:
"
five five
"
,
"
text
"
:
"
Theme sone - Track 6
"
,
"
desc
"
:
""
,
"
audioTitle
"
:
""
,
"
time
"
:
""
,
"
right
"
:
false
,
"
audioName
"
:
"
极速滑雪 游戏说明.MP3
"
,
"
desc
"
:
"
five
"
"
audioName
"
:
"
极速滑雪 游戏说明.MP3
"
},
{
"
type
"
:
"
txt
"
,
"
image
"
:
"
http://staging-teach.cdn.ireadabc.com/64e428e093b15f403ade21b2d6116eb0.png
"
,
"
image
"
:
""
,
"
audio
"
:
"
http://staging-teach.cdn.ireadabc.com/83268f4def70e408cf9243bc214592b6_l.mp3
"
,
"
text
"
:
"
time time
"
,
"
text
"
:
"
Theme sone - Track 7
"
,
"
desc
"
:
""
,
"
audioTitle
"
:
""
,
"
time
"
:
""
,
"
right
"
:
false
,
"
audioName
"
:
"
bear_1.mp3
"
,
"
desc
"
:
"
tt
"
"
audioName
"
:
"
bear_1.mp3
"
},
{
"
type
"
:
"
txt
"
,
"
image
"
:
"
http://staging-teach.cdn.ireadabc.com/aa3966efdfbde6209523ba9781375191.png
"
,
"
image
"
:
""
,
"
audio
"
:
"
http://staging-teach.cdn.ireadabc.com/944ae51b57fb9390dd03104d9651e5f4_l.mp3
"
,
"
text
"
:
"
ame ame
"
,
"
text
"
:
"
Theme sone - Track 8
"
,
"
desc
"
:
""
,
"
audioTitle
"
:
""
,
"
time
"
:
""
,
"
right
"
:
false
,
"
audioName
"
:
"
bear_2.mp3
"
,
"
desc
"
:
"
ame
"
"
audioName
"
:
"
bear_2.mp3
"
},
{
"
type
"
:
"
txt
"
,
"
image
"
:
""
,
"
audio
"
:
"
http://staging-teach.cdn.ireadabc.com/36067f9e2415d59fa37c3795a3929087_l.mp3
"
,
"
text
"
:
"
Theme sone - Track 9
"
,
"
desc
"
:
""
,
"
audioTitle
"
:
""
,
"
time
"
:
""
,
"
right
"
:
false
,
"
audioName
"
:
"
bear_3.mp3
"
},
{
"
type
"
:
"
txt
"
,
"
image
"
:
""
,
"
audio
"
:
"
http://staging-teach.cdn.ireadabc.com/449e65975d358514cc3494f9f67bc012_l.mp3
"
,
"
text
"
:
"
Theme sone - Track 10
"
,
"
desc
"
:
""
,
"
audioTitle
"
:
""
,
"
time
"
:
""
,
"
right
"
:
false
,
"
audioName
"
:
"
cape.mp3
"
}
],
"
type
"
:
"
txt
"
,
"
text
"
:
""
,
"
type
"
:
"
img
"
,
"
text
"
:
"
Starter 1
"
,
"
desc
"
:
"
Magic Trip Review
"
,
"
questionAudio
"
:
""
,
"
image
"
:
""
,
"
image
"
:
"
http://staging-teach.cdn.ireadabc.com/2acdedb9d07a738e0655b9a8aafd286a.jpg
"
,
"
contentMain
"
:
""
,
"
contentArr
"
:
[]
}
],
"
title
"
:
"
音频播放
"
,
"
time
"
:
60
,
"
opleng
"
:
7
,
"
opleng
"
:
10
,
"
word_count
"
:
"
0
"
,
"
sentence_count
"
:
"
0
"
,
"
zi_count
"
:
"
0
"
}
assets/sn02_playAudio/textures/rect_sn02_audio.png
0 → 100644
View file @
d7929c87
3.24 KB
assets/sn02_playAudio/textures/rect_sn02_audio.png.meta
0 → 100644
View file @
d7929c87
{
"ver": "2.3.5",
"uuid": "a461299f-bb6e-4313-a78f-e10cf2cad81d",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 305,
"height": 382,
"platformSettings": {},
"subMetas": {
"rect_sn02_audio": {
"ver": "1.0.4",
"uuid": "53839116-c81a-4bae-aadc-7858f0b901a4",
"rawTextureUuid": "a461299f-bb6e-4313-a78f-e10cf2cad81d",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 305,
"height": 382,
"rawWidth": 305,
"rawHeight": 382,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
form/src/app/form/form.component.html
View file @
d7929c87
...
...
@@ -110,14 +110,6 @@
</nz-radio-group>
</div> -->
</div>
<!-- <div class=" option-text">
<div class="word-input-title">
<span style="color:red;margin-left:-15px">* </span>
<span>文本: </span>
</div>
<input type="text" class="input-place-red" nz-input [(ngModel)]="question.text" placeholder=""
(blur)="save()">
</div>
<div
class=
"option-img"
>
<div>
<div
class=
"word-input-title"
>
...
...
@@ -129,15 +121,32 @@
</app-upload-image-with-preview>
</div>
</div>
</div> -->
</div>
<div
class=
" option-text"
>
<div
class=
"word-input-title"
>
<!-- <span style="color:red;margin-left:-15px">* </span> -->
<span>
封面标题:
</span>
</div>
<input
type=
"text"
class=
"input-place-red"
nz-input
[(
ngModel
)]="
question
.
text
"
placeholder=
""
(
blur
)="
save
()"
>
</div>
<div
class=
" option-text"
>
<div
class=
"word-input-title"
>
<!-- <span style="color:red;margin-left:-15px">* </span> -->
<span>
封面副标题:
</span>
</div>
<input
type=
"text"
class=
"input-place-red"
nz-input
[(
ngModel
)]="
question
.
desc
"
placeholder=
""
(
blur
)="
save
()"
>
</div>
<div
class=
"word-type-option-title"
style=
"margin-top:20px;"
>
选项
内容:
音频
内容:
</div>
<div
*
ngFor=
"let option of question.options; let j = index"
>
<div
style=
"display: flex;margin-top:20px"
>
<div
class=
"option-title"
>
选项
{{j+1}}
音频
{{j+1}}
</div>
<div
class=
"option-content"
style=
"padding: 15px 30px;"
>
<div
class=
"word-input-title"
>
...
...
@@ -185,10 +194,10 @@
</div>
</div>
</div>
<div
class=
"option-img"
>
<
!-- <
div class="option-img">
<div>
<div class="word-input-title">
图片
:
封面
:
</div>
<div style="width: 300px;">
<app-upload-image-with-preview [picUrl]="option.image"
...
...
@@ -199,17 +208,17 @@
</div>
<div *ngIf="option.type=='txt'" class="option-text">
<div class="word-input-title">
<span>
标题:
</span>
<span>
封面
标题: </span>
</div>
<input style="font-size: 22px;" class="input-place-red" type="text" nz-input
[(ngModel)]="option.text" (blur)="save()">
</div>
</div>
-->
<div
*
ngIf=
"option.type=='txt'"
class=
"option-text"
>
<div
class=
"word-input-title"
>
<span>
副标题
:
</span>
<span>
音频名称
:
</span>
</div>
<input
style=
"font-size: 22px;"
class=
"input-place-red"
type=
"text"
nz-input
[(
ngModel
)]="
option
.
desc
"
(
blur
)="
save
()"
>
[(
ngModel
)]="
option
.
text
"
(
blur
)="
save
()"
>
</div>
<!-- <div class="option-time">
<div class="word-input-title">
...
...
@@ -241,7 +250,7 @@
</div>
</div>
<div
*
ngIf=
"item.questions.length <
4
"
style=
"margin-top: 20px;"
>
<div
*
ngIf=
"item.questions.length <
1
"
style=
"margin-top: 20px;"
>
<button
class=
"btn-blue"
style=
"width: 1000px; height: 50px;"
nz-button
nzType=
"default"
nzDanger
(
click
)="
addquestion
()"
>
+增加题目
</button>
</div>
...
...
form/src/app/form/form.component.ts
View file @
d7929c87
...
...
@@ -88,6 +88,7 @@ export class FormComponent extends ComponentBase implements OnInit, OnChanges, O
audio
:
""
,
text
:
""
,
desc
:
""
,
audioTitle
:
""
,
time
:
""
,
right
:
false
});
...
...
@@ -106,8 +107,9 @@ export class FormComponent extends ComponentBase implements OnInit, OnChanges, O
addquestion
()
{
this
.
item
.
questions
.
push
({
options
:
[],
type
:
"
txt
"
,
type
:
"
img
"
,
text
:
""
,
desc
:
""
,
questionAudio
:
""
,
// wordAudio: "",
// wordAudioName: "",
...
...
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