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
35d3e306
Commit
35d3e306
authored
Aug 03, 2025
by
Tt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
点击碎裂
parent
3fd50703
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
307 additions
and
305 deletions
+307
-305
SSAPP2501.fire
assets/SSAPP2501/scene/SSAPP2501.fire
+257
-293
SSAPP2501.ts
assets/SSAPP2501/scene/SSAPP2501.ts
+50
-12
No files found.
assets/SSAPP2501/scene/SSAPP2501.fire
View file @
35d3e306
This diff is collapsed.
Click to expand it.
assets/SSAPP2501/scene/SSAPP2501.ts
View file @
35d3e306
...
@@ -279,7 +279,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -279,7 +279,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
}
}
// 添加点击事件(如果节点上没有该事件)
// 添加点击事件(如果节点上没有该事件)
pg
.
view
.
touchOn
(
candyNode
,
this
.
onTouch
Fire
Node
,
this
);
pg
.
view
.
touchOn
(
candyNode
,
this
.
onTouch
Item
Node
,
this
);
}
}
/**
/**
...
@@ -334,17 +334,55 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -334,17 +334,55 @@ export default class SceneComponent extends MyCocosSceneComponent {
* @param e 事件对象或包含target属性的模拟事件对象
* @param e 事件对象或包含target属性的模拟事件对象
*/
*/
private
currentFireNode
:
CandyNode
;
private
currentFireNode
:
CandyNode
;
async
onTouch
Fire
Node
(
e
)
{
async
onTouch
Item
Node
(
e
)
{
const
fireNode
=
e
.
target
as
CandyNode
;
if
(
this
.
touching
)
return
;
this
.
touching
=
true
;
pg
.
hw
.
playLocalAudio
(
'
fire_water
'
)
;
const
candyNode
=
e
.
target
as
CandyNode
;
// 保存触摸数据
// 保存触摸数据
this
.
touchData
=
fireNode
.
data
;
this
.
touchData
=
candyNode
.
data
;
this
.
touchData
.
parent
=
fireNode
;
this
.
touchData
.
parent
=
candyNode
;
this
.
currentFireNode
=
fireNode
;
this
.
currentFireNode
=
candyNode
;
// 获取糖果节点的位置和背景节点
const
bgFullNode
=
candyNode
.
getChildByName
(
'
bg_full
'
);
const
bgBrokenNode
=
candyNode
.
getChildByName
(
'
bg_broken
'
);
// 计算锤子移动到糖果右侧偏移量100,50的位置
const
targetPos
=
candyNode
.
convertToWorldSpaceAR
(
cc
.
v2
(
160
,
-
30
));
const
hammerWorldPos
=
this
.
btn_hammer
.
parent
.
convertToNodeSpaceAR
(
targetPos
);
// 保存锤子原始位置和旋转角度
const
originalPos
=
cc
.
v2
(
this
.
btn_hammer
.
x
,
this
.
btn_hammer
.
y
);
const
originalRotation
=
this
.
btn_hammer
.
angle
;
// 保存当前滚动状态,并暂停滚动
const
originalScrollState
=
this
.
needScroll
;
this
.
needScroll
=
false
;
// 移除了消防车喷水动画相关代码
// 播放锤子移动到目标位置的动画
await
pg
.
time
.
delay
(
1
);
cc
.
tween
(
this
.
btn_hammer
)
.
to
(
0.2
,
{
x
:
hammerWorldPos
.
x
,
y
:
hammerWorldPos
.
y
})
.
call
(()
=>
{
// 播放锤子旋转敲击的动画
cc
.
tween
(
this
.
btn_hammer
)
.
to
(
0.15
,
{
angle
:
-
45
})
// 锤子向上旋转准备敲击
.
to
(
0.15
,
{
angle
:
30
})
// 锤子向下旋转敲击
.
call
(()
=>
{
pg
.
view
.
visible
(
bgFullNode
,
false
);
pg
.
view
.
visible
(
bgBrokenNode
,
true
);
})
.
delay
(
0.3
)
// 等待0.3秒
.
to
(
0.2
,
{
x
:
originalPos
.
x
,
y
:
originalPos
.
y
,
angle
:
originalRotation
})
// 锤子回到原位
.
call
(()
=>
{
// 恢复原来的滚动状态
this
.
needScroll
=
originalScrollState
;
})
.
start
();
})
.
start
();
// 等待动画完成后显示卡片
await
pg
.
time
.
delay
(
1.1
);
this
.
showCard
(
true
,
'
init
'
);
this
.
showCard
(
true
,
'
init
'
);
}
}
...
@@ -375,7 +413,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -375,7 +413,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
}
else
{
}
else
{
// 如果需要滚动,标记节点为已点击但保持显示状态
// 如果需要滚动,标记节点为已点击但保持显示状态
// 将节点设置为不可交互,防止重复点击
// 将节点设置为不可交互,防止重复点击
fireNode
.
off
(
cc
.
Node
.
EventType
.
TOUCH_END
,
this
.
onTouch
Fire
Node
,
this
);
fireNode
.
off
(
cc
.
Node
.
EventType
.
TOUCH_END
,
this
.
onTouch
Item
Node
,
this
);
}
}
// 移除了与页面a和页面b相关的逻辑
// 移除了与页面a和页面b相关的逻辑
...
@@ -744,7 +782,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -744,7 +782,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
}
}
// 处理糖果区域滚动
// 处理糖果区域滚动
if
(
this
.
needScroll
&&
this
.
layout
&&
this
.
layout
.
childrenCount
>
0
)
{
if
(
this
.
needScroll
&&
!
this
.
touching
&&
this
.
layout
&&
this
.
layout
.
childrenCount
>
0
)
{
// 移动糖果区域
// 移动糖果区域
this
.
layout
.
x
-=
this
.
scrollSpeed
*
dt
;
this
.
layout
.
x
-=
this
.
scrollSpeed
*
dt
;
...
...
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