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
7f337bd1
Commit
7f337bd1
authored
Aug 15, 2025
by
Tt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(动画效果): 添加鱼雨动画后的猫咪挥手动画和光束效果
parent
04e46b95
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
57 additions
and
6 deletions
+57
-6
play.component.ts
src/app/play/play.component.ts
+57
-6
No files found.
src/app/play/play.component.ts
View file @
7f337bd1
...
...
@@ -858,6 +858,10 @@ export class PlayComponent implements OnInit, OnDestroy {
this
.
updateCat
();
this
.
startNextQuestion
();
setTimeout
(()
=>
{
this
.
showFishRain
(
'
center
'
);
},
500
);
}
nextBattle
(
playTime
)
{
...
...
@@ -1686,6 +1690,17 @@ export class PlayComponent implements OnInit, OnDestroy {
break
;
}
// 创建光束元素
const
guangShu
=
this
.
g_cartoon
.
createCartoonElement
(
'
guang_shu
'
,
'
MySprite
'
);
guangShu
.
ref
.
init
(
this
.
g_cartoon
.
images
.
get
(
'
guang_shu
'
));
guangShu
.
ref
.
scaleX
=
this
.
g_mapScale
;
guangShu
.
ref
.
scaleY
=
this
.
g_mapScale
;
guangShu
.
ref
.
x
=
fishX
;
guangShu
.
ref
.
y
=
245
*
this
.
g_mapScale
;
guangShu
.
ref
.
alpha
=
0
;
this
.
render
(
guangShu
.
ref
,
zIndexMap
.
cat
+
9
);
// 在鱼后面
alphaItem
(
guangShu
.
ref
,
1
,
1
);
// 0.5秒内透明度变为1
// 创建鱼元素
const
fishRain
=
this
.
g_cartoon
.
createCartoonElement
(
'
fish_rain
'
,
'
MySprite
'
);
fishRain
.
ref
.
init
(
this
.
g_cartoon
.
images
.
get
(
'
yu_00
'
));
// 初始帧
...
...
@@ -1719,12 +1734,48 @@ export class PlayComponent implements OnInit, OnDestroy {
const
timeoutId
=
setTimeout
(
playNextFrame
,
frameInterval
);
this
.
m_setTimeoutIDs
.
push
(
timeoutId
);
}
else
{
// 动画播放完成后隐藏鱼元素
// 显示游戏结束提示
setTimeout
(()
=>
{
console
.
log
(
"
游戏结束!
"
);
fishRain
.
ref
.
visible
=
false
;
},
200
);
// 动画播放完成后开始播放猫咪挥手动画
// fishRain.ref.visible = false;
// 创建猫咪元素
const
catWave
=
this
.
g_cartoon
.
createCartoonElement
(
'
cat_wave
'
,
'
MySprite
'
);
// 根据位置类型选择不同的动画序列
const
isRightSide
=
type
===
'
right
'
;
const
maxFrame
=
!
isRightSide
?
6
:
8
;
let
currentCatFrame
=
1
;
const
catFrameInterval
=
100
;
// 每帧间隔时间
// 设置猫咪位置和缩放
catWave
.
ref
.
scaleX
=
this
.
g_mapScale
;
catWave
.
ref
.
scaleY
=
this
.
g_mapScale
;
catWave
.
ref
.
x
=
fishX
;
catWave
.
ref
.
y
=
525
*
this
.
g_mapScale
;
// 渲染猫咪元素,确保在光束和鱼之间
this
.
render
(
catWave
.
ref
,
zIndexMap
.
cat
+
9.5
);
// 创建猫咪帧动画函数
const
playCatAnimation
=
()
=>
{
if
(
currentCatFrame
<=
maxFrame
)
{
// 根据位置选择对应的动画序列
const
prefix
=
!
isRightSide
?
'
ju_mao_zhao_shou_
'
:
'
hui_mao_zhao_shou_
'
;
catWave
.
ref
.
init
(
this
.
g_cartoon
.
images
.
get
(
`
${
prefix
}${
currentCatFrame
}
`
));
// 递增帧索引
currentCatFrame
++
;
// 设置下一帧的定时器
const
timeoutId
=
setTimeout
(
playCatAnimation
,
catFrameInterval
);
this
.
m_setTimeoutIDs
.
push
(
timeoutId
);
if
(
currentCatFrame
>
maxFrame
)
{
currentCatFrame
=
0
;
}
}
};
// 开始播放猫咪动画
playCatAnimation
();
}
};
...
...
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