Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
SSIWB2504
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
SSIWB2504
Commits
a82fae5d
Commit
a82fae5d
authored
Aug 09, 2025
by
Tt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(游戏逻辑): 添加倒计时音效并重构游戏初始化流程
parent
379207ec
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
50 additions
and
50 deletions
+50
-50
play.component.ts
src/app/play/play.component.ts
+48
-48
resources.js
src/app/play/resources.js
+2
-2
No files found.
src/app/play/play.component.ts
View file @
a82fae5d
...
@@ -297,9 +297,12 @@ export class PlayComponent implements OnInit, OnDestroy {
...
@@ -297,9 +297,12 @@ export class PlayComponent implements OnInit, OnDestroy {
// 依次显示3、2、1的倒计时动画
// 依次显示3、2、1的倒计时动画
// 先显示3
// 先显示3
this
.
g_cartoon
.
playAudio
(
'
time_3
'
);
this
.
showCountdownNumber
(
'
dao_ji_shi_3
'
,
config
,
()
=>
{
this
.
showCountdownNumber
(
'
dao_ji_shi_3
'
,
config
,
()
=>
{
this
.
g_cartoon
.
playAudio
(
'
time_2
'
);
// 显示完3后显示2
// 显示完3后显示2
this
.
showCountdownNumber
(
'
dao_ji_shi_2
'
,
config
,
()
=>
{
this
.
showCountdownNumber
(
'
dao_ji_shi_2
'
,
config
,
()
=>
{
this
.
g_cartoon
.
playAudio
(
'
time_1
'
);
// 显示完2后显示1
// 显示完2后显示1
this
.
showCountdownNumber
(
'
dao_ji_shi_1
'
,
config
,
()
=>
{
this
.
showCountdownNumber
(
'
dao_ji_shi_1
'
,
config
,
()
=>
{
// 倒计时结束后的操作,等待一段时间后显示VS动画
// 倒计时结束后的操作,等待一段时间后显示VS动画
...
@@ -307,6 +310,8 @@ export class PlayComponent implements OnInit, OnDestroy {
...
@@ -307,6 +310,8 @@ export class PlayComponent implements OnInit, OnDestroy {
// this.showVsAni(type);
// this.showVsAni(type);
this
.
hideVsElements
();
this
.
hideVsElements
();
this
.
hide321Elements
();
this
.
hide321Elements
();
this
.
startBattle
();
},
config
.
time
.
afterComplete
*
1000
);
},
config
.
time
.
afterComplete
*
1000
);
});
});
});
});
...
@@ -440,32 +445,6 @@ export class PlayComponent implements OnInit, OnDestroy {
...
@@ -440,32 +445,6 @@ export class PlayComponent implements OnInit, OnDestroy {
this
.
initBackground
()
this
.
initBackground
()
this
.
initListPage
();
this
.
initListPage
();
// 显示321倒计时动画,传递'left'参数表示左侧猫开始玩
// this.show321('left');
// 注释掉直接显示VS动画的代码,因为现在由show321函数在倒计时结束后调用
// this.showVsAni('right');
this
.
initFishGame
();
// 初始化发音按钮
this
.
initFaYinBtn
();
// 初始化退出按钮
// this.initBtnBack();
// // 初始化标题
// this.initTitle();
// const partXList = this.g_formData.type == 0 ? [300 * this.g_mapScale, 700 * this.g_mapScale, 1100 * this.g_mapScale] : [700 * this.g_mapScale, 300 * this.g_mapScale, 1100 * this.g_mapScale];
// // 初始化第一部分内容(字母块)
// this.initPart1(partXList[0]);
// // 初始化第二部分内容(字母块)
// this.initPart2(partXList[1]);
// // 初始化第三部分内容(字母块)
// this.initPart3(partXList[2]);
// // 初始化文字
// this.initWords();
// // 初始化连接线
// this.drawConnectionLines();
}
}
/**
/**
...
@@ -492,10 +471,10 @@ export class PlayComponent implements OnInit, OnDestroy {
...
@@ -492,10 +471,10 @@ export class PlayComponent implements OnInit, OnDestroy {
this
.
m_gameOver
=
true
;
this
.
m_gameOver
=
true
;
// 延迟500毫秒后执行结束动画
// 延迟500毫秒后执行结束动画
setTimeout
(()
=>
{
setTimeout
(()
=>
{
// 显示花瓣效果
//
//
显示花瓣效果
this
.
showCorrectPatal
(
"
card
"
,
5000
)
//
this.showCorrectPatal("card", 5000)
// 播放结束音效
//
//
播放结束音效
this
.
g_cartoon
.
playAudio
(
"
success
"
)
//
this.g_cartoon.playAudio("success")
},
500
)
},
500
)
}
}
...
@@ -580,6 +559,8 @@ export class PlayComponent implements OnInit, OnDestroy {
...
@@ -580,6 +559,8 @@ export class PlayComponent implements OnInit, OnDestroy {
toggleItemSelection
(
itemNode
,
dataIndex
)
{
toggleItemSelection
(
itemNode
,
dataIndex
)
{
if
(
!
this
.
layoutPage
.
ref
.
visible
)
return
;
if
(
!
this
.
layoutPage
.
ref
.
visible
)
return
;
this
.
g_cartoon
.
playAudio
(
'
click_pic
'
)
const
isSelected
=
itemNode
.
ref
.
isSelected
||
false
;
const
isSelected
=
itemNode
.
ref
.
isSelected
||
false
;
const
selectMark
=
itemNode
.
ref
.
selectMark
;
const
selectMark
=
itemNode
.
ref
.
selectMark
;
...
@@ -678,8 +659,7 @@ export class PlayComponent implements OnInit, OnDestroy {
...
@@ -678,8 +659,7 @@ export class PlayComponent implements OnInit, OnDestroy {
this
.
layoutPage
.
ref
.
visible
=
false
;
this
.
layoutPage
.
ref
.
visible
=
false
;
this
.
checkBtnElement
.
ref
.
visible
=
false
;
this
.
checkBtnElement
.
ref
.
visible
=
false
;
this
.
listItem
.
ref
.
visible
=
false
;
this
.
listItem
.
ref
.
visible
=
false
;
this
.
initFishGame
();
this
.
initBattle
();
// 这里可以添加开始游戏的具体逻辑
}
else
{
}
else
{
// 提示需要选择更多单词
// 提示需要选择更多单词
console
.
log
(
'
请至少选择2个单词
'
);
console
.
log
(
'
请至少选择2个单词
'
);
...
@@ -883,6 +863,22 @@ export class PlayComponent implements OnInit, OnDestroy {
...
@@ -883,6 +863,22 @@ export class PlayComponent implements OnInit, OnDestroy {
}
}
initBattle
()
{
this
.
g_enableMapDown
=
true
;
if
(
this
.
g_formData
.
doubleModal
)
{
this
.
showVsAni
(
'
left
'
);
// this.showVsAni('right');
}
else
{
this
.
startBattle
();
}
}
startBattle
()
{
// 初始化鱼游戏
this
.
initFishGame
();
// 初始化发音按钮
this
.
initFaYinBtn
();
}
/**
/**
* 初始化鱼游戏
* 初始化鱼游戏
*/
*/
...
@@ -890,7 +886,8 @@ export class PlayComponent implements OnInit, OnDestroy {
...
@@ -890,7 +886,8 @@ export class PlayComponent implements OnInit, OnDestroy {
private
cat_right
:
any
;
private
cat_right
:
any
;
private
cat_center
:
any
;
private
cat_center
:
any
;
initFishGame
()
{
initFishGame
()
{
const
targetList
=
[
0
,
1
,
2
,
3
,
4
,
5
,
6
];
console
.
log
(
"
this.selectList
"
,
this
.
selectList
);
const
targetList
=
this
.
selectList
.
concat
();
const
questions
=
this
.
g_formData
.
questions
;
const
questions
=
this
.
g_formData
.
questions
;
// 1. 梳理出选中的数据数组
// 1. 梳理出选中的数据数组
...
@@ -1223,6 +1220,7 @@ export class PlayComponent implements OnInit, OnDestroy {
...
@@ -1223,6 +1220,7 @@ export class PlayComponent implements OnInit, OnDestroy {
moveItem
(
s_element
,
this
.
g_canvasWidth
/
2
+
config
.
vs
.
s
.
offsetX
*
this
.
g_mapScale
,
s_element
.
y
,
config
.
vs
.
s
.
moveTime
,
()
=>
{
moveItem
(
s_element
,
this
.
g_canvasWidth
/
2
+
config
.
vs
.
s
.
offsetX
*
this
.
g_mapScale
,
s_element
.
y
,
config
.
vs
.
s
.
moveTime
,
()
=>
{
// VS元素移动完成后,调用showVsShadow函数创建阴影效果
// VS元素移动完成后,调用showVsShadow函数创建阴影效果
this
.
showVsShadow
();
this
.
showVsShadow
();
this
.
g_cartoon
.
playAudio
(
'
vs
'
);
});
});
setTimeout
(()
=>
{
setTimeout
(()
=>
{
// 隐藏VS元素
// 隐藏VS元素
...
@@ -1661,6 +1659,7 @@ export class PlayComponent implements OnInit, OnDestroy {
...
@@ -1661,6 +1659,7 @@ export class PlayComponent implements OnInit, OnDestroy {
return
fish
;
return
fish
;
}
}
brokePaopaoAni
(
fish
)
{
brokePaopaoAni
(
fish
)
{
// this.g_cartoon.playAudio('pop_bomb');
// 对于正确的鱼,显示泡泡破裂动画
// 对于正确的鱼,显示泡泡破裂动画
// 按顺序切换序列帧 pao_pao_xu_lie_zhen_1 到 pao_pao_xu_lie_zhen_9
// 按顺序切换序列帧 pao_pao_xu_lie_zhen_1 到 pao_pao_xu_lie_zhen_9
let
currentFrame
=
1
;
let
currentFrame
=
1
;
...
@@ -1690,6 +1689,7 @@ export class PlayComponent implements OnInit, OnDestroy {
...
@@ -1690,6 +1689,7 @@ export class PlayComponent implements OnInit, OnDestroy {
* @param shuiHuaElement 水花元素
* @param shuiHuaElement 水花元素
*/
*/
playShuiHuaAnimation
(
shuiHuaElement
)
{
playShuiHuaAnimation
(
shuiHuaElement
)
{
this
.
g_cartoon
.
playAudio
(
'
fish_down
'
);
// 显示水花元素
// 显示水花元素
shuiHuaElement
.
ref
.
visible
=
true
;
shuiHuaElement
.
ref
.
visible
=
true
;
...
...
src/app/play/resources.js
View file @
a82fae5d
...
@@ -100,14 +100,14 @@ const localAudios = {
...
@@ -100,14 +100,14 @@ const localAudios = {
'
bg_sometime
'
:
'
assets/audio/bg_sometime.mp3
'
,
'
bg_sometime
'
:
'
assets/audio/bg_sometime.mp3
'
,
'
click_pic
'
:
'
assets/audio/click_pic.mp3
'
,
'
click_pic
'
:
'
assets/audio/click_pic.mp3
'
,
'
click_wrong
'
:
'
assets/audio/click_wrong.mp3
'
,
'
click_wrong
'
:
'
assets/audio/click_wrong.mp3
'
,
'
fish_down
'
:
'
assets/audio/fish_down.mp3
'
,
'
fish_many_down
'
:
'
assets/audio/fish_many_down.mp3
'
,
'
pop_bomb
'
:
'
assets/audio/pop_bomb.mp3
'
,
'
pop_bomb
'
:
'
assets/audio/pop_bomb.mp3
'
,
'
fish_down
'
:
'
assets/audio/fish_down.mp3
'
,
'
time_1
'
:
'
assets/audio/time_1.mp3
'
,
'
time_1
'
:
'
assets/audio/time_1.mp3
'
,
'
time_2
'
:
'
assets/audio/time_2.mp3
'
,
'
time_2
'
:
'
assets/audio/time_2.mp3
'
,
'
time_3
'
:
'
assets/audio/time_3.mp3
'
,
'
time_3
'
:
'
assets/audio/time_3.mp3
'
,
'
vs
'
:
'
assets/audio/vs.mp3
'
,
'
vs
'
:
'
assets/audio/vs.mp3
'
,
'
vs2
'
:
'
assets/audio/vs2.mp3
'
,
'
vs2
'
:
'
assets/audio/vs2.mp3
'
,
'
fish_many_down
'
:
'
assets/audio/fish_many_down.mp3
'
,
// Default audio files
// Default audio files
'
sm-back
'
:
'
assets/default/audio/sm-back.mp3
'
,
'
sm-back
'
:
'
assets/default/audio/sm-back.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