Browse Source

【修改】修改商城

DESKTOP-VHLO35R\Administrator 1 year ago
parent
commit
9d18e79488

+ 144 - 33
assets/resources/edt_prefab/Shop/ShopItem.prefab

@@ -24,11 +24,11 @@
24
     "_active": true,
24
     "_active": true,
25
     "_components": [
25
     "_components": [
26
       {
26
       {
27
-        "__id__": 25
27
+        "__id__": 28
28
       }
28
       }
29
     ],
29
     ],
30
     "_prefab": {
30
     "_prefab": {
31
-      "__id__": 26
31
+      "__id__": 29
32
     },
32
     },
33
     "_opacity": 255,
33
     "_opacity": 255,
34
     "_color": {
34
     "_color": {
@@ -89,7 +89,7 @@
89
         "__id__": 3
89
         "__id__": 3
90
       },
90
       },
91
       {
91
       {
92
-        "__id__": 9
92
+        "__id__": 6
93
       },
93
       },
94
       {
94
       {
95
         "__id__": 12
95
         "__id__": 12
@@ -99,19 +99,22 @@
99
       },
99
       },
100
       {
100
       {
101
         "__id__": 18
101
         "__id__": 18
102
+      },
103
+      {
104
+        "__id__": 21
102
       }
105
       }
103
     ],
106
     ],
104
     "_active": true,
107
     "_active": true,
105
     "_components": [
108
     "_components": [
106
       {
109
       {
107
-        "__id__": 21
110
+        "__id__": 24
108
       },
111
       },
109
       {
112
       {
110
-        "__id__": 22
113
+        "__id__": 25
111
       }
114
       }
112
     ],
115
     ],
113
     "_prefab": {
116
     "_prefab": {
114
-      "__id__": 24
117
+      "__id__": 27
115
     },
118
     },
116
     "_opacity": 255,
119
     "_opacity": 255,
117
     "_color": {
120
     "_color": {
@@ -162,6 +165,111 @@
162
   },
165
   },
