소스 검색

【修改】修改商城

DESKTOP-VHLO35R\Administrator 1 년 전
부모
커밋
9d18e79488
3개의 변경된 파일169개의 추가작업 그리고 35개의 파일을 삭제
  1. 144 33
      assets/resources/edt_prefab/Shop/ShopItem.prefab
  2. 15 1
      assets/resources/edt_prefab/Shop/ShopMain.prefab
  3. 10 1
      assets/script/app/view/shop/ShopItem.js

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

@@ -24,11 +24,11 @@
24 24
     "_active": true,
25 25
     "_components": [
26 26
       {
27
-        "__id__": 25
27
+        "__id__": 28
28 28
       }
29 29
     ],
30 30
     "_prefab": {
31
-      "__id__": 26
31
+      "__id__": 29
32 32
     },
33 33
     "_opacity": 255,
34 34
     "_color": {
@@ -89,7 +89,7 @@
89 89
         "__id__": 3
90 90
       },
91 91
       {
92
-        "__id__": 9
92
+        "__id__": 6
93 93
       },
94 94
       {
95 95
         "__id__": 12
@@ -99,19 +99,22 @@
99 99
       },
100 100
       {
101 101
         "__id__": 18
102
+      },
103
+      {
104
+        "__id__": 21
102 105
       }
103 106
     ],
104 107
     "_active": true,
105 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 116
     "_prefab": {
114
-      "__id__": 24
117
+      "__id__": 27
115 118
     },
116 119
     "_opacity": 255,
117 120
     "_color": {
@@ -162,6 +165,111 @@
162 165
   },
