Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
ls_gramophone
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
ls_gramophone
Commits
f58b805b
Commit
f58b805b
authored
Jun 10, 2022
by
李帅
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
+1
parent
225ebf93
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
345 additions
and
238 deletions
+345
-238
ls_gramophone.fire
assets/ls_gramophone/scene/ls_gramophone.fire
+309
-223
ls_gramophone.ts
assets/ls_gramophone/scene/ls_gramophone.ts
+27
-11
defaultData.ts
assets/ls_gramophone/script/defaultData.ts
+9
-4
No files found.
assets/ls_gramophone/scene/ls_gramophone.fire
View file @
f58b805b
This diff is collapsed.
Click to expand it.
assets/ls_gramophone/scene/ls_gramophone.ts
View file @
f58b805b
/*
/*
* @Author: ls
* @Author: ls
* @Date: 2022-05-15 18:22:18
* @Date: 2022-05-15 18:22:18
* @LastEditTime: 2022-06-
08 23:00:12
* @LastEditTime: 2022-06-
10 11:11:44
* @LastEditors: ls
* @LastEditors: ls
* @Description:
* @Description:
* @FilePath: \ls_gramophone\assets\ls_gramophone\scene\ls_gramophone.ts
* @FilePath: \ls_gramophone\assets\ls_gramophone\scene\ls_gramophone.ts
...
@@ -30,6 +30,9 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -30,6 +30,9 @@ export default class SceneComponent extends MyCocosSceneComponent {
// 倒计时
// 倒计时
_countdown
=
30
;
_countdown
=
30
;
// 当前
_curIndex
=
-
1
;
addPreloadImage
()
{
addPreloadImage
()
{
// TODO 根据自己的配置预加载图片资源
// TODO 根据自己的配置预加载图片资源
this
.
_imageResList
.
push
({
url
:
this
.
data
.
pageImage
});
this
.
_imageResList
.
push
({
url
:
this
.
data
.
pageImage
});
...
@@ -69,9 +72,11 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -69,9 +72,11 @@ export default class SceneComponent extends MyCocosSceneComponent {
cc
.
find
(
'
Canvas/bg_title/label
'
).
getComponent
(
cc
.
Label
).
string
=
this
.
data
.
title
;
cc
.
find
(
'
Canvas/bg_title/label
'
).
getComponent
(
cc
.
Label
).
string
=
this
.
data
.
title
;
// this.getSpriteFrimeByUrl(this.data.pageImage + '?x-oss-process=image/resize,m_lfit,h_143,w_560', (sp) => {
this
.
getSpriteFrimeByUrl
(
this
.
data
.
pageImage
+
'
?x-oss-process=image/resize,m_fill,h_520,w_560
'
,
(
sp
)
=>
{
this
.
getSpriteFrimeByUrl
(
this
.
data
.
pageImage
,
(
sp
)
=>
{
// this.getSpriteFrimeByUrl(this.data.pageImage, (sp) => {
cc
.
find
(
'
Canvas/bg_img
'
).
getComponent
(
cc
.
Sprite
).
spriteFrame
=
sp
;
cc
.
find
(
'
Canvas/bg_img/img
'
).
getComponent
(
cc
.
Sprite
).
spriteFrame
=
sp
;
cc
.
find
(
'
Canvas/bg_img/img
'
).
scale
=
Math
.
max
(
520
/
cc
.
find
(
'
Canvas/bg_img/img
'
).
width
,
560
/
cc
.
find
(
'
Canvas/bg_img/img
'
).
height
);
});
});
let
play
=
cc
.
find
(
'
Canvas/btn_play
'
);
let
play
=
cc
.
find
(
'
Canvas/btn_play
'
);
...
@@ -81,14 +86,16 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -81,14 +86,16 @@ export default class SceneComponent extends MyCocosSceneComponent {
play
.
off
(
'
click
'
);
play
.
off
(
'
click
'
);
stop
.
off
(
'
click
'
);
stop
.
off
(
'
click
'
);
play
.
on
(
'
click
'
,
()
=>
{
play
.
on
(
'
click
'
,
()
=>
{
this
.
resetText
();
this
.
resetRecord
();
cc
.
audioEngine
.
stopAll
();
cc
.
audioEngine
.
stopAll
();
play
.
active
=
false
;
play
.
active
=
false
;
stop
.
active
=
true
;
stop
.
active
=
true
;
});
});
stop
.
on
(
'
click
'
,
()
=>
{
stop
.
on
(
'
click
'
,
()
=>
{
this
.
resetText
();
this
.
resetRecord
();
cc
.
audioEngine
.
stopAll
();
play
.
active
=
true
;
play
.
active
=
true
;
stop
.
active
=
false
;
stop
.
active
=
false
;
...
@@ -144,6 +151,8 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -144,6 +151,8 @@ export default class SceneComponent extends MyCocosSceneComponent {
mask
.
active
=
true
;
mask
.
active
=
true
;
record_start
.
active
=
true
;
record_start
.
active
=
true
;
record_stop
.
active
=
false
;
record_stop
.
active
=
false
;
this
.
_curIndex
=
index
;
});
});
element
.
getComponent
(
Item
).
hideRecord
();
element
.
getComponent
(
Item
).
hideRecord
();
...
@@ -173,8 +182,9 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -173,8 +182,9 @@ export default class SceneComponent extends MyCocosSceneComponent {
// 录音界面
// 录音界面
let
mask
=
cc
.
find
(
'
Canvas/mask
'
);
let
mask
=
cc
.
find
(
'
Canvas/mask
'
);
mask
.
active
=
false
;
mask
.
active
=
false
;
let
icon_record
=
cc
.
find
(
'
Canvas/mask/icon_record
'
);
let
icon_record
=
cc
.
find
(
'
Canvas/mask/icon_record
'
);
icon_record
.
active
=
false
;
// icon_record.getComponent(dragonBones.ArmatureDisplay).timeScale = 0
;
let
record_start
=
cc
.
find
(
'
Canvas/btn_record_start
'
);
let
record_start
=
cc
.
find
(
'
Canvas/btn_record_start
'
);
let
record_stop
=
cc
.
find
(
'
Canvas/btn_record_stop
'
);
let
record_stop
=
cc
.
find
(
'
Canvas/btn_record_stop
'
);
...
@@ -188,14 +198,18 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -188,14 +198,18 @@ export default class SceneComponent extends MyCocosSceneComponent {
this
.
playLocalAudio
(
'
btn
'
);
this
.
playLocalAudio
(
'
btn
'
);
mask
.
active
=
true
;
mask
.
active
=
true
;
icon_record
.
active
=
true
;
// icon_record.getComponent(dragonBones.ArmatureDisplay).timeScale = 1
;
record_start
.
active
=
false
;
record_start
.
active
=
false
;
record_stop
.
active
=
true
;
record_stop
.
active
=
true
;
countdown
.
active
=
true
;
countdown
.
active
=
true
;
let
cd
=
10
;
if
(
this
.
_curIndex
!==
-
1
)
{
cd
=
this
.
data
.
sentences
[
this
.
_curIndex
].
countdown
;
}
this
.
unschedule
(
this
.
onCountdown
);
this
.
unschedule
(
this
.
onCountdown
);
this
.
_countdown
=
30
+
1
;
this
.
_countdown
=
cd
+
1
;
this
.
onCountdown
();
this
.
onCountdown
();
this
.
schedule
(
this
.
onCountdown
,
1
);
this
.
schedule
(
this
.
onCountdown
,
1
);
...
@@ -209,13 +223,14 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -209,13 +223,14 @@ export default class SceneComponent extends MyCocosSceneComponent {
this
.
playLocalAudio
(
'
btn
'
);
this
.
playLocalAudio
(
'
btn
'
);
mask
.
active
=
false
;
mask
.
active
=
false
;
icon_record
.
active
=
false
;
// icon_record.getComponent(dragonBones.ArmatureDisplay).timeScale = 0
;
record_start
.
active
=
false
;
record_start
.
active
=
false
;
record_stop
.
active
=
false
;
record_stop
.
active
=
false
;
countdown
.
active
=
false
;
countdown
.
active
=
false
;
this
.
unschedule
(
this
.
onCountdown
);
this
.
unschedule
(
this
.
onCountdown
);
this
.
_curIndex
=
-
1
;
this
.
_recording
=
false
;
this
.
_recording
=
false
;
...
@@ -368,8 +383,9 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -368,8 +383,9 @@ export default class SceneComponent extends MyCocosSceneComponent {
}
}
onCallBack
(
event
:
cc
.
Event
.
EventTouch
,
str
:
string
)
{
onCallBack
(
event
:
cc
.
Event
.
EventTouch
,
str
:
string
)
{
this
.
playLocalAudio
(
'
btn
'
);
if
(
str
===
'
start
'
||
str
===
'
restart
'
)
{
if
(
str
===
'
start
'
||
str
===
'
restart
'
)
{
cc
.
audioEngine
.
stopAll
();
this
.
playLocalAudio
(
'
btn
'
);
this
.
hideTip
();
this
.
hideTip
();
}
else
if
(
str
===
'
record_start
'
)
{
}
else
if
(
str
===
'
record_start
'
)
{
}
else
if
(
str
===
'
record_stop
'
)
{
}
else
if
(
str
===
'
record_stop
'
)
{
...
...
assets/ls_gramophone/script/defaultData.ts
View file @
f58b805b
/*
/*
* @Author: ls
* @Author: ls
* @Date: 2022-05-15 18:22:18
* @Date: 2022-05-15 18:22:18
* @LastEditTime: 2022-06-
08 21:16:09
* @LastEditTime: 2022-06-
10 10:54:08
* @LastEditors: ls
* @LastEditors: ls
* @Description:
* @Description:
* @FilePath: \ls_gramophone\assets\ls_gramophone\script\defaultData.ts
* @FilePath: \ls_gramophone\assets\ls_gramophone\script\defaultData.ts
...
@@ -15,23 +15,28 @@ export const defaultData = {
...
@@ -15,23 +15,28 @@ export const defaultData = {
pageAudio
:
'
http://staging-teach.cdn.ireadabc.com/c0e467e1950cb24b1e581737a1344cb4.mp3
'
,
// 整体音频
pageAudio
:
'
http://staging-teach.cdn.ireadabc.com/c0e467e1950cb24b1e581737a1344cb4.mp3
'
,
// 整体音频
sentences
:
[
sentences
:
[
{
{
countdown
:
7
,
text
:
'
Good morning
'
,
text
:
'
Good morning
'
,
audio
:
'
http://staging-teach.cdn.ireadabc.com/
17edcaecd09a72a64a77480673cdc232
.mp3
'
,
audio
:
'
http://staging-teach.cdn.ireadabc.com/
c0e467e1950cb24b1e581737a1344cb4
.mp3
'
,
},
},
{
{
countdown
:
8
,
text
:
'
what can i do for you
'
,
text
:
'
what can i do for you
'
,
audio
:
'
http://staging-teach.cdn.ireadabc.com/
17edcaecd09a72a64a77480673cdc232
.mp3
'
,
audio
:
'
http://staging-teach.cdn.ireadabc.com/
c0e467e1950cb24b1e581737a1344cb4
.mp3
'
,
},
},
{
{
countdown
:
9
,
text
:
'
Hello, how are you
'
,
text
:
'
Hello, how are you
'
,
audio
:
'
http://staging-teach.cdn.ireadabc.com/17edcaecd09a72a64a77480673cdc232.mp3
'
,
audio
:
'
http://staging-teach.cdn.ireadabc.com/17edcaecd09a72a64a77480673cdc232.mp3
'
,
},
},
{
{
countdown
:
10
,
text
:
'
Hello, how old are you you
'
,
text
:
'
Hello, how old are you you
'
,
audio
:
'
http://staging-teach.cdn.ireadabc.com/17edcaecd09a72a64a77480673cdc232.mp3
'
,
audio
:
'
http://staging-teach.cdn.ireadabc.com/17edcaecd09a72a64a77480673cdc232.mp3
'
,
},
},
{
{
text
:
'
Hello, how dare you, Hello, how dare you
'
,
countdown
:
11
,
text
:
'
Hello, how dare you, Hello, how dare you how dare you how dare you how dare you h
'
,
audio
:
'
http://staging-teach.cdn.ireadabc.com/17edcaecd09a72a64a77480673cdc232.mp3
'
,
audio
:
'
http://staging-teach.cdn.ireadabc.com/17edcaecd09a72a64a77480673cdc232.mp3
'
,
},
},
],
],
...
...
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