163
   {
166
   {
164
     "__type__": "cc.Node",
167
     "__type__": "cc.Node",
168
+    "_name": "icon",
169
+    "_objFlags": 0,
170
+    "_parent": {
171
+      "__id__": 2
172
+    },
173
+    "_children": [],
174
+    "_active": true,
175
+    "_components": [
176
+      {
177
+        "__id__": 4
178
+      }
179
+    ],
180
+    "_prefab": {
181
+      "__id__": 5
182
+    },
183
+    "_opacity": 255,
184
+    "_color": {
185
+      "__type__": "cc.Color",
186
+      "r": 255,
187
+      "g": 255,
188
+      "b": 255,
189
+      "a": 255
190
+    },
191
+    "_contentSize": {
192
+      "__type__": "cc.Size",
193
+      "width": 395,
194
+      "height": 321
195
+    },
196
+    "_anchorPoint": {
197
+      "__type__": "cc.Vec2",
198
+      "x": 0.5,
199
+      "y": 0.5
200
+    },
201
+    "_trs": {
202
+      "__type__": "TypedArray",
203
+      "ctor": "Float64Array",
204
+      "array": [
205
+        0,
206
+        0,
207
+        0,
208
+        0,
209
+        0,
210
+        0,
211
+        1,
212
+        0.6,
213
+        0.6,
214
+        1
215
+      ]
216
+    },
217
+    "_eulerAngles": {
218
+      "__type__": "cc.Vec3",
219
+      "x": 0,
220
+      "y": 0,
221
+      "z": 0
222
+    },
223
+    "_skewX": 0,
224
+    "_skewY": 0,
225
+    "_is3DNode": false,
226
+    "_groupIndex": 0,
227
+    "groupIndex": 0,
228
+    "_id": ""
229
+  },
230
+  {
231
+    "__type__": "cc.Sprite",
232
+    "_name": "",
233
+    "_objFlags": 0,
234
+    "node": {
235
+      "__id__": 3
236
+    },
237
+    "_enabled": true,
238
+    "_materials": [
239
+      {
240
+        "__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
241
+      }
242
+    ],
243
+    "_srcBlendFactor": 770,
244
+    "_dstBlendFactor": 771,
245
+    "_spriteFrame": null,
246
+    "_type": 0,
247
+    "_sizeMode": 1,
248
+    "_fillType": 0,
249
+    "_fillCenter": {
250
+      "__type__": "cc.Vec2",
251
+      "x": 0,
252
+      "y": 0
253
+    },
254
+    "_fillStart": 0,
255
+    "_fillRange": 0,
256
+    "_isTrimmedMode": true,
257
+    "_atlas": null,
258
+    "_id": ""
259
+  },
260
+  {
261
+    "__type__": "cc.PrefabInfo",
262
+    "root": {
263
+      "__id__": 1
264
+    },
265
+    "asset": {
266
+      "__uuid__": "78f4e0fb-a10a-4b65-8574-2d5ca9a94ffb"
267
+    },
268
+    "fileId": "ffdewSIfdA26ORA777m1q6",
269
+    "sync": false
270
+  },
271
+  {
272
+    "__type__": "cc.Node",
165
     "_name": "surfaceBg",
273
     "_name": "surfaceBg",
166
     "_objFlags": 0,
274
     "_objFlags": 0,
167
     "_parent": {
275
     "_parent": {
@@ -169,17 +277,17 @@
169
     },
277
     },
170
     "_children": [
278
     "_children": [
171
       {
279
       {
172
-        "__id__": 4
280
+        "__id__": 7
173
       }
281
       }
174
     ],
282
     ],
175
     "_active": true,
283
     "_active": true,
176
     "_components": [
284
     "_components": [
177
       {
285
       {
178
-        "__id__": 7
286
+        "__id__": 10
179
       }
287
       }
180
     ],
288
     ],
181
     "_prefab": {
289
     "_prefab": {
182
-      "__id__": 8
290
+      "__id__": 11
183
     },
291
     },
184
     "_opacity": 255,
292
     "_opacity": 255,
185
     "_color": {
293
     "_color": {
@@ -233,17 +341,17 @@
233
     "_name": "surface",
341
     "_name": "surface",
234
     "_objFlags": 0,
342
     "_objFlags": 0,
235
     "_parent": {
343
     "_parent": {
236
-      "__id__": 3
344
+      "__id__": 6
237
     },
345
     },
238
     "_children": [],
346
     "_children": [],
239
     "_active": true,
347
     "_active": true,
240
     "_components": [
348
     "_components": [
241
       {
349
       {
242
-        "__id__": 5
350
+        "__id__": 8
243
       }
351
       }
244
     ],
352
     ],
245
     "_prefab": {
353
     "_prefab": {
246
-      "__id__": 6
354
+      "__id__": 9
247
     },
355
     },
248
     "_opacity": 255,
356
     "_opacity": 255,
249
     "_color": {
357
     "_color": {
@@ -297,7 +405,7 @@
297
     "_name": "",
405
     "_name": "",
298
     "_objFlags": 0,
406
     "_objFlags": 0,
299
     "node": {
407
     "node": {
300
-      "__id__": 4
408
+      "__id__": 7
301
     },
409
     },
302
     "_enabled": true,
410
     "_enabled": true,
303
     "_materials": [
411
     "_materials": [
@@ -342,7 +450,7 @@
342
     "_name": "",
450
     "_name": "",
343
     "_objFlags": 0,
451
     "_objFlags": 0,
344
     "node": {
452
     "node": {
345
-      "__id__": 3
453
+      "__id__": 6
346
     },
454
     },
347
     "_enabled": true,
455
     "_enabled": true,
348
     "_materials": [
456
     "_materials": [
@@ -391,11 +499,11 @@
391
     "_active": true,
499
     "_active": true,
392
     "_components": [
500
     "_components": [
393
       {
501
       {
394
-        "__id__": 10
502
+        "__id__": 13
395
       }
503
       }
396
     ],
504
     ],
397
     "_prefab": {
505
     "_prefab": {
398
-      "__id__": 11
506
+      "__id__": 14
399
     },
507
     },
400
     "_opacity": 255,
508
     "_opacity": 255,
401
     "_color": {
509
     "_color": {
@@ -449,7 +557,7 @@
449
     "_name": "",
557
     "_name": "",
450
     "_objFlags": 0,
558
     "_objFlags": 0,
451
     "node": {
559
     "node": {
452
-      "__id__": 9
560
+      "__id__": 12
453
     },
561
     },
454
     "_enabled": true,
562
     "_enabled": true,
455
     "_materials": [
563
     "_materials": [
@@ -498,11 +606,11 @@
498
     "_active": true,
606
     "_active": true,
499
     "_components": [
607
     "_components": [
500
       {
608
       {
501
-        "__id__": 13
609
+        "__id__": 16
502
       }
610
       }
503
     ],
611
     ],
504
     "_prefab": {
612
     "_prefab": {
505
-      "__id__": 14
613
+      "__id__": 17
506
     },
614
     },
507
     "_opacity": 255,
615
     "_opacity": 255,
508
     "_color": {
616
     "_color": {
@@ -556,7 +664,7 @@
556
     "_name": "",
664
     "_name": "",
557
     "_objFlags": 0,
665
     "_objFlags": 0,
558
     "node": {
666
     "node": {
559
-      "__id__": 12
667
+      "__id__": 15
560
     },
668
     },
561
     "_enabled": true,
669
     "_enabled": true,
562
     "_materials": [
670
     "_materials": [
@@ -607,11 +715,11 @@
607
     "_active": true,
715
     "_active": true,
608
     "_components": [
716
     "_components": [
609
       {
717
       {
610
-        "__id__": 16
718
+        "__id__": 19
611
       }
719
       }
612
     ],
720
     ],
613
     "_prefab": {
721
     "_prefab": {
614
-      "__id__": 17
722
+      "__id__": 20
615
     },
723
     },
616
     "_opacity": 255,
724
     "_opacity": 255,
617
     "_color": {
725
     "_color": {
@@ -665,7 +773,7 @@
665
     "_name": "",
773
     "_name": "",
666
     "_objFlags": 0,
774
     "_objFlags": 0,
667
     "node": {
775
     "node": {
668
-      "__id__": 15
776
+      "__id__": 18
669
     },
777
     },
670
     "_enabled": true,
778
     "_enabled": true,
671
     "_materials": [
779
     "_materials": [
@@ -716,11 +824,11 @@
716
     "_active": false,
824
     "_active": false,
717
     "_components": [
825
     "_components": [
718
       {
826
       {
719
-        "__id__": 19
827
+        "__id__": 22
720
       }
828
       }
721
     ],
829
     ],
722
     "_prefab": {
830
     "_prefab": {
723
-      "__id__": 20
831
+      "__id__": 23
724
     },
832
     },
725
     "_opacity": 255,
833
     "_opacity": 255,
726
     "_color": {
834
     "_color": {
@@ -774,7 +882,7 @@
774
     "_name": "",
882
     "_name": "",
775
     "_objFlags": 0,
883
     "_objFlags": 0,
776
     "node": {
884
     "node": {
777
-      "__id__": 18
885
+      "__id__": 21
778
     },
886
     },
779
     "_enabled": true,
887
     "_enabled": true,
780
     "_materials": [
888
     "_materials": [
@@ -858,7 +966,7 @@
858
     "zoomScale": 1.2,
966
     "zoomScale": 1.2,
859
     "clickEvents": [
967
     "clickEvents": [
860
       {
968
       {
861
-        "__id__": 23
969
+        "__id__": 26
862
       }
970
       }
863
     ],
971
     ],
864
     "_N$interactable": true,
972
     "_N$interactable": true,
@@ -948,22 +1056,25 @@
948
     },
1056
     },
949
     "_enabled": true,
1057
     "_enabled": true,
950
     "bg": {
1058
     "bg": {
951
-      "__id__": 21
1059
+      "__id__": 24
952
     },
1060
     },
953
     "surfaceBg": {
1061
     "surfaceBg": {
954
-      "__id__": 7
1062
+      "__id__": 10
955
     },
1063
     },
956
     "surface": {
1064
     "surface": {
957
-      "__id__": 5
1065
+      "__id__": 8
958
     },
1066
     },
959
     "itemName": {
1067
     "itemName": {
960
-      "__id__": 16
1068
+      "__id__": 19
961
     },
1069
     },
962
     "cost": {
1070
     "cost": {
963
-      "__id__": 13
1071
+      "__id__": 16
964
     },
1072
     },
965
     "selfButton": {
1073
     "selfButton": {
966
-      "__id__": 22
1074
+      "__id__": 25
1075
+    },
1076
+    "icon": {
1077
+      "__id__": 4
967
     },
1078
     },
968
     "_id": ""
1079
     "_id": ""
969
   },
1080
   },

+ 15 - 1
assets/resources/edt_prefab/Shop/ShopMain.prefab

@@ -34,10 +34,13 @@
34
       },
34
       },
35
       {
35
       {
36
         "__id__": 215
36
         "__id__": 215
37
+      },
38
+      {
39
+        "__id__": 216
37
       }
40
       }
38
     ],
41
     ],
39
     "_prefab": {
42
     "_prefab": {
40
-      "__id__": 216
43
+      "__id__": 217
41
     },
44
     },
42
     "_opacity": 255,
45
     "_opacity": 255,
43
     "_color": {
46
     "_color": {
@@ -8100,6 +8103,17 @@
8100
     "_id": ""
8103
     "_id": ""
8101
   },
8104
   },
8102
   {
8105
   {
8106
+    "__type__": "34c50r/l89GbL4vjuzGvS5f",
8107
+    "_name": "",
8108
+    "_objFlags": 0,
8109
+    "node": {
8110
+      "__id__": 1
8111
+    },
8112
+    "_enabled": true,
8113
+    "type": 0,
8114
+    "_id": ""
8115
+  },
8116
+  {
8103
     "__type__": "cc.PrefabInfo",
8117
     "__type__": "cc.PrefabInfo",
8104
     "root": {
8118
     "root": {
8105
       "__id__": 1
8119
       "__id__": 1

+ 10 - 1
assets/script/app/view/shop/ShopItem.js

@@ -11,7 +11,8 @@ cc.Class({
11
         surface: cc.Label,
11
         surface: cc.Label,
12
         itemName: cc.Label,
12
         itemName: cc.Label,
13
         cost: cc.Label,
13
         cost: cc.Label,
14
-        selfButton: cc.Button
14
+        selfButton: cc.Button,
15
+        icon: cc.Sprite
15
     },
16
     },
16
 
17
 
17
     reloadData (data) {
18
     reloadData (data) {
@@ -26,6 +27,14 @@ cc.Class({
26
     initUI () {
27
     initUI () {
27
         if (!this._data) return;
28
         if (!this._data) return;
28
 
29
 
30
+        let config = this._data.itemConfig;
31
+        let iconPath = cc.js.formatStr("res_image/itemicon/%d", config.id);
32
+        cc.loader.loadRes(iconPath, cc.SpriteFrame, (error, spriteFrame) => {
33
+		    if (!error && cc.isValid(this.node, true)) {
34
+                this.icon.spriteFrame = spriteFrame;
35
+            }
36
+		});
37
+
29
         let quality = this._data.quality;
38
         let quality = this._data.quality;
30
         let path = cc.js.formatStr("res_image/itemicon/box-djk0%d", quality);
39
         let path = cc.js.formatStr("res_image/itemicon/box-djk0%d", quality);
31
         cc.loader.loadRes(path, cc.SpriteFrame, (error, spriteFrame) => {
40
         cc.loader.loadRes(path, cc.SpriteFrame, (error, spriteFrame) => {