163 166
   {
164 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 273
     "_name": "surfaceBg",
166 274
     "_objFlags": 0,
167 275
     "_parent": {
@@ -169,17 +277,17 @@
169 277
     },
170 278
     "_children": [
171 279
       {
172
-        "__id__": 4
280
+        "__id__": 7
173 281
       }
174 282
     ],
175 283
     "_active": true,
176 284
     "_components": [
177 285
       {
178
-        "__id__": 7
286
+        "__id__": 10
179 287
       }
180 288
     ],
181 289
     "_prefab": {
182
-      "__id__": 8
290
+      "__id__": 11
183 291
     },
184 292
     "_opacity": 255,
185 293
     "_color": {
@@ -233,17 +341,17 @@
233 341
     "_name": "surface",
234 342
     "_objFlags": 0,
235 343
     "_parent": {
236
-      "__id__": 3
344
+      "__id__": 6
237 345
     },
238 346
     "_children": [],
239 347
     "_active": true,
240 348
     "_components": [
241 349
       {
242
-        "__id__": 5
350
+        "__id__": 8
243 351
       }
244 352
     ],
245 353
     "_prefab": {
246
-      "__id__": 6
354
+      "__id__": 9
247 355
     },
248 356
     "_opacity": 255,
249 357
     "_color": {
@@ -297,7 +405,7 @@
297 405
     "_name": "",
298 406
     "_objFlags": 0,
299 407
     "node": {
300
-      "__id__": 4
408
+      "__id__": 7
301 409
     },
302 410
     "_enabled": true,
303 411
     "_materials": [
@@ -342,7 +450,7 @@
342 450
     "_name": "",
343 451
     "_objFlags": 0,
344 452
     "node": {
345
-      "__id__": 3
453
+      "__id__": 6
346 454
     },
347 455
     "_enabled": true,
348 456
     "_materials": [
@@ -391,11 +499,11 @@
391 499
     "_active": true,
392 500
     "_components": [
393 501
       {
394
-        "__id__": 10
502
+        "__id__": 13
395 503
       }
396 504
     ],
397 505
     "_prefab": {
398
-      "__id__": 11
506
+      "__id__": 14
399 507
     },
400 508
     "_opacity": 255,
401 509
     "_color": {
@@ -449,7 +557,7 @@
449 557
     "_name": "",
450 558
     "_objFlags": 0,
451 559
     "node": {
452
-      "__id__": 9
560
+      "__id__": 12
453 561
     },
454 562
     "_enabled": true,
455 563
     "_materials": [
@@ -498,11 +606,11 @@
498 606
     "_active": true,
499 607
     "_components": [
500 608
       {
501
-        "__id__": 13
609
+        "__id__": 16
502 610
       }
503 611
     ],
504 612
     "_prefab": {
505
-      "__id__": 14
613
+      "__id__": 17
506 614
     },
507 615
     "_opacity": 255,
508 616
     "_color": {
@@ -556,7 +664,7 @@
556 664
     "_name": "",
557 665
     "_objFlags": 0,
558 666
     "node": {
559
-      "__id__": 12
667
+      "__id__": 15
560 668
     },
561 669
     "_enabled": true,
562 670
     "_materials": [
@@ -607,11 +715,11 @@
607 715
     "_active": true,
608 716
     "_components": [
609 717
       {
610
-        "__id__": 16
718
+        "__id__": 19
611 719
       }
612 720
     ],
613 721
     "_prefab": {
614
-      "__id__": 17
722
+      "__id__": 20
615 723
     },
616 724
     "_opacity": 255,
617 725
     "_color": {
@@ -665,7 +773,7 @@
665 773
     "_name": "",
666 774
     "_objFlags": 0,
667 775
     "node": {
668
-      "__id__": 15
776
+      "__id__": 18
669 777
     },
670 778
     "_enabled": true,
671 779
     "_materials": [
@@ -716,11 +824,11 @@
716 824
     "_active": false,
717 825
     "_components": [
718 826
       {
719
-        "__id__": 19
827
+        "__id__": 22
720 828
       }
721 829
     ],
722 830
     "_prefab": {
723
-      "__id__": 20
831
+      "__id__": 23
724 832
     },
725 833
     "_opacity": 255,
726 834
     "_color": {
@@ -774,7 +882,7 @@
774 882
     "_name": "",
775 883
     "_objFlags": 0,
776 884
     "node": {
777
-      "__id__": 18
885
+      "__id__": 21
778 886
     },
779 887
     "_enabled": true,
780 888
     "_materials": [
@@ -858,7 +966,7 @@
858 966
     "zoomScale": 1.2,
859 967
     "clickEvents": [
860 968
       {
861
-        "__id__": 23
969
+        "__id__": 26
862 970
       }
863 971
     ],
864 972
     "_N$interactable": true,
@@ -948,22 +1056,25 @@
948 1056
     },
949 1057
     "_enabled": true,
950 1058
     "bg": {
951
-      "__id__": 21
1059
+      "__id__": 24
952 1060
     },
953 1061
     "surfaceBg": {
954
-      "__id__": 7
1062
+      "__id__": 10
955 1063
     },
956 1064
     "surface": {
957
-      "__id__": 5
1065
+      "__id__": 8
958 1066
     },
959 1067
     "itemName": {
960
-      "__id__": 16
1068
+      "__id__": 19
961 1069
     },
962 1070
     "cost": {
963
-      "__id__": 13
1071
+      "__id__": 16
964 1072
     },
965 1073
     "selfButton": {
966
-      "__id__": 22
1074
+      "__id__": 25
1075
+    },
1076
+    "icon": {
1077
+      "__id__": 4
967 1078
     },
968 1079
     "_id": ""
969 1080
   },

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

@@ -34,10 +34,13 @@
34 34
       },
35 35
       {
36 36
         "__id__": 215
37
+      },
38
+      {
39
+        "__id__": 216
37 40
       }
38 41
     ],
39 42
     "_prefab": {
40
-      "__id__": 216
43
+      "__id__": 217
41 44
     },
42 45
     "_opacity": 255,
43 46
     "_color": {
@@ -8100,6 +8103,17 @@
8100 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 8117
     "__type__": "cc.PrefabInfo",
8104 8118
     "root": {
8105 8119
       "__id__": 1

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

@@ -11,7 +11,8 @@ cc.Class({
11 11
         surface: cc.Label,
12 12
         itemName: cc.Label,
13 13
         cost: cc.Label,
14
-        selfButton: cc.Button
14
+        selfButton: cc.Button,
15
+        icon: cc.Sprite
15 16
     },
16 17
 
17 18
     reloadData (data) {
@@ -26,6 +27,14 @@ cc.Class({
26 27
     initUI () {
27 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 38
         let quality = this._data.quality;
30 39
         let path = cc.js.formatStr("res_image/itemicon/box-djk0%d", quality);
31 40
         cc.loader.loadRes(path, cc.SpriteFrame, (error, spriteFrame) => {