Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
SSAPP2501
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
SSAPP2501
Commits
f47733d4
Commit
f47733d4
authored
Aug 03, 2025
by
Tt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
成功流程完成
parent
42b79416
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
92 additions
and
19 deletions
+92
-19
SSAPP2501.fire
assets/SSAPP2501/scene/SSAPP2501.fire
+5
-5
SSAPP2501.ts
assets/SSAPP2501/scene/SSAPP2501.ts
+61
-13
defaultData.ts
assets/SSAPP2501/script/defaultData.ts
+26
-1
No files found.
assets/SSAPP2501/scene/SSAPP2501.fire
View file @
f47733d4
...
...
@@ -6182,7 +6182,7 @@
"__id__": 119
},
"_children": [],
"_active":
fals
e,
"_active":
tru
e,
"_components": [
{
"__id__": 125
...
...
@@ -6199,7 +6199,7 @@
},
"_contentSize": {
"__type__": "cc.Size",
"width": 4
45
,
"width": 4
00
,
"height": 508
},
"_anchorPoint": {
...
...
@@ -6211,8 +6211,8 @@
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
10.311
,
20.623
,
0
,
0.332
,
0,
0,
0,
...
...
@@ -6255,7 +6255,7 @@
"__uuid__": "f43e0539-0f77-4a83-82d2-2742f234e820"
},
"_type": 0,
"_sizeMode":
1
,
"_sizeMode":
0
,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
...
...
assets/SSAPP2501/scene/SSAPP2501.ts
View file @
f47733d4
...
...
@@ -498,33 +498,33 @@ export default class SceneComponent extends MyCocosSceneComponent {
let
btn_record_0
=
pg
.
view
.
find
(
this
.
layout_speak
,
'
btn_record_0
'
);
let
btn_record_1
=
pg
.
view
.
find
(
this
.
layout_speak
,
'
btn_record_1
'
);
let
btn_record_2
=
pg
.
view
.
find
(
this
.
layout_speak
,
'
btn_record_2
'
);
// 确保所有按钮都存在
if
(
!
btn_record_0
||
!
btn_record_1
||
!
btn_record_2
)
{
return
this
.
log
(
'
录音按钮节点不存在
'
);
}
// 初始状态:显示第一个按钮,隐藏其他按钮
btn_record_0
.
active
=
true
;
btn_record_1
.
active
=
false
;
btn_record_2
.
active
=
false
;
// 清除可能存在的旧定时器
if
(
this
.
_voiceAniTimer
)
{
clearInterval
(
this
.
_voiceAniTimer
);
this
.
_voiceAniTimer
=
null
;
}
// 当前显示的按钮索引
let
currentIndex
=
0
;
// 创建定时器,每隔200毫秒切换一次按钮显示
this
.
_voiceAniTimer
=
setInterval
(()
=>
{
// 隐藏所有按钮
btn_record_0
.
active
=
false
;
btn_record_1
.
active
=
false
;
btn_record_2
.
active
=
false
;
// 根据当前索引显示对应按钮
switch
(
currentIndex
)
{
case
0
:
...
...
@@ -537,12 +537,12 @@ export default class SceneComponent extends MyCocosSceneComponent {
btn_record_2
.
active
=
true
;
break
;
}
// 更新索引,循环显示三个按钮
currentIndex
=
(
currentIndex
+
1
)
%
3
;
},
200
);
}
/**
* 停止录音动画效果
* 停止按钮切换,只显示btn_record_0
...
...
@@ -553,26 +553,26 @@ export default class SceneComponent extends MyCocosSceneComponent {
clearInterval
(
this
.
_voiceAniTimer
);
this
.
_voiceAniTimer
=
null
;
}
// 获取录音按钮节点
let
btn_record_0
=
pg
.
view
.
find
(
this
.
layout_speak
,
'
btn_record_0
'
);
let
btn_record_1
=
pg
.
view
.
find
(
this
.
layout_speak
,
'
btn_record_1
'
);
let
btn_record_2
=
pg
.
view
.
find
(
this
.
layout_speak
,
'
btn_record_2
'
);
// 确保所有按钮都存在
if
(
!
btn_record_0
||
!
btn_record_1
||
!
btn_record_2
)
{
return
this
.
log
(
'
录音按钮节点不存在
'
);
}
// 只显示第一个按钮,隐藏其他按钮
btn_record_0
.
active
=
true
;
btn_record_1
.
active
=
false
;
btn_record_2
.
active
=
false
;
}
// 录音动画定时器
private
_voiceAniTimer
:
any
=
null
;
showCard
(
hide
:
boolean
=
false
,
recordState
:
string
=
'
init
'
)
{
if
(
!
hide
)
{
// 显示卡片
...
...
@@ -588,6 +588,54 @@ export default class SceneComponent extends MyCocosSceneComponent {
let
btn_record_0
=
pg
.
view
.
find
(
this
.
layout_speak
,
'
btn_record_0
'
);
let
btn_record_1
=
pg
.
view
.
find
(
this
.
layout_speak
,
'
btn_record_1
'
);
let
btn_record_2
=
pg
.
view
.
find
(
this
.
layout_speak
,
'
btn_record_2
'
);
let
bg_card
=
pg
.
view
.
find
(
this
.
layout_speak
,
'
bg_card
'
);
let
btn_voice
=
pg
.
view
.
find
(
bg_card
,
'
btn_voice
'
);
let
icon
=
pg
.
view
.
find
(
bg_card
,
'
icon
'
);
let
word
=
pg
.
view
.
find
(
bg_card
,
'
word
'
);
let
label_progress
=
pg
.
view
.
find
(
bg_card
,
'
label_progress
'
);
// 任务1: 处理btn_voice按钮显示和音频播放
if
(
currentData
.
audioUrl
)
{
// 如果数据中有audio,显示语音按钮
pg
.
view
.
visible
(
btn_voice
,
true
);
// 绑定点击事件播放音频
pg
.
view
.
touchOn
(
btn_voice
,
()
=>
{
// 使用pg.ts的API播放音频
pg
.
audio
.
playAudioByUrl
(
currentData
.
audioUrl
);
},
this
);
}
else
{
// 没有音频则隐藏按钮
pg
.
view
.
visible
(
btn_voice
,
false
);
}
// 任务2: 处理icon和word的显示逻辑
if
(
currentData
.
type
===
'
img
'
)
{
// 如果类型是img,显示图片,隐藏文字
pg
.
view
.
visible
(
icon
,
true
);
pg
.
view
.
visible
(
word
,
false
);
// 设置图片内容
if
(
currentData
.
picUrl
)
{
pg
.
view
.
setNetImg
(
icon
,
currentData
.
picUrl
,
{
w
:
945
,
h
:
500
});
}
}
else
{
// 否则显示文字,隐藏图片
pg
.
view
.
visible
(
icon
,
false
);
pg
.
view
.
visible
(
word
,
true
);
// 设置文字内容
if
(
currentData
.
txt
)
{
pg
.
view
.
setString
(
word
,
currentData
.
txt
);
}
}
// 任务3: 设置进度显示
// 获取当前正确答题的数量和总题目数量
// 使用player.right表示录音返回结果不是tryagain的答题数据数量
const
correctAnswers
=
Game
.
getIns
().
player
.
right
;
const
totalQuestions
=
Game
.
getIns
().
total
;
// 设置进度文本 (正确答题数量)/(总数)
pg
.
view
.
setString
(
label_progress
,
`
${
correctAnswers
+
1
}
/
${
totalQuestions
}
`
);
// 绑定按钮事件
pg
.
view
.
touchOn
(
btn_start
,
this
.
onTouchRecord
,
this
);
...
...
assets/SSAPP2501/script/defaultData.ts
View file @
f47733d4
...
...
@@ -9,5 +9,30 @@
* @type {Object}
*/
export
const
defaultData
=
{
"
score
"
:
0
,
"
title
"
:
""
,
"
questionText
"
:
""
,
"
questionType
"
:
"
read
"
,
"
questionTextAudio
"
:
""
,
"
bgAudio
"
:
""
,
"
questions
"
:
[{
"
type
"
:
"
img
"
,
"
audio
"
:
"
http://staging-teach.cdn.ireadabc.com/ae2538a7ef5de1b4836a882d625271af_l.mp3
"
,
"
text
"
:
"
left
"
,
"
image
"
:
"
http://staging-teach.cdn.ireadabc.com/41b95f47d23e0712f825eec9e718caed.png
"
,
"
time
"
:
null
,
"
duration
"
:
30
,
"
audioName
"
:
"
heal_money.mp3
"
},
{
"
type
"
:
"
img
"
,
"
audio
"
:
"
http://staging-teach.cdn.ireadabc.com/4f3bb8f8fa048f40c1bb5d6d2f6d9a33_l.mp3
"
,
"
text
"
:
"
down
"
,
"
image
"
:
"
http://staging-teach.cdn.ireadabc.com/fbe3d792ce2a72310e5298e1d75d0d71.png
"
,
"
time
"
:
null
,
"
duration
"
:
30
,
"
audioName
"
:
"
shoot.MP3
"
},
{
"
type
"
:
"
img
"
,
"
audio
"
:
"
http://staging-teach.cdn.ireadabc.com/a6fb6452f0e383808cd056939ed81917_l.mp3
"
,
"
text
"
:
"
circle
"
,
"
image
"
:
"
http://staging-teach.cdn.ireadabc.com/d0652838333e892b5e495fbdd8746fa0.png
"
,
"
time
"
:
null
,
"
duration
"
:
30
,
"
audioName
"
:
"
levelup.MP3
"
},
{
"
type
"
:
"
txt
"
,
"
audio
"
:
"
http://staging-teach.cdn.ireadabc.com/e8d058205a1bc894c55a9dc46d60717f_l.mp3
"
,
"
text
"
:
"
shoot
"
,
"
image
"
:
""
,
"
time
"
:
null
,
"
duration
"
:
30
,
"
audioName
"
:
"
yasuo.mp3
"
},
{
"
type
"
:
"
txt
"
,
"
audio
"
:
""
,
"
text
"
:
"
apple
"
,
"
image
"
:
""
,
"
time
"
:
null
,
"
duration
"
:
30
,
"
audioName
"
:
""
},
{
"
type
"
:
"
txt
"
,
"
audio
"
:
""
,
"
text
"
:
"
international
"
,
"
image
"
:
""
,
"
time
"
:
null
,
"
duration
"
:
30
,
"
audioName
"
:
""
},
{
"
type
"
:
"
txt
"
,
"
audio
"
:
""
,
"
text
"
:
"
deep
"
,
"
image
"
:
""
,
"
time
"
:
null
,
"
duration
"
:
30
,
"
audioName
"
:
""
},
{
"
type
"
:
"
txt
"
,
"
audio
"
:
""
,
"
text
"
:
"
fun
"
,
"
image
"
:
""
,
"
time
"
:
null
,
"
duration
"
:
10
,
"
audioName
"
:
""
}]
"
score
"
:
0
,
"
title
"
:
""
,
"
questionText
"
:
""
,
"
questionType
"
:
"
read
"
,
"
questionTextAudio
"
:
""
,
"
bgAudio
"
:
""
,
"
questions
"
:
[{
"
type
"
:
"
img
"
,
"
audio
"
:
"
http://staging-teach.cdn.ireadabc.com/ae2538a7ef5de1b4836a882d625271af_l.mp3
"
,
"
text
"
:
"
left
"
,
"
image
"
:
"
http://staging-teach.cdn.ireadabc.com/41b95f47d23e0712f825eec9e718caed.png
"
,
"
time
"
:
null
,
"
duration
"
:
30
,
"
audioName
"
:
"
heal_money.mp3
"
},
{
"
type
"
:
"
img
"
,
"
audio
"
:
"
http://staging-teach.cdn.ireadabc.com/4f3bb8f8fa048f40c1bb5d6d2f6d9a33_l.mp3
"
,
"
text
"
:
"
down
"
,
"
image
"
:
"
http://staging-teach.cdn.ireadabc.com/fbe3d792ce2a72310e5298e1d75d0d71.png
"
,
"
time
"
:
null
,
"
duration
"
:
30
,
"
audioName
"
:
"
shoot.MP3
"
},
{
"
type
"
:
"
img
"
,
"
audio
"
:
"
http://staging-teach.cdn.ireadabc.com/a6fb6452f0e383808cd056939ed81917_l.mp3
"
,
"
text
"
:
"
circle
"
,
"
image
"
:
"
http://staging-teach.cdn.ireadabc.com/d0652838333e892b5e495fbdd8746fa0.png
"
,
"
time
"
:
null
,
"
duration
"
:
30
,
"
audioName
"
:
"
levelup.MP3
"
},
{
"
type
"
:
"
txt
"
,
"
audio
"
:
"
http://staging-teach.cdn.ireadabc.com/e8d058205a1bc894c55a9dc46d60717f_l.mp3
"
,
"
text
"
:
"
shoot
"
,
"
image
"
:
""
,
"
time
"
:
null
,
"
duration
"
:
30
,
"
audioName
"
:
"
yasuo.mp3
"
},
{
"
type
"
:
"
txt
"
,
"
audio
"
:
""
,
"
text
"
:
"
apple
"
,
"
image
"
:
""
,
"
time
"
:
null
,
"
duration
"
:
30
,
"
audioName
"
:
""
},
{
"
type
"
:
"
txt
"
,
"
audio
"
:
""
,
"
text
"
:
"
international
"
,
"
image
"
:
""
,
"
time
"
:
null
,
"
duration
"
:
30
,
"
audioName
"
:
""
},
{
"
type
"
:
"
txt
"
,
"
audio
"
:
""
,
"
text
"
:
"
deep
"
,
"
image
"
:
""
,
"
time
"
:
null
,
"
duration
"
:
30
,
"
audioName
"
:
""
},
{
"
type
"
:
"
txt
"
,
"
audio
"
:
""
,
"
text
"
:
"
fun
"
,
"
image
"
:
""
,
"
time
"
:
null
,
"
duration
"
:
10
,
"
audioName
"
:
""
}]
}
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