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
43fae5e6
Commit
43fae5e6
authored
Aug 03, 2025
by
Tt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
完成
parent
f47733d4
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
44 additions
and
18 deletions
+44
-18
SSAPP2501.fire
assets/SSAPP2501/scene/SSAPP2501.fire
+3
-0
SSAPP2501.ts
assets/SSAPP2501/scene/SSAPP2501.ts
+34
-18
Game.ts
assets/SSAPP2501/scene/tool/Game.ts
+7
-0
No files found.
assets/SSAPP2501/scene/SSAPP2501.fire
View file @
43fae5e6
...
@@ -9710,6 +9710,9 @@
...
@@ -9710,6 +9710,9 @@
"page_b": {
"page_b": {
"__id__": 65
"__id__": 65
},
},
"btn_close": {
"__id__": 117
},
"_id": "db3L+4L+FH/5MIRcKcfiq+"
"_id": "db3L+4L+FH/5MIRcKcfiq+"
}
}
]
]
\ No newline at end of file
assets/SSAPP2501/scene/SSAPP2501.ts
View file @
43fae5e6
...
@@ -139,6 +139,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -139,6 +139,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
@
property
({
displayName
:
"
提示手指节点
"
,
type
:
cc
.
Node
})
btn_finger
:
cc
.
Node
=
null
;
@
property
({
displayName
:
"
提示手指节点
"
,
type
:
cc
.
Node
})
btn_finger
:
cc
.
Node
=
null
;
@
property
({
displayName
:
"
页面a
"
,
type
:
cc
.
Node
})
page_a
:
cc
.
Node
=
null
;
@
property
({
displayName
:
"
页面a
"
,
type
:
cc
.
Node
})
page_a
:
cc
.
Node
=
null
;
@
property
({
displayName
:
"
页面b
"
,
type
:
cc
.
Node
})
page_b
:
cc
.
Node
=
null
;
@
property
({
displayName
:
"
页面b
"
,
type
:
cc
.
Node
})
page_b
:
cc
.
Node
=
null
;
@
property
({
displayName
:
"
关闭录音界面按钮
"
,
type
:
cc
.
Node
})
btn_close
:
cc
.
Node
=
null
;
// 游戏数据相关变量
// 游戏数据相关变量
/** 当前触摸的选项数据 */
/** 当前触摸的选项数据 */
...
@@ -200,6 +201,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -200,6 +201,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
// 音频控制按钮事件
// 音频控制按钮事件
this
.
btn_audio_off
.
on
(
cc
.
Node
.
EventType
.
TOUCH_END
,
this
.
onAudioOff
,
this
);
this
.
btn_audio_off
.
on
(
cc
.
Node
.
EventType
.
TOUCH_END
,
this
.
onAudioOff
,
this
);
this
.
btn_audio_on
.
on
(
cc
.
Node
.
EventType
.
TOUCH_END
,
this
.
onAudioOn
,
this
);
this
.
btn_audio_on
.
on
(
cc
.
Node
.
EventType
.
TOUCH_END
,
this
.
onAudioOn
,
this
);
this
.
btn_close
.
on
(
cc
.
Node
.
EventType
.
TOUCH_END
,
this
.
onTouchSpeakClose
,
this
);
// 添加消防车点击事件
// 添加消防车点击事件
if
(
this
.
node_firetruck
)
{
if
(
this
.
node_firetruck
)
{
...
@@ -369,7 +371,8 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -369,7 +371,8 @@ export default class SceneComponent extends MyCocosSceneComponent {
// 根据火苗编号调整消防车位置
// 根据火苗编号调整消防车位置
// fire_0~fire_2 消防车位置 x=-400,fire_3~fire_5 消防车位置 x=-185
// fire_0~fire_2 消防车位置 x=-400,fire_3~fire_5 消防车位置 x=-185
// 并根据当前页码进行偏移
// 并根据当前页码进行偏移
const
baseX
=
(
fireIndex
<=
2
)
?
-
400
:
-
185
;
const
baseXList
=
[
-
400
,
-
420
,
-
400
,
-
175
,
-
215
,
-
175
]
const
baseX
=
baseXList
[
fireIndex
];
const
targetX
=
baseX
+
1920
*
currentPage
;
const
targetX
=
baseX
+
1920
*
currentPage
;
// 移动消防车到指定位置
// 移动消防车到指定位置
...
@@ -413,10 +416,10 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -413,10 +416,10 @@ export default class SceneComponent extends MyCocosSceneComponent {
// 1. 播放node_firetruck_flush动画(喷水)
// 1. 播放node_firetruck_flush动画(喷水)
this
.
node_firetruck_flush
.
active
=
true
;
this
.
node_firetruck_flush
.
active
=
true
;
pg
.
view
.
playDBAnimation
(
this
.
node_firetruck_flush
,
'
喷水
'
,
1
);
pg
.
view
.
playDBAnimation
(
this
.
node_firetruck_flush
,
'
喷水
'
,
1
);
await
pg
.
time
.
delay
(
2
);
await
pg
.
time
.
delay
(
1.5
);
pg
.
view
.
playDBAnimation
(
this
.
node_firetruck_flush
,
'
持续喷水
'
,
1
);
pg
.
view
.
playDBAnimation
(
this
.
node_firetruck_flush
,
'
持续喷水
'
,
1
);
await
pg
.
time
.
delay
(
1
);
await
pg
.
time
.
delay
(
1
);
this
.
showCard
(
fals
e
,
'
init
'
);
this
.
showCard
(
tru
e
,
'
init
'
);
}
}
onFireSuccess
()
{
onFireSuccess
()
{
...
@@ -573,8 +576,8 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -573,8 +576,8 @@ export default class SceneComponent extends MyCocosSceneComponent {
// 录音动画定时器
// 录音动画定时器
private
_voiceAniTimer
:
any
=
null
;
private
_voiceAniTimer
:
any
=
null
;
showCard
(
hide
:
boolean
=
fals
e
,
recordState
:
string
=
'
init
'
)
{
showCard
(
show
:
boolean
=
tru
e
,
recordState
:
string
=
'
init
'
)
{
if
(
!
hide
)
{
if
(
show
)
{
// 显示卡片
// 显示卡片
const
currentData
=
this
.
currentFireNode
.
data
;
const
currentData
=
this
.
currentFireNode
.
data
;
console
.
log
(
'
showCard
'
,
currentData
)
console
.
log
(
'
showCard
'
,
currentData
)
...
@@ -684,7 +687,24 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -684,7 +687,24 @@ export default class SceneComponent extends MyCocosSceneComponent {
this
.
stopVoiceAni
();
this
.
stopVoiceAni
();
}
}
}
}
onTouchSpeakClose
()
{
this
.
showCard
(
false
);
// 获取最后一次录音数据
const
lastVoice
=
Game
.
getIns
().
player
.
getLastVoice
();
// 如果有录音数据,则使用其分数
if
(
lastVoice
&&
lastVoice
.
result
)
{
const
score
=
lastVoice
.
result
.
overall
;
if
(
score
>=
10
)
{
this
.
onFireSuccess
();
}
else
{
this
.
onFireFail
();
}
}
else
{
// 如果没有录音数据,默认失败
this
.
onFireFail
();
}
}
/**
/**
* 游戏帧更新函数
* 游戏帧更新函数
...
@@ -707,7 +727,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -707,7 +727,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
this
.
stopBgAudio
();
this
.
stopBgAudio
();
// 获取UI元素
// 获取UI元素
// 使用更新后的showCard方法,传入'recording'状态
// 使用更新后的showCard方法,传入'recording'状态
this
.
showCard
(
fals
e
,
'
recording
'
);
this
.
showCard
(
tru
e
,
'
recording
'
);
// 显示倒计时并设置时间
// 显示倒计时并设置时间
this
.
countDown
=
this
.
startCount
;
this
.
countDown
=
this
.
startCount
;
this
.
countDown
=
this
.
touchData
.
time
||
this
.
startCount
;
//使用问题指定的时间或默认时间
this
.
countDown
=
this
.
touchData
.
time
||
this
.
startCount
;
//使用问题指定的时间或默认时间
...
@@ -721,7 +741,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -721,7 +741,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
*/
*/
private
onTouchRecordEnd
()
{
private
onTouchRecordEnd
()
{
// 使用更新后的showCard方法,传入'recorded'状态
// 使用更新后的showCard方法,传入'recorded'状态
this
.
showCard
(
fals
e
,
'
recorded
'
);
this
.
showCard
(
tru
e
,
'
recorded
'
);
// 隐藏倒计时并设置一个很大的值防止倒计时继续
// 隐藏倒计时并设置一个很大的值防止倒计时继续
this
.
countDown
=
999999
;
this
.
countDown
=
999999
;
...
@@ -823,6 +843,8 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -823,6 +843,8 @@ export default class SceneComponent extends MyCocosSceneComponent {
*/
*/
private
async
recrodEnd
(
data
)
{
private
async
recrodEnd
(
data
)
{
this
.
log
(
"
recrodEnd!!!!!
"
)
this
.
log
(
"
recrodEnd!!!!!
"
)
// 将当前题目ID添加到录音数据中
data
.
questionId
=
this
.
touchData
.
id
;
// 保存录音数据
// 保存录音数据
Game
.
getIns
().
player
.
addVoice
(
data
);
Game
.
getIns
().
player
.
addVoice
(
data
);
...
@@ -861,14 +883,8 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -861,14 +883,8 @@ export default class SceneComponent extends MyCocosSceneComponent {
}
}
// 延迟后隐藏卡片和提示,进入下一题
// 延迟后隐藏卡片和提示,进入下一题
await
pg
.
time
.
delay
(
3
);
await
pg
.
time
.
delay
(
2
);
this
.
showCard
(
true
);
this
.
updateTips
(
null
);
this
.
updateTips
(
null
);
if
(
score
>=
10
)
{
this
.
onFireSuccess
();
}
else
{
this
.
onFireFail
();
}
return
;
return
;
}
else
{
}
else
{
// 单词不正确
// 单词不正确
...
@@ -886,7 +902,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -886,7 +902,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
}
}
await
pg
.
time
.
delay
(
3
);
await
pg
.
time
.
delay
(
3
);
this
.
showCard
(
tru
e
);
this
.
showCard
(
fals
e
);
this
.
updateTips
(
null
);
this
.
updateTips
(
null
);
this
.
recordTouching
=
false
;
this
.
recordTouching
=
false
;
this
.
onFireFail
();
this
.
onFireFail
();
...
@@ -912,10 +928,10 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -912,10 +928,10 @@ export default class SceneComponent extends MyCocosSceneComponent {
// 根据是否需要再次尝试决定显示卡片或进入下一题
// 根据是否需要再次尝试决定显示卡片或进入下一题
if
(
this
.
tryAgain
)
{
if
(
this
.
tryAgain
)
{
// 需要再次尝试,显示卡片和录音界面,重置为初始状态
// 需要再次尝试,显示卡片和录音界面,重置为初始状态
this
.
showCard
(
fals
e
,
'
init
'
)
this
.
showCard
(
tru
e
,
'
init
'
)
}
else
{
}
else
{
// 不需要再次尝试,隐藏卡片和录音界面
// 不需要再次尝试,隐藏卡片和录音界面
this
.
showCard
(
tru
e
)
this
.
showCard
(
fals
e
)
this
.
recordTouching
=
false
;
this
.
recordTouching
=
false
;
}
}
}
}
...
...
assets/SSAPP2501/scene/tool/Game.ts
View file @
43fae5e6
...
@@ -86,6 +86,13 @@ class Role {
...
@@ -86,6 +86,13 @@ class Role {
* @param obj 语音对象
* @param obj 语音对象
*/
*/
addVoice
(
obj
:
any
)
{
addVoice
(
obj
:
any
)
{
// 检查是否已存在相同题目ID的记录
const
existingIndex
=
this
.
voices
.
findIndex
(
voice
=>
voice
.
questionId
===
obj
.
questionId
);
if
(
existingIndex
!==
-
1
)
{
// 如果存在,先移除旧记录
this
.
voices
.
splice
(
existingIndex
,
1
);
}
// 添加新记录
this
.
voices
.
push
(
obj
);
this
.
voices
.
push
(
obj
);
}
}
getLastVoice
(){
getLastVoice
(){
...
...
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