Commit 7c2d2857 authored by Tt's avatar Tt

基础玩法完成,再核对一次需求,然后开始调整动画

parent 6945f6fb
......@@ -87,10 +87,7 @@
"__id__": 20
},
{
"__id__": 50
},
{
"__id__": 67
"__id__": 53
},
{
"__id__": 70
......@@ -99,52 +96,55 @@
"__id__": 73
},
{
"__id__": 74
"__id__": 76
},
{
"__id__": 75
"__id__": 77
},
{
"__id__": 77
"__id__": 78
},
{
"__id__": 83
"__id__": 80
},
{
"__id__": 96
"__id__": 86
},
{
"__id__": 122
"__id__": 99
},
{
"__id__": 124
"__id__": 125
},
{
"__id__": 126
"__id__": 127
},
{
"__id__": 128
"__id__": 129
},
{
"__id__": 130
"__id__": 131
},
{
"__id__": 132
"__id__": 133
},
{
"__id__": 134
"__id__": 135
},
{
"__id__": 137
}
],
"_active": true,
"_components": [
{
"__id__": 136
"__id__": 139
},
{
"__id__": 137
"__id__": 140
},
{
"__id__": 138
"__id__": 141
}
],
"_prefab": null,
......@@ -1020,10 +1020,10 @@
"__id__": 41
},
{
"__id__": 46
"__id__": 49
},
{
"__id__": 48
"__id__": 51
}
],
"_active": true,
......@@ -1992,6 +1992,9 @@
},
{
"__id__": 44
},
{
"__id__": 46
}
],
"_active": false,
......@@ -2232,6 +2235,124 @@
"_atlas": null,
"_id": "c0Fp2hxP5Lf7vYluaP31SL"
},
{
"__type__": "cc.Node",
"_name": "txt",
"_objFlags": 0,
"_parent": {
"__id__": 41
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 47
},
{
"__id__": 48
}
],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 149.38,
"height": 56.4
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
-1.798,
4.552,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "94pUu7zdlM3JrMf1qZVXEx"
},
{
"__type__": "cc.Label",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 46
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_string": "Compare",
"_N$string": "Compare",
"_fontSize": 35,
"_lineHeight": 40,
"_enableWrapText": true,
"_N$file": {
"__uuid__": "c551970e-b095-45f3-9f1d-25cde8b8deb1"
},
"_isSystemFontUsed": false,
"_spacingX": 0,
"_batchAsBitmap": false,
"_styleFlags": 0,
"_underlineHeight": 0,
"_N$horizontalAlign": 1,
"_N$verticalAlign": 1,
"_N$fontFamily": "Arial",
"_N$overflow": 0,
"_N$cacheMode": 0,
"_id": "38wAsXpXhHaoiTefyKoQIX"
},
{
"__type__": "cc.LabelOutline",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 46
},
"_enabled": true,
"_color": {
"__type__": "cc.Color",
"r": 166,
"g": 60,
"b": 28,
"a": 255
},
"_width": 3,
"_id": "09DEDGjKlKuYmAY+UKFVUO"
},
{
"__type__": "cc.Node",
"_name": "box_0",
......@@ -2243,7 +2364,7 @@
"_active": false,
"_components": [
{
"__id__": 47
"__id__": 50
}
],
"_prefab": null,
......@@ -2299,7 +2420,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 46
"__id__": 49
},
"_enabled": true,
"_materials": [
......@@ -2337,7 +2458,7 @@
"_active": false,
"_components": [
{
"__id__": 49
"__id__": 52
}
],
"_prefab": null,
......@@ -2393,7 +2514,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 48
"__id__": 51
},
"_enabled": true,
"_materials": [
......@@ -2429,10 +2550,10 @@
},
"_children": [
{
"__id__": 51
"__id__": 54
},
{
"__id__": 59
"__id__": 62
}
],
"_active": true,
......@@ -2490,23 +2611,23 @@
"_name": "item",
"_objFlags": 0,
"_parent": {
"__id__": 50
"__id__": 53
},
"_children": [
{
"__id__": 52
"__id__": 55
},
{
"__id__": 54
"__id__": 57
},
{
"__id__": 56
"__id__": 59
}
],
"_active": false,
"_components": [
{
"__id__": 58
"__id__": 61
}
],
"_prefab": null,
......@@ -2562,13 +2683,13 @@
"_name": "bg",
"_objFlags": 0,
"_parent": {
"__id__": 51
"__id__": 54
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 53
"__id__": 56
}
],
"_prefab": null,
......@@ -2624,7 +2745,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 52
"__id__": 55
},
"_enabled": true,
"_materials": [
......@@ -2656,13 +2777,13 @@
"_name": "icon",
"_objFlags": 0,
"_parent": {
"__id__": 51
"__id__": 54
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 55
"__id__": 58
}
],
"_prefab": null,
......@@ -2718,7 +2839,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 54
"__id__": 57
},
"_enabled": true,
"_materials": [
......@@ -2750,13 +2871,13 @@
"_name": "txt",
"_objFlags": 0,
"_parent": {
"__id__": 51
"__id__": 54
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 57
"__id__": 60
}
],
"_prefab": null,
......@@ -2812,7 +2933,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 56
"__id__": 59
},
"_enabled": true,
"_materials": [
......@@ -2847,7 +2968,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 51
"__id__": 54
},
"_enabled": true,
"_normalMaterial": null,
......@@ -2908,7 +3029,7 @@
"hoverSprite": null,
"_N$disabledSprite": null,
"_N$target": {
"__id__": 51
"__id__": 54
},
"_id": "58IQ76yf1KT71BqZoNtHOV"
},
......@@ -2917,23 +3038,23 @@
"_name": "item",
"_objFlags": 0,
"_parent": {
"__id__": 50
"__id__": 53
},
"_children": [
{
"__id__": 60
"__id__": 63
},
{
"__id__": 62
"__id__": 65
},
{
"__id__": 64
"__id__": 67
}
],
"_active": false,
"_components": [
{
"__id__": 66
"__id__": 69
}
],
"_prefab": null,
......@@ -2989,13 +3110,13 @@
"_name": "bg",
"_objFlags": 0,
"_parent": {
"__id__": 59
"__id__": 62
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 61
"__id__": 64
}
],
"_prefab": null,
......@@ -3051,7 +3172,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 60
"__id__": 63
},
"_enabled": true,
"_materials": [
......@@ -3083,13 +3204,13 @@
"_name": "icon",
"_objFlags": 0,
"_parent": {
"__id__": 59
"__id__": 62
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 63
"__id__": 66
}
],
"_prefab": null,
......@@ -3145,7 +3266,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 62
"__id__": 65
},
"_enabled": true,
"_materials": [
......@@ -3177,13 +3298,13 @@
"_name": "txt",
"_objFlags": 0,
"_parent": {
"__id__": 59
"__id__": 62
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 65
"__id__": 68
}
],
"_prefab": null,
......@@ -3239,7 +3360,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 64
"__id__": 67
},
"_enabled": true,
"_materials": [
......@@ -3274,7 +3395,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 59
"__id__": 62
},
"_enabled": true,
"_normalMaterial": null,
......@@ -3335,7 +3456,7 @@
"hoverSprite": null,
"_N$disabledSprite": null,
"_N$target": {
"__id__": 59
"__id__": 62
},
"_id": "7ayQ3f6atAS7c2pb2wuuAa"
},
......@@ -3350,10 +3471,10 @@
"_active": false,
"_components": [
{
"__id__": 68
"__id__": 71
},
{
"__id__": 69
"__id__": 72
}
],
"_prefab": null,
......@@ -3409,7 +3530,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 67
"__id__": 70
},
"_enabled": true,
"_materials": [
......@@ -3441,7 +3562,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 67
"__id__": 70
},
"_enabled": true,
"_normalMaterial": null,
......@@ -3502,7 +3623,7 @@
"hoverSprite": null,
"_N$disabledSprite": null,
"_N$target": {
"__id__": 67
"__id__": 70
},
"_id": "86ErSTSUhP26kFUGhhqqPn"
},
......@@ -3517,10 +3638,10 @@
"_active": true,
"_components": [
{
"__id__": 71
"__id__": 74
},
{
"__id__": 72
"__id__": 75
}
],
"_prefab": null,
......@@ -3576,7 +3697,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 70
"__id__": 73
},
"_enabled": true,
"_layoutSize": {
......@@ -3608,7 +3729,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 70
"__id__": 73
},
"_enabled": true,
"alignMode": 1,
......@@ -3757,7 +3878,7 @@
"_active": true,
"_components": [
{
"__id__": 76
"__id__": 79
}
],
"_prefab": null,
......@@ -3813,7 +3934,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 75
"__id__": 78
},
"_enabled": true,
"_materials": [
......@@ -3857,13 +3978,13 @@
},
"_children": [
{
"__id__": 78
"__id__": 81
}
],
"_active": true,
"_components": [
{
"__id__": 82
"__id__": 85
}
],
"_prefab": null,
......@@ -3919,17 +4040,17 @@
"_name": "Star",
"_objFlags": 0,
"_parent": {
"__id__": 77
"__id__": 80
},
"_children": [
{
"__id__": 79
"__id__": 82
}
],
"_active": false,
"_components": [
{
"__id__": 81
"__id__": 84
}
],
"_prefab": null,
......@@ -3985,13 +4106,13 @@
"_name": "StarBig",
"_objFlags": 0,
"_parent": {
"__id__": 78
"__id__": 81
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 80
"__id__": 83
}
],
"_prefab": null,
......@@ -4047,7 +4168,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 79
"__id__": 82
},
"_enabled": true,
"_materials": [
......@@ -4079,7 +4200,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 78
"__id__": 81
},
"_enabled": true,
"_materials": [
......@@ -4111,7 +4232,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 77
"__id__": 80
},
"_enabled": true,
"_materials": [
......@@ -4147,22 +4268,22 @@
},
"_children": [
{
"__id__": 84
"__id__": 87
},
{
"__id__": 86
"__id__": 89
},
{
"__id__": 88
"__id__": 91
},
{
"__id__": 90
"__id__": 93
},
{
"__id__": 92
"__id__": 95
},
{
"__id__": 94
"__id__": 97
}
],
"_active": true,
......@@ -4220,13 +4341,13 @@
"_name": "bg_sahua",
"_objFlags": 0,
"_parent": {
"__id__": 83
"__id__": 86
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 85
"__id__": 88
}
],
"_prefab": null,
......@@ -4282,7 +4403,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 84
"__id__": 87
},
"_enabled": true,
"_materials": [
......@@ -4314,13 +4435,13 @@
"_name": "bg_sahua",
"_objFlags": 0,
"_parent": {
"__id__": 83
"__id__": 86
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 87
"__id__": 90
}
],
"_prefab": null,
......@@ -4376,7 +4497,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 86
"__id__": 89
},
"_enabled": true,
"_materials": [
......@@ -4408,13 +4529,13 @@
"_name": "bg_sahua",
"_objFlags": 0,
"_parent": {
"__id__": 83
"__id__": 86
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 89
"__id__": 92
}
],
"_prefab": null,
......@@ -4470,7 +4591,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 88
"__id__": 91
},
"_enabled": true,
"_materials": [
......@@ -4502,13 +4623,13 @@
"_name": "bg_sahua",
"_objFlags": 0,
"_parent": {
"__id__": 83
"__id__": 86
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 91
"__id__": 94
}
],
"_prefab": null,
......@@ -4564,7 +4685,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 90
"__id__": 93
},
"_enabled": true,
"_materials": [
......@@ -4596,13 +4717,13 @@
"_name": "bg_sahua",
"_objFlags": 0,
"_parent": {
"__id__": 83
"__id__": 86
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 93
"__id__": 96
}
],
"_prefab": null,
......@@ -4658,7 +4779,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 92
"__id__": 95
},
"_enabled": true,
"_materials": [
......@@ -4690,13 +4811,13 @@
"_name": "bg_sahua",
"_objFlags": 0,
"_parent": {
"__id__": 83
"__id__": 86
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 95
"__id__": 98
}
],
"_prefab": null,
......@@ -4752,7 +4873,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 94
"__id__": 97
},
"_enabled": true,
"_materials": [
......@@ -4788,19 +4909,19 @@
},
"_children": [
{
"__id__": 97
"__id__": 100
},
{
"__id__": 102
"__id__": 105
},
{
"__id__": 107
"__id__": 110
},
{
"__id__": 112
"__id__": 115
},
{
"__id__": 117
"__id__": 120
}
],
"_active": true,
......@@ -4858,11 +4979,11 @@
"_name": "quadBase",
"_objFlags": 0,
"_parent": {
"__id__": 96
"__id__": 99
},
"_children": [
{
"__id__": 98
"__id__": 101
}
],
"_active": true,
......@@ -4920,17 +5041,17 @@
"_name": "quad",
"_objFlags": 0,
"_parent": {
"__id__": 97
"__id__": 100
},
"_children": [
{
"__id__": 99
"__id__": 102
}
],
"_active": true,
"_components": [
{
"__id__": 101
"__id__": 104
}
],
"_prefab": null,
......@@ -4986,13 +5107,13 @@
"_name": "paper",
"_objFlags": 0,
"_parent": {
"__id__": 98
"__id__": 101
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 100
"__id__": 103
}
],
"_prefab": null,
......@@ -5048,7 +5169,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 99
"__id__": 102
},
"_enabled": true,
"_materials": [
......@@ -5080,7 +5201,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 98
"__id__": 101
},
"_enabled": true,
"_materials": [
......@@ -5102,11 +5223,11 @@
"_name": "quadBase",
"_objFlags": 0,
"_parent": {
"__id__": 96
"__id__": 99
},
"_children": [
{
"__id__": 103
"__id__": 106
}
],
"_active": true,
......@@ -5164,17 +5285,17 @@
"_name": "quad",
"_objFlags": 0,
"_parent": {
"__id__": 102
"__id__": 105
},
"_children": [
{
"__id__": 104
"__id__": 107
}
],
"_active": true,
"_components": [
{
"__id__": 106
"__id__": 109
}
],
"_prefab": null,
......@@ -5230,13 +5351,13 @@
"_name": "paper",
"_objFlags": 0,
"_parent": {
"__id__": 103
"__id__": 106
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 105
"__id__": 108
}
],
"_prefab": null,
......@@ -5292,7 +5413,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 104
"__id__": 107
},
"_enabled": true,
"_materials": [
......@@ -5324,7 +5445,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 103
"__id__": 106
},
"_enabled": true,
"_materials": [
......@@ -5346,11 +5467,11 @@
"_name": "quadBase",
"_objFlags": 0,
"_parent": {
"__id__": 96
"__id__": 99
},
"_children": [
{
"__id__": 108
"__id__": 111
}
],
"_active": true,
......@@ -5408,17 +5529,17 @@
"_name": "quad",
"_objFlags": 0,
"_parent": {
"__id__": 107
"__id__": 110
},
"_children": [
{
"__id__": 109
"__id__": 112
}
],
"_active": true,
"_components": [
{
"__id__": 111
"__id__": 114
}
],
"_prefab": null,
......@@ -5474,13 +5595,13 @@
"_name": "paper",
"_objFlags": 0,
"_parent": {
"__id__": 108
"__id__": 111
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 110
"__id__": 113
}
],
"_prefab": null,
......@@ -5536,7 +5657,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 109
"__id__": 112
},
"_enabled": true,
"_materials": [
......@@ -5568,7 +5689,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 108
"__id__": 111
},
"_enabled": true,
"_materials": [
......@@ -5590,11 +5711,11 @@
"_name": "quadBase",
"_objFlags": 0,
"_parent": {
"__id__": 96
"__id__": 99
},
"_children": [
{
"__id__": 113
"__id__": 116
}
],
"_active": true,
......@@ -5652,17 +5773,17 @@
"_name": "quad",
"_objFlags": 0,
"_parent": {
"__id__": 112
"__id__": 115
},
"_children": [
{
"__id__": 114
"__id__": 117
}
],
"_active": true,
"_components": [
{
"__id__": 116
"__id__": 119
}
],
"_prefab": null,
......@@ -5718,13 +5839,13 @@
"_name": "paper",
"_objFlags": 0,
"_parent": {
"__id__": 113
"__id__": 116
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 115
"__id__": 118
}
],
"_prefab": null,
......@@ -5780,7 +5901,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 114
"__id__": 117
},
"_enabled": true,
"_materials": [
......@@ -5812,7 +5933,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 113
"__id__": 116
},
"_enabled": true,
"_materials": [
......@@ -5834,11 +5955,11 @@
"_name": "quadBase",
"_objFlags": 0,
"_parent": {
"__id__": 96
"__id__": 99
},
"_children": [
{
"__id__": 118
"__id__": 121
}
],
"_active": true,
......@@ -5896,17 +6017,17 @@
"_name": "quad",
"_objFlags": 0,
"_parent": {
"__id__": 117
"__id__": 120
},
"_children": [
{
"__id__": 119
"__id__": 122
}
],
"_active": true,
"_components": [
{
"__id__": 121
"__id__": 124
}
],
"_prefab": null,
......@@ -5962,13 +6083,13 @@
"_name": "paper",
"_objFlags": 0,
"_parent": {
"__id__": 118
"__id__": 121
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 120
"__id__": 123
}
],
"_prefab": null,
......@@ -6024,7 +6145,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 119
"__id__": 122
},
"_enabled": true,
"_materials": [
......@@ -6056,7 +6177,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 118
"__id__": 121
},
"_enabled": true,
"_materials": [
......@@ -6084,7 +6205,7 @@
"_active": true,
"_components": [
{
"__id__": 123
"__id__": 126
}
],
"_prefab": null,
......@@ -6140,7 +6261,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 122
"__id__": 125
},
"_enabled": true,
"_clip": {
......@@ -6165,7 +6286,7 @@
"_active": true,
"_components": [
{
"__id__": 125
"__id__": 128
}
],
"_prefab": null,
......@@ -6221,7 +6342,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 124
"__id__": 127
},
"_enabled": true,
"_clip": {
......@@ -6246,7 +6367,7 @@
"_active": true,
"_components": [
{
"__id__": 127
"__id__": 130
}
],
"_prefab": null,
......@@ -6302,7 +6423,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 126
"__id__": 129
},
"_enabled": true,
"_clip": {
......@@ -6327,7 +6448,7 @@
"_active": true,
"_components": [
{
"__id__": 129
"__id__": 132
}
],
"_prefab": null,
......@@ -6383,7 +6504,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 128
"__id__": 131
},
"_enabled": true,
"_clip": {
......@@ -6408,7 +6529,7 @@
"_active": true,
"_components": [
{
"__id__": 131
"__id__": 134
}
],
"_prefab": null,
......@@ -6464,7 +6585,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 130
"__id__": 133
},
"_enabled": true,
"_clip": {
......@@ -6489,7 +6610,7 @@
"_active": true,
"_components": [
{
"__id__": 133
"__id__": 136
}
],
"_prefab": null,
......@@ -6545,7 +6666,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 132
"__id__": 135
},
"_enabled": true,
"_clip": {
......@@ -6570,7 +6691,7 @@
"_active": true,
"_components": [
{
"__id__": 135
"__id__": 138
}
],
"_prefab": null,
......@@ -6626,7 +6747,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 134
"__id__": 137
},
"_enabled": true,
"_clip": {
......
......@@ -137,55 +137,7 @@ cc.Class({
this.initSingleData();
this.initAudio();
this.initView();
// this.initButton();
},
initButton() {
//触碰判断
let item = pg.view.find(this, "items/item");
item.on(cc.Node.EventType.TOUCH_START, this.onStartItem, this);
item.on(cc.Node.EventType.TOUCH_END, this.onEndItem, this);
item.on(cc.Node.EventType.TOUCH_MOVE, this.onMoveItem, this);
item.on(cc.Node.EventType.TOUCH_CANCEL, this.onCancelItem, this);
},
onStartItem(touch) {
this._startPos = cc.v2(touch.target.x, touch.target.y);
let touchPos = touch.getLocation();
touch.target.x = touchPos.x - 1280 / 2;
touch.target.y = touchPos.y - 720 / 2;
},
onEndItem(touch) {
let box_0 = pg.view.find(this, "box/box_0");
//检测碰撞
if (this.checkCollider(touch.target, box_0)) {
} else {
//碰撞失败退回原位置
touch.target.x = this._startPos.x;
touch.target.y = this._startPos.y;
}
},
onMoveItem(touch) {
//获取到的location是 当前点击的位置 而不是按钮原本应该所在的位置。
let touchPos = touch.getLocation();
touch.target.x = touchPos.x - 1280 / 2;
touch.target.y = touchPos.y - 720 / 2;
},
onCancelItem(touch) {
console.log(touch);
},
checkCollider(item, box) {
return item.x > box.x - box.width / 2
&& item.x < box.x + box.width / 2
&& item.y > box.y - box.height / 2
&& item.y < box.y + box.height / 2;
},
......@@ -268,16 +220,20 @@ cc.Class({
let addX = 190;
let y = 75;
for (let i = 0; i < sonleis.length; i++) {
let data = sonleis[i];
let sonClone = cc.instantiate(son);
sonClone.active = true;
let posX = x + addX * i;
let posY = y;
sonClone.x = posX;
sonClone.y = posY;
sonClone.data = data;
pg.view.setString(pg.view.find(sonClone, "txt"), data.title);
box.addChild(sonClone);
}
},
initBox() {
this._boxItems = [];
//刷新子类
let son = pg.view.find(this, "box/box_0");
let box = pg.view.find(this, "box");
......@@ -289,12 +245,15 @@ cc.Class({
let y = -62;
for (let i = 0; i < sonleis.length; i++) {
let sonClone = cc.instantiate(son);
let data = sonleis[i];
sonClone.data = data;
sonClone.active = true;
let posX = x + addX * i;
let posY = y;
sonClone.x = posX;
sonClone.y = posY;
box.addChild(sonClone);
this._boxItems.push(sonClone);
}
},
initItems() {
......@@ -309,11 +268,14 @@ cc.Class({
let addY = -90;
for (let i = 0; i < sonleis.length; i++) {
let sonClone = cc.instantiate(son);
let data = sonleis[i];
sonClone.data = data;
sonClone.active = true;
let posX = x + addX * (i % 7);
let posY = y + addY * Math.floor(i / 7);
sonClone.x = posX;
sonClone.y = posY;
this.initButton(sonClone);
box.addChild(sonClone);
}
} else {
......@@ -325,6 +287,8 @@ cc.Class({
let arr = [3, 4, 5, 6, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30];
for (let i = 0; i < sonleis.length; i++) {
let sonClone = cc.instantiate(son);
let data = sonleis[i];
sonClone.data = data;
sonClone.active = true;
let posX = x + addX * (arr[i] % 10);
let posY = y + addY * Math.floor(arr[i] / 10);
......@@ -332,11 +296,72 @@ cc.Class({
sonClone.y = posY;
sonClone.scaleX = scale;
sonClone.scaleY = scale;
this.initButton(sonClone);
box.addChild(sonClone);
}
}
},
initButton(item) {
item.on(cc.Node.EventType.TOUCH_START, this.onStartItem, this);
item.on(cc.Node.EventType.TOUCH_END, this.onEndItem, this);
item.on(cc.Node.EventType.TOUCH_MOVE, this.onMoveItem, this);
item.on(cc.Node.EventType.TOUCH_CANCEL, this.onCancelItem, this);
},
onStartItem(touch) {
this._startPos = cc.v2(touch.target.x, touch.target.y);
let touchPos = touch.getLocation();
touch.target.x = touchPos.x - 1280 / 2;
touch.target.y = touchPos.y - 720 / 2;
},
onEndItem(touch) {
//检测碰撞
let box = this.getCollider(touch.target);
if (box) {
//成功 失败的判断 根据id
let successed = box.data.child.some(dt => dt.cardId == touch.target.data.cardId);
if (successed) {
alert("成功")
} else {
alert("失败")
//碰撞失败退回原位置
touch.target.x = this._startPos.x;
touch.target.y = this._startPos.y;
}
} else {
//碰撞失败退回原位置
touch.target.x = this._startPos.x;
touch.target.y = this._startPos.y;
}
},
onMoveItem(touch) {
//获取到的location是 当前点击的位置 而不是按钮原本应该所在的位置。
let touchPos = touch.getLocation();
touch.target.x = touchPos.x - 1280 / 2;
touch.target.y = touchPos.y - 720 / 2;
},
onCancelItem(touch) {
console.log(touch);
},
getCollider(item) {
for (let i = 0; i < this._boxItems.length; i++) {
if (this.checkCollider(item, this._boxItems[i])) return this._boxItems[i];
}
return null;
},
checkCollider(item, box) {
return item.x > box.x - box.width / 2
&& item.x < box.x + box.width / 2
&& item.y > box.y - box.height / 2
&& item.y < box.y + box.height / 2;
},
// updateItem(item, data) {
// let img = pg.view.find(item, `img`);
......
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