Commit a6e36294 authored by Tt's avatar Tt

1

parent 378f521f
......@@ -84,25 +84,25 @@
"__id__": 61
},
{
"__id__": 82
"__id__": 81
},
{
"__id__": 116
"__id__": 115
},
{
"__id__": 130
"__id__": 129
}
],
"_active": true,
"_components": [
{
"__id__": 151
"__id__": 150
},
{
"__id__": 152
"__id__": 151
},
{
"__id__": 153
"__id__": 152
}
],
"_prefab": null,
......@@ -2835,7 +2835,7 @@
"_active": true,
"_components": [
{
"__id__": 81
"__id__": 80
}
],
"_prefab": null,
......@@ -3246,7 +3246,7 @@
"ctor": "Float64Array",
"array": [
-565.389,
117.901,
0,
0,
0,
0,
......@@ -3599,7 +3599,7 @@
"_active": true,
"_components": [
{
"__id__": 80
"__id__": 79
}
],
"_prefab": null,
......@@ -3659,11 +3659,7 @@
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 79
}
],
"_components": [],
"_prefab": null,
"_opacity": 255,
"_color": {
......@@ -3712,38 +3708,6 @@
"groupIndex": 0,
"_id": "96TT/9ba1Bna43AEcDPUEz"
},
{
"__type__": "cc.Layout",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 78
},
"_enabled": true,
"_layoutSize": {
"__type__": "cc.Size",
"width": -30,
"height": 400
},
"_resize": 1,
"_N$layoutType": 1,
"_N$cellSize": {
"__type__": "cc.Size",
"width": 40,
"height": 40
},
"_N$startAxis": 0,
"_N$paddingLeft": 0,
"_N$paddingRight": 0,
"_N$paddingTop": 0,
"_N$paddingBottom": 0,
"_N$spacingX": 30,
"_N$spacingY": 0,
"_N$verticalDirection": 1,
"_N$horizontalDirection": 0,
"_N$affectedByScale": false,
"_id": "59LyzwfhRHgJYhEvtIeB8r"
},
{
"__type__": "cc.Mask",
"_name": "",
......@@ -3800,40 +3764,40 @@
},
"_children": [
{
"__id__": 83
"__id__": 82
},
{
"__id__": 87
"__id__": 86
},
{
"__id__": 89
"__id__": 88
},
{
"__id__": 101
"__id__": 100
},
{
"__id__": 103
"__id__": 102
},
{
"__id__": 105
"__id__": 104
},
{
"__id__": 107
"__id__": 106
},
{
"__id__": 109
"__id__": 108
},
{
"__id__": 111
"__id__": 110
},
{
"__id__": 113
"__id__": 112
}
],
"_active": false,
"_components": [
{
"__id__": 115
"__id__": 114
}
],
"_prefab": null,
......@@ -3889,19 +3853,19 @@
"_name": "gray",
"_objFlags": 0,
"_parent": {
"__id__": 82
"__id__": 81
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 84
"__id__": 83
},
{
"__id__": 85
"__id__": 84
},
{
"__id__": 86
"__id__": 85
}
],
"_prefab": null,
......@@ -3957,7 +3921,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 83
"__id__": 82
},
"_enabled": true,
"_materials": [
......@@ -3989,7 +3953,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 83
"__id__": 82
},
"_enabled": true,
"alignMode": 1,
......@@ -4016,7 +3980,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 83
"__id__": 82
},
"_enabled": true,
"_id": "aaLLTNJ4JCrLs1MiLwHmnN"
......@@ -4026,13 +3990,13 @@
"_name": "btn_close",
"_objFlags": 0,
"_parent": {
"__id__": 82
"__id__": 81
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 88
"__id__": 87
}
],
"_prefab": null,
......@@ -4088,7 +4052,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 87
"__id__": 86
},
"_enabled": true,
"_materials": [
......@@ -4120,29 +4084,29 @@
"_name": "bg_card",
"_objFlags": 0,
"_parent": {
"__id__": 82
"__id__": 81
},
"_children": [
{
"__id__": 90
"__id__": 89
},
{
"__id__": 92
"__id__": 91
},
{
"__id__": 94
"__id__": 93
},
{
"__id__": 96
"__id__": 95
},
{
"__id__": 98
"__id__": 97
}
],
"_active": true,
"_components": [
{
"__id__": 100
"__id__": 99
}
],
"_prefab": null,
......@@ -4198,13 +4162,13 @@
"_name": "bg_title",
"_objFlags": 0,
"_parent": {
"__id__": 89
"__id__": 88
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 91
"__id__": 90
}
],
"_prefab": null,
......@@ -4260,7 +4224,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 90
"__id__": 89
},
"_enabled": true,
"_materials": [
......@@ -4292,13 +4256,13 @@
"_name": "btn_voice",
"_objFlags": 0,
"_parent": {
"__id__": 89
"__id__": 88
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 93
"__id__": 92
}
],
"_prefab": null,
......@@ -4354,7 +4318,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 92
"__id__": 91
},
"_enabled": true,
"_materials": [
......@@ -4386,13 +4350,13 @@
"_name": "icon",
"_objFlags": 0,
"_parent": {
"__id__": 89
"__id__": 88
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 95
"__id__": 94
}
],
"_prefab": null,
......@@ -4448,7 +4412,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 94
"__id__": 93
},
"_enabled": true,
"_materials": [
......@@ -4480,13 +4444,13 @@
"_name": "word",
"_objFlags": 0,
"_parent": {
"__id__": 89
"__id__": 88
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 97
"__id__": 96
}
],
"_prefab": null,
......@@ -4542,7 +4506,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 96
"__id__": 95
},
"_enabled": true,
"_materials": [
......@@ -4575,13 +4539,13 @@
"_name": "label_progress",
"_objFlags": 0,
"_parent": {
"__id__": 89
"__id__": 88
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 99
"__id__": 98
}
],
"_prefab": null,
......@@ -4637,7 +4601,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 98
"__id__": 97
},
"_enabled": true,
"_materials": [
......@@ -4670,7 +4634,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 89
"__id__": 88
},
"_enabled": true,
"_materials": [
......@@ -4702,13 +4666,13 @@
"_name": "btn_start",
"_objFlags": 0,
"_parent": {
"__id__": 82
"__id__": 81
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 102
"__id__": 101
}
],
"_prefab": null,
......@@ -4764,7 +4728,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 101
"__id__": 100
},
"_enabled": true,
"_materials": [
......@@ -4796,13 +4760,13 @@
"_name": "btn_start_reset",
"_objFlags": 0,
"_parent": {
"__id__": 82
"__id__": 81
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 104
"__id__": 103
}
],
"_prefab": null,
......@@ -4858,7 +4822,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 103
"__id__": 102
},
"_enabled": true,
"_materials": [
......@@ -4890,13 +4854,13 @@
"_name": "btn_stop",
"_objFlags": 0,
"_parent": {
"__id__": 82
"__id__": 81
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 106
"__id__": 105
}
],
"_prefab": null,
......@@ -4952,7 +4916,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 105
"__id__": 104
},
"_enabled": true,
"_materials": [
......@@ -4984,13 +4948,13 @@
"_name": "btn_record_replay",
"_objFlags": 0,
"_parent": {
"__id__": 82
"__id__": 81
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 108
"__id__": 107
}
],
"_prefab": null,
......@@ -5046,7 +5010,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 107
"__id__": 106
},
"_enabled": true,
"_materials": [
......@@ -5078,13 +5042,13 @@
"_name": "btn_record_0",
"_objFlags": 0,
"_parent": {
"__id__": 82
"__id__": 81
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 110
"__id__": 109
}
],
"_prefab": null,
......@@ -5140,7 +5104,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 109
"__id__": 108
},
"_enabled": true,
"_materials": [
......@@ -5172,13 +5136,13 @@
"_name": "btn_record_1",
"_objFlags": 0,
"_parent": {
"__id__": 82
"__id__": 81
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 112
"__id__": 111
}
],
"_prefab": null,
......@@ -5234,7 +5198,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 111
"__id__": 110
},
"_enabled": true,
"_materials": [
......@@ -5266,13 +5230,13 @@
"_name": "btn_record_2",
"_objFlags": 0,
"_parent": {
"__id__": 82
"__id__": 81
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 114
"__id__": 113
}
],
"_prefab": null,
......@@ -5328,7 +5292,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 113
"__id__": 112
},
"_enabled": true,
"_materials": [
......@@ -5360,7 +5324,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 82
"__id__": 81
},
"_enabled": true,
"alignMode": 1,
......@@ -5391,25 +5355,25 @@
},
"_children": [
{
"__id__": 117
"__id__": 116
},
{
"__id__": 121
"__id__": 120
},
{
"__id__": 123
"__id__": 122
},
{
"__id__": 125
"__id__": 124
},
{
"__id__": 127
"__id__": 126
}
],
"_active": false,
"_components": [
{
"__id__": 129
"__id__": 128
}
],
"_prefab": null,
......@@ -5465,19 +5429,19 @@
"_name": "gray",
"_objFlags": 0,
"_parent": {
"__id__": 116
"__id__": 115
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 118
"__id__": 117
},
{
"__id__": 119
"__id__": 118
},
{
"__id__": 120
"__id__": 119
}
],
"_prefab": null,
......@@ -5533,7 +5497,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 117
"__id__": 116
},
"_enabled": true,
"_materials": [
......@@ -5565,7 +5529,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 117
"__id__": 116
},
"_enabled": true,
"alignMode": 1,
......@@ -5592,7 +5556,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 117
"__id__": 116
},
"_enabled": true,
"_id": "06Mffqf45GhK4NFe0w8hTw"
......@@ -5602,13 +5566,13 @@
"_name": "ani_comeon",
"_objFlags": 0,
"_parent": {
"__id__": 116
"__id__": 115
},
"_children": [],
"_active": false,
"_components": [
{
"__id__": 122
"__id__": 121
}
],
"_prefab": null,
......@@ -5664,7 +5628,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 121
"__id__": 120
},
"_enabled": true,
"_materials": [
......@@ -5704,13 +5668,13 @@
"_name": "ani_excellent",
"_objFlags": 0,
"_parent": {
"__id__": 116
"__id__": 115
},
"_children": [],
"_active": false,
"_components": [
{
"__id__": 124
"__id__": 123
}
],
"_prefab": null,
......@@ -5766,7 +5730,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 123
"__id__": 122
},
"_enabled": true,
"_materials": [
......@@ -5806,13 +5770,13 @@
"_name": "ani_nice",
"_objFlags": 0,
"_parent": {
"__id__": 116
"__id__": 115
},
"_children": [],
"_active": false,
"_components": [
{
"__id__": 126
"__id__": 125
}
],
"_prefab": null,
......@@ -5868,7 +5832,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 125
"__id__": 124
},
"_enabled": true,
"_materials": [
......@@ -5908,13 +5872,13 @@
"_name": "ani_tryagain",
"_objFlags": 0,
"_parent": {
"__id__": 116
"__id__": 115
},
"_children": [],
"_active": false,
"_components": [
{
"__id__": 128
"__id__": 127
}
],
"_prefab": null,
......@@ -5970,7 +5934,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 127
"__id__": 126
},
"_enabled": true,
"_materials": [
......@@ -6010,7 +5974,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 116
"__id__": 115
},
"_enabled": true,
"alignMode": 1,
......@@ -6041,19 +6005,19 @@
},
"_children": [
{
"__id__": 131
"__id__": 130
},
{
"__id__": 135
"__id__": 134
},
{
"__id__": 139
"__id__": 138
},
{
"__id__": 143
"__id__": 142
},
{
"__id__": 147
"__id__": 146
}
],
"_active": false,
......@@ -6111,11 +6075,11 @@
"_name": "quadBase",
"_objFlags": 0,
"_parent": {
"__id__": 130
"__id__": 129
},
"_children": [
{
"__id__": 132
"__id__": 131
}
],
"_active": true,
......@@ -6173,11 +6137,11 @@
"_name": "quad",
"_objFlags": 0,
"_parent": {
"__id__": 131
"__id__": 130
},
"_children": [
{
"__id__": 133
"__id__": 132
}
],
"_active": true,
......@@ -6235,13 +6199,13 @@
"_name": "paper",
"_objFlags": 0,
"_parent": {
"__id__": 132
"__id__": 131
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 134
"__id__": 133
}
],
"_prefab": null,
......@@ -6297,7 +6261,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 133
"__id__": 132
},
"_enabled": true,
"_materials": [
......@@ -6327,11 +6291,11 @@
"_name": "quadBase",
"_objFlags": 0,
"_parent": {
"__id__": 130
"__id__": 129
},
"_children": [
{
"__id__": 136
"__id__": 135
}
],
"_active": true,
......@@ -6389,11 +6353,11 @@
"_name": "quad",
"_objFlags": 0,
"_parent": {
"__id__": 135
"__id__": 134
},
"_children": [
{
"__id__": 137
"__id__": 136
}
],
"_active": true,
......@@ -6451,13 +6415,13 @@
"_name": "paper",
"_objFlags": 0,
"_parent": {
"__id__": 136
"__id__": 135
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 138
"__id__": 137
}
],
"_prefab": null,
......@@ -6513,7 +6477,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 137
"__id__": 136
},
"_enabled": true,
"_materials": [
......@@ -6543,11 +6507,11 @@
"_name": "quadBase",
"_objFlags": 0,
"_parent": {
"__id__": 130
"__id__": 129
},
"_children": [
{
"__id__": 140
"__id__": 139
}
],
"_active": true,
......@@ -6605,11 +6569,11 @@
"_name": "quad",
"_objFlags": 0,
"_parent": {
"__id__": 139
"__id__": 138
},
"_children": [
{
"__id__": 141
"__id__": 140
}
],
"_active": true,
......@@ -6667,13 +6631,13 @@
"_name": "paper",
"_objFlags": 0,
"_parent": {
"__id__": 140
"__id__": 139
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 142
"__id__": 141
}
],
"_prefab": null,
......@@ -6729,7 +6693,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 141
"__id__": 140
},
"_enabled": true,
"_materials": [
......@@ -6759,11 +6723,11 @@
"_name": "quadBase",
"_objFlags": 0,
"_parent": {
"__id__": 130
"__id__": 129
},
"_children": [
{
"__id__": 144
"__id__": 143
}
],
"_active": true,
......@@ -6821,11 +6785,11 @@
"_name": "quad",
"_objFlags": 0,
"_parent": {
"__id__": 143
"__id__": 142
},
"_children": [
{
"__id__": 145
"__id__": 144
}
],
"_active": true,
......@@ -6883,13 +6847,13 @@
"_name": "paper",
"_objFlags": 0,
"_parent": {
"__id__": 144
"__id__": 143
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 146
"__id__": 145
}
],
"_prefab": null,
......@@ -6945,7 +6909,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 145
"__id__": 144
},
"_enabled": true,
"_materials": [
......@@ -6975,11 +6939,11 @@
"_name": "quadBase",
"_objFlags": 0,
"_parent": {
"__id__": 130
"__id__": 129
},
"_children": [
{
"__id__": 148
"__id__": 147
}
],
"_active": true,
......@@ -7037,11 +7001,11 @@
"_name": "quad",
"_objFlags": 0,
"_parent": {
"__id__": 147
"__id__": 146
},
"_children": [
{
"__id__": 149
"__id__": 148
}
],
"_active": true,
......@@ -7099,13 +7063,13 @@
"_name": "paper",
"_objFlags": 0,
"_parent": {
"__id__": 148
"__id__": 147
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 150
"__id__": 149
}
],
"_prefab": null,
......@@ -7161,7 +7125,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 149
"__id__": 148
},
"_enabled": true,
"_materials": [
......@@ -7242,17 +7206,23 @@
"__id__": 61
},
"layout_tip": {
"__id__": 116
"__id__": 115
},
"layout_speak": {
"__id__": 82
"__id__": 81
},
"btn_close": {
"__id__": 87
"__id__": 86
},
"btn_hammer": {
"__id__": 67
},
"item": {
"__id__": 69
},
"layout": {
"__id__": 78
},
"btn_hammer": null,
"item": null,
"layout": null,
"_id": "db3L+4L+FH/5MIRcKcfiq+"
}
]
\ No newline at end of file
......@@ -52,6 +52,13 @@ enum TIPS_STATE {
NICE, // 不错提示 (2星,80分以下)
EXCELLENT, // 优秀提示 (3星,80分及以上)
}
/**
* 定义糖果节点接口,继承自cc.Node并添加data属性
*/
interface CandyNode extends cc.Node {
data: any;
}
/**
* 场景组件类
* 继承自 MyCocosSceneComponent,实现游戏的主要逻辑
......@@ -231,6 +238,68 @@ export default class SceneComponent extends MyCocosSceneComponent {
* 移除了消防车入场动画方法
*/
/**
* 更新糖果节点的内容
* @param candyNode 要更新的糖果节点
* @param data 节点数据
* @param index 题目在数组中的索引,用于确定显示哪个糖果图标
*/
updateItem(candyNode: CandyNode, data: Option, index: number = 0) {
// 设置基本属性
candyNode.data = data;
candyNode.active = true;
candyNode.y = 0;
candyNode.x = index * 320 + 150;
// 获取子节点
const iconNode = candyNode.getChildByName('icon');
const labelNode = candyNode.getChildByName('label');
const bgFullNode = candyNode.getChildByName('bg_full');
const bgBrokenNode = candyNode.getChildByName('bg_broken');
// 设置背景状态:默认显示bg_full,隐藏bg_broken
if (bgFullNode) {
bgFullNode.active = true;
}
if (bgBrokenNode) {
bgBrokenNode.active = false;
}
// 根据索引设置糖果图标(candy_0 ~ candy_4)
if (iconNode) {
// 确保索引在有效范围内(0-4)
const candyIndex = Math.min(Math.max(index, 0), 4);
const candyIconName = `candy_${candyIndex}`;
// 使用pg.view.setImg加载对应的糖果图标
pg.view.setImg(iconNode, candyIconName);
iconNode.active = true;
}
// 根据数据类型设置显示内容
if (data.type === 'img' && data.picUrl) {
// 如果有图片URL,使用网络图片
if (iconNode) {
pg.view.setNetImg(iconNode, data.picUrl, { w: 200, h: 200 });
iconNode.active = true;
}
if (labelNode) {
labelNode.active = false;
}
} else if (data.txt) {
// 显示文本,保持图标显示
if (labelNode) {
pg.view.setString(labelNode, data.txt);
labelNode.active = true;
}
}
// 添加点击事件(如果节点上没有该事件)
if (!candyNode.hasEventListener(cc.Node.EventType.TOUCH_END)) {
candyNode.on(cc.Node.EventType.TOUCH_END, this.onTouchFireNode, this);
}
}
/**
* 显示当前页面
* 移除了与页面a和页面b相关的逻辑
......@@ -255,48 +324,10 @@ export default class SceneComponent extends MyCocosSceneComponent {
// 遍历页面数据
pageData.forEach((data, index) => {
// 克隆糖果节点
const candyNode = cc.instantiate(this.item);
// 设置糖果节点的位置
// 这里可以根据需要调整位置计算逻辑
const row = Math.floor(index / 3); // 每行3个
const col = index % 3;
candyNode.setPosition(col * 300 - 300, row * -250 + 100);
// 将数据保存到节点上,以便后续使用
candyNode.data = data;
// 设置糖果节点的显示内容
// 如果有图片,设置图片
if (data.type === 'img' && data.picUrl) {
const iconNode = candyNode.getChildByName('icon');
if (iconNode) {
pg.view.setNetImg(iconNode, data.picUrl, { w: 200, h: 200 });
iconNode.active = true;
}
// 隐藏文本节点
const labelNode = candyNode.getChildByName('label');
if (labelNode) {
labelNode.active = false;
}
}
// 如果是文本,设置文本
else if (data.txt) {
const labelNode = candyNode.getChildByName('label');
if (labelNode) {
pg.view.setString(labelNode, data.txt);
labelNode.active = true;
}
const candyNode = cc.instantiate(this.item) as CandyNode;
// 隐藏图片节点
const iconNode = candyNode.getChildByName('icon');
if (iconNode) {
iconNode.active = false;
}
}
// 添加点击事件
candyNode.on(cc.Node.EventType.TOUCH_END, this.onTouchFireNode, this);
// 使用updateItem方法更新节点内容,传入索引以显示对应的糖果图标
this.updateItem(candyNode, data, index);
// 将糖果节点添加到活跃火苗节点数组
this.activeFireNodes.push(candyNode);
......@@ -305,15 +336,6 @@ export default class SceneComponent extends MyCocosSceneComponent {
this.layout.addChild(candyNode);
});
}
// 如果不是第一页,则添加layout_game向左移动的动画
if (prevPage >= 0) {
// 使用cc.tween实现layout_game向左移动一页的距离(1920)
cc.tween(this.layout_game)
.to(3.0, { x: -1920 * currentPage }, { easing: 'cubicOut' })
.start();
// 移除了消防车位置调整的代码
}
}
/**
* 移除了消防车点击事件处理方法
......@@ -325,9 +347,9 @@ export default class SceneComponent extends MyCocosSceneComponent {
* 移除了喷水动画相关代码
* @param e 事件对象或包含target属性的模拟事件对象
*/
private currentFireNode: cc.Node;
private currentFireNode: CandyNode;
async onTouchFireNode(e) {
const fireNode: cc.Node = e.target;
const fireNode = e.target as CandyNode;
pg.hw.playLocalAudio('fire_water');
// 保存触摸数据
......@@ -351,6 +373,17 @@ export default class SceneComponent extends MyCocosSceneComponent {
// 隐藏对应的fire节点
fireNode.active = false;
// 更新糖果背景状态:隐藏bg_full,显示bg_broken
const bgFullNode = fireNode.getChildByName('bg_full');
const bgBrokenNode = fireNode.getChildByName('bg_broken');
if (bgFullNode) {
bgFullNode.active = false;
}
if (bgBrokenNode) {
bgBrokenNode.active = true;
}
// 移除了与页面a和页面b相关的逻辑
// 移除了与消防车冲水动画相关的代码
......@@ -379,6 +412,17 @@ export default class SceneComponent extends MyCocosSceneComponent {
// 确保火苗节点保持显示状态
if (fireNode) {
fireNode.active = true;
// 更新糖果背景状态:显示bg_full,隐藏bg_broken
const bgFullNode = fireNode.getChildByName('bg_full');
const bgBrokenNode = fireNode.getChildByName('bg_broken');
if (bgFullNode) {
bgFullNode.active = true;
}
if (bgBrokenNode) {
bgBrokenNode.active = false;
}
}
// 移除了与消防车冲水动画相关的代码
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment