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
da018b33
Commit
da018b33
authored
Aug 04, 2025
by
Tt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(play): 添加泡泡破裂动画效果并优化鱼类创建逻辑
parent
7928d53e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
41 additions
and
1 deletion
+41
-1
play.component.ts
src/app/play/play.component.ts
+41
-1
No files found.
src/app/play/play.component.ts
View file @
da018b33
...
@@ -697,7 +697,8 @@ export class PlayComponent implements OnInit, OnDestroy {
...
@@ -697,7 +697,8 @@ export class PlayComponent implements OnInit, OnDestroy {
const
type
=
'
big
'
const
type
=
'
big
'
const
data
=
this
.
g_formData
.
questions
[
0
];
const
data
=
this
.
g_formData
.
questions
[
0
];
this
.
createFish
(
type
,
data
);
const
fish
=
this
.
createFish
(
type
,
data
);
const
paopao
=
this
.
brokePaopao
(
fish
);
}
}
initVsView
()
{
initVsView
()
{
...
@@ -891,6 +892,14 @@ export class PlayComponent implements OnInit, OnDestroy {
...
@@ -891,6 +892,14 @@ export class PlayComponent implements OnInit, OnDestroy {
pao_pao_da_png
.
ref
.
y
=
-
38
pao_pao_da_png
.
ref
.
y
=
-
38
fish
.
ref
.
addChild
(
pao_pao_da_png
.
ref
);
fish
.
ref
.
addChild
(
pao_pao_da_png
.
ref
);
// 创建船节点 - 作为钓鱼台,放在最下方
const
pao_pao_po_ani
=
this
.
g_cartoon
.
createCartoonElement
(
'
pao_pao_po_ani
'
,
'
MySprite
'
);
pao_pao_po_ani
.
ref
.
init
(
this
.
g_cartoon
.
images
.
get
(
'
pao_pao_xu_lie_zhen_1
'
));
pao_pao_po_ani
.
ref
.
scaleX
=
this
.
g_mapScale
;
pao_pao_po_ani
.
ref
.
scaleY
=
this
.
g_mapScale
;
pao_pao_po_ani
.
ref
.
x
=
0
pao_pao_po_ani
.
ref
.
y
=
-
48
fish
.
ref
.
addChild
(
pao_pao_po_ani
.
ref
);
// 一条小鱼
// 一条小鱼
const
colors
=
[
'
huang
'
,
'
ju
'
,
'
lan
'
,
'
lv
'
]
const
colors
=
[
'
huang
'
,
'
ju
'
,
'
lan
'
,
'
lv
'
]
const
nameYu
=
colors
[
Math
.
floor
(
Math
.
random
()
*
colors
.
length
)]
+
'
_yu
'
const
nameYu
=
colors
[
Math
.
floor
(
Math
.
random
()
*
colors
.
length
)]
+
'
_yu
'
...
@@ -901,6 +910,7 @@ export class PlayComponent implements OnInit, OnDestroy {
...
@@ -901,6 +910,7 @@ export class PlayComponent implements OnInit, OnDestroy {
xiao_yu
.
ref
.
x
=
40
*
this
.
g_mapScale
;
xiao_yu
.
ref
.
x
=
40
*
this
.
g_mapScale
;
xiao_yu
.
ref
.
y
=
80
*
this
.
g_mapScale
;
xiao_yu
.
ref
.
y
=
80
*
this
.
g_mapScale
;
fish
.
ref
.
addChild
(
xiao_yu
.
ref
);
fish
.
ref
.
addChild
(
xiao_yu
.
ref
);
fish
[
'
child_xiao_yu
'
]
=
xiao_yu
;
// 网络加载的图片
// 网络加载的图片
...
@@ -924,6 +934,7 @@ export class PlayComponent implements OnInit, OnDestroy {
...
@@ -924,6 +934,7 @@ export class PlayComponent implements OnInit, OnDestroy {
})
})
// 将图片元素添加到itemNode
// 将图片元素添加到itemNode
fish
.
ref
.
addChild
(
imageElement
.
ref
);
fish
.
ref
.
addChild
(
imageElement
.
ref
);
fish
[
'
child_image
'
]
=
imageElement
}
}
if
(
type
==
'
big
'
)
{
if
(
type
==
'
big
'
)
{
fish
.
ref
.
scaleX
=
this
.
g_mapScale
*
1.5
;
fish
.
ref
.
scaleX
=
this
.
g_mapScale
*
1.5
;
...
@@ -933,6 +944,35 @@ export class PlayComponent implements OnInit, OnDestroy {
...
@@ -933,6 +944,35 @@ export class PlayComponent implements OnInit, OnDestroy {
fish
.
ref
.
scaleY
=
this
.
g_mapScale
;
fish
.
ref
.
scaleY
=
this
.
g_mapScale
;
}
}
this
.
render
(
fish
.
ref
,
zIndexMap
.
card
);
this
.
render
(
fish
.
ref
,
zIndexMap
.
card
);
fish
[
'
child_paopao_bg
'
]
=
pao_pao_da_png
;
fish
[
'
child_paopao_ani
'
]
=
pao_pao_po_ani
;
return
fish
;
}
brokePaopao
(
fish
)
{
fish
[
'
child_paopao_bg
'
].
ref
.
visible
=
false
;
fish
[
'
child_xiao_yu
'
].
ref
.
visible
=
false
;
fish
[
'
child_image
'
].
ref
.
visible
=
false
;
fish
[
'
child_paopao_ani
'
].
ref
.
visible
=
true
;
// 按顺序切换序列帧 pao_pao_xu_lie_zhen_1 到 pao_pao_xu_lie_zhen_9
let
currentFrame
=
1
;
const
maxFrame
=
9
;
const
frameInterval
=
100
;
// 每帧间隔时间,可以根据需要调整
const
playNextFrame
=
()
=>
{
if
(
currentFrame
<=
maxFrame
)
{
// 设置当前帧的图像
fish
[
'
child_paopao_ani
'
].
ref
.
init
(
this
.
g_cartoon
.
images
.
get
(
`pao_pao_xu_lie_zhen_
${
currentFrame
}
`
));
currentFrame
++
;
// 设置下一帧的定时器
setTimeout
(
playNextFrame
,
frameInterval
);
}
};
// 开始播放序列帧动画
playNextFrame
();
return
fish
;
return
fish
;
}
}
...
...
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