Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
SSAPP2502
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
SSAPP2502
Commits
bf4e8a1c
Commit
bf4e8a1c
authored
Aug 22, 2025
by
Tt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(游戏场景): 添加重新开始功能并优化游戏结束逻辑
parent
5c89c59b
Changes
8
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
2214 additions
and
350 deletions
+2214
-350
SSAPP2502.fire
assets/SSAPP2502/scene/SSAPP2502.fire
+2053
-330
SSAPP2502.ts
assets/SSAPP2502/scene/SSAPP2502.ts
+55
-1
defaultData.ts
assets/SSAPP2502/script/defaultData.ts
+22
-19
common.meta
assets/SSAPP2502/textures/common.meta
+12
-0
btn_restart.png
assets/SSAPP2502/textures/common/btn_restart.png
+0
-0
btn_restart.png.meta
assets/SSAPP2502/textures/common/btn_restart.png.meta
+36
-0
cd.png
assets/SSAPP2502/textures/common/cd.png
+0
-0
cd.png.meta
assets/SSAPP2502/textures/common/cd.png.meta
+36
-0
No files found.
assets/SSAPP2502/scene/SSAPP2502.fire
View file @
bf4e8a1c
This diff is collapsed.
Click to expand it.
assets/SSAPP2502/scene/SSAPP2502.ts
View file @
bf4e8a1c
...
...
@@ -5,7 +5,7 @@
*/
// 导入工具函数
import
{
asyncDelay
,
onHomeworkFinish
,
RandomInt
}
from
"
../script/util
"
;
import
{
asyncDelay
,
onHomeworkFinish
,
showTrebleFirework
}
from
"
../script/util
"
;
// 导入基础场景组件
import
{
MyCocosSceneComponent
}
from
"
../script/MyCocosSceneComponent
"
;
// 导入游戏管理类和相关枚举
...
...
@@ -111,6 +111,12 @@ export default class SceneComponent extends MyCocosSceneComponent {
this
.
initEvent
();
// 初始化事件
this
.
initGame
();
}
restartGame
()
{
this
.
initData
();
// 初始化数据
this
.
initView
();
// 初始化视图
this
.
initEvent
();
// 初始化事件
this
.
initGame
();
}
/**
* 组件销毁时的回调
* 清理事件监听,防止内存泄漏
...
...
@@ -190,6 +196,36 @@ export default class SceneComponent extends MyCocosSceneComponent {
this
.
activeNodes
=
[];
// 初始化触摸状态
this
.
touching
=
false
;
// 初始化录音相关变量
this
.
recordStartTime
=
0
;
this
.
maxRecordDuration
=
30
;
// 初始化提示相关变量
this
.
inactiveTimer
=
0
;
this
.
hintThreshold
=
3
;
// 初始化音频ID
this
.
audioId
=
-
1
;
// 初始化语音动画定时器
this
.
_voiceAniTimer
=
null
;
// 初始化语音关闭状态
this
.
onTouchSpeakCloseClosing
=
false
;
// 初始化重试状态
this
.
tryAgain
=
false
;
this
.
recordTouching
=
false
;
// 初始化重新开始布局
this
.
layout_restart
=
null
;
// 重置游戏布局和页面节点到初始状态
if
(
this
.
layout_game
)
{
// 重置游戏布局位置到初始状态(x=0)
this
.
layout_game
.
x
=
0
;
}
}
/** 音频播放ID */
private
audioId
:
any
;
...
...
@@ -1230,6 +1266,8 @@ export default class SceneComponent extends MyCocosSceneComponent {
// 设置游戏状态为结束
Game
.
getIns
().
state
=
GAME_STATE
.
OVER
;
showTrebleFirework
(
cc
.
find
(
'
Canvas/ani
'
),
cc
.
find
(
'
Canvas/RabbonBase
'
).
children
);
// 准备提交的数据
let
data
:
any
=
{};
data
.
total
=
Game
.
getIns
().
getTotal
;
// 总题目数
...
...
@@ -1242,6 +1280,22 @@ export default class SceneComponent extends MyCocosSceneComponent {
// 提交作业完成数据
onHomeworkFinish
(
data
)
// 显示重新开始
this
.
showRestart
();
}
private
layout_restart
:
cc
.
Node
=
null
;
showRestart
()
{
if
(
!
this
.
layout_restart
)
this
.
layout_restart
=
cc
.
find
(
'
Canvas/layout_restart
'
);
this
.
layout_restart
.
active
=
true
;
pg
.
view
.
touchOn
(
pg
.
view
.
find
(
this
.
layout_restart
,
'
btn_restart
'
),
this
.
onTouchRestart
,
this
);
}
hideRestart
()
{
if
(
!
this
.
layout_restart
)
this
.
layout_restart
=
cc
.
find
(
'
Canvas/layout_restart
'
);
this
.
layout_restart
.
active
=
false
;
}
onTouchRestart
()
{
this
.
hideRestart
();
this
.
restartGame
();
}
/**
...
...
assets/SSAPP2502/script/defaultData.ts
View file @
bf4e8a1c
...
...
@@ -25,23 +25,26 @@ export const defaultData = {
"
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
"
:
""
}]
},
// {
// "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": ""
// }
]
}
assets/SSAPP2502/textures/common.meta
0 → 100644
View file @
bf4e8a1c
{
"ver": "1.1.2",
"uuid": "0114ba45-275e-4cfe-aedd-b1d276da1db2",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}
\ No newline at end of file
assets/SSAPP2502/textures/common/btn_restart.png
0 → 100644
View file @
bf4e8a1c
55 KB
assets/SSAPP2502/textures/common/btn_restart.png.meta
0 → 100644
View file @
bf4e8a1c
{
"ver": "2.3.5",
"uuid": "2984828f-4c2b-4ba9-9656-0f3b7bc71db9",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 407,
"height": 179,
"platformSettings": {},
"subMetas": {
"btn_restart": {
"ver": "1.0.4",
"uuid": "d7580966-b781-4363-99e0-617bb3bfdd48",
"rawTextureUuid": "2984828f-4c2b-4ba9-9656-0f3b7bc71db9",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 407,
"height": 179,
"rawWidth": 407,
"rawHeight": 179,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
assets/SSAPP2502/textures/common/cd.png
0 → 100644
View file @
bf4e8a1c
1.29 KB
assets/SSAPP2502/textures/common/cd.png.meta
0 → 100644
View file @
bf4e8a1c
{
"ver": "2.3.5",
"uuid": "c6c3a776-728e-4eb2-8e07-a949381530bb",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 55,
"height": 76,
"platformSettings": {},
"subMetas": {
"cd": {
"ver": "1.0.4",
"uuid": "91a5c684-5c06-4886-9fd2-24f7acddfb75",
"rawTextureUuid": "c6c3a776-728e-4eb2-8e07-a949381530bb",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 55,
"height": 76,
"rawWidth": 55,
"rawHeight": 76,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
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