Pārlūkot izejas kodu

【修改】修改商城

DESKTOP-VHLO35R\Administrator 1 gadu atpakaļ
vecāks
revīzija
557aba566e
34 mainītis faili ar 1886 papildinājumiem un 112 dzēšanām
  1. 133 14
      assets/resources/edt_prefab/Shop/ShopItem.prefab
  2. 1375 0
      assets/resources/edt_prefab/Shop/ShopItemAlert.prefab
  3. 8 0
      assets/resources/edt_prefab/Shop/ShopItemAlert.prefab.meta
  4. 29 20
      assets/resources/edt_prefab/Shop/ShopMain.prefab
  5. BIN
      assets/resources/res_image/itemicon/box-djk00.png
  6. BIN
      assets/resources/res_image/itemicon/box-djk01.png
  7. 3 3
      assets/resources/res_image/itemicon/box-djk01.png.meta
  8. BIN
      assets/resources/res_image/itemicon/box-djk02.png
  9. 9 9
      assets/resources/res_image/itemicon/box-djk02.png.meta
  10. BIN
      assets/resources/res_image/itemicon/box-djk03.png
  11. BIN
      assets/resources/res_image/itemicon/box-djk05.png
  12. BIN
      assets/resources/res_image/itemicon/box-djk06.png
  13. 4 4
      assets/resources/res_image/itemicon/box-djk00.png.meta
  14. BIN
      assets/resources/res_image/itemicon/box-djk07.png
  15. 36 0
      assets/resources/res_image/itemicon/box-djk07.png.meta
  16. BIN
      assets/resources/res_image/itemicon/other-tag01.png
  17. 3 3
      assets/resources/res_image/itemicon/other-tag01.png.meta
  18. BIN
      assets/resources/res_image/itemicon/other-tag02.png
  19. 3 3
      assets/resources/res_image/itemicon/other-tag02.png.meta
  20. BIN
      assets/resources/res_image/itemicon/other-tag04.png
  21. BIN
      assets/resources/res_image/itemicon/other-tag05.png
  22. 0 38
      assets/resources/res_json/GoodsConfig.json
  23. 18 0
      assets/resources/res_json/ResItemConfig.json
  24. 4 0
      assets/script/app/AppInit.js
  25. 4 1
      assets/script/app/config/ConfigBase.js
  26. 1 0
      assets/script/app/constants/AppConstants.js
  27. 56 0
      assets/script/app/view/shop/ShopItem.js
  28. 9 0
      assets/script/app/view/shop/ShopItem.js.meta
  29. 41 0
      assets/script/app/view/shop/ShopItemAlert.js
  30. 9 0
      assets/script/app/view/shop/ShopItemAlert.js.meta
  31. 59 17
      assets/script/app/view/shop/ShopMain.js
  32. 7 0
      assets/script/core/model/shop.meta
  33. 66 0
      assets/script/core/model/shop/ShopMgr.js
  34. 9 0
      assets/script/core/model/shop/ShopMgr.js.meta

+ 133 - 14
assets/resources/edt_prefab/Shop/ShopItem.prefab

@@ -22,9 +22,13 @@
22 22
       }
23 23
     ],
24 24
     "_active": true,
25
-    "_components": [],
25
+    "_components": [
26
+      {
27
+        "__id__": 25
28
+      }
29
+    ],
26 30
     "_prefab": {
27
-      "__id__": 23
31
+      "__id__": 26
28 32
     },
29 33
     "_opacity": 255,
30 34
     "_color": {
@@ -48,8 +52,8 @@
48 52
       "__type__": "TypedArray",
49 53
       "ctor": "Float64Array",
50 54
       "array": [
51
-        -201,
52
-        -2,
55
+        0,
56
+        0,
53 57
         0,
54 58
         0,
55 59
         0,
@@ -101,10 +105,13 @@
101 105
     "_components": [
102 106
       {
103 107
         "__id__": 21
108
+      },
109
+      {
110
+        "__id__": 22
104 111
       }
105 112
     ],
106 113
     "_prefab": {
107
-      "__id__": 22
114
+      "__id__": 24
108 115
     },
109 116
     "_opacity": 255,
110 117
     "_color": {
@@ -122,14 +129,14 @@
122 129
     "_anchorPoint": {
123 130
       "__type__": "cc.Vec2",
124 131
       "x": 0.5,
125
-      "y": 1
132
+      "y": 0.5
126 133
     },
127 134
     "_trs": {
128 135
       "__type__": "TypedArray",
129 136
       "ctor": "Float64Array",
130 137
       "array": [
131 138
         0,
132
-        175,
139
+        0,
133 140
         0,
134 141
         0,
135 142
         0,
@@ -184,7 +191,7 @@
184 191
     },
185 192
     "_contentSize": {
186 193
       "__type__": "cc.Size",
187
-      "width": 164,
194
+      "width": 167,
188 195
       "height": 68
189 196
     },
190 197
     "_anchorPoint": {
@@ -197,7 +204,7 @@
197 204
       "ctor": "Float64Array",
198 205
       "array": [
199 206
         -122.31,
200
-        -40.482,
207
+        121.246,
201 208
         0,
202 209
         0,
203 210
         0,
@@ -413,7 +420,7 @@
413 420
       "ctor": "Float64Array",
414 421
       "array": [
415 422
         -143.274,
416
-        -297.671,
423
+        -136.967,
417 424
         0,
418 425
         0,
419 426
         0,
@@ -520,7 +527,7 @@
520 527
       "ctor": "Float64Array",
521 528
       "array": [
522 529
         10.77,
523
-        -298.356,
530
+        -137.652,
524 531
         0,
525 532
         0,
526 533
         0,
@@ -629,7 +636,7 @@
629 636
       "ctor": "Float64Array",
630 637
       "array": [
631 638
         0,
632
-        -337.632,
639
+        -176.928,
633 640
         0,
634 641
         0,
635 642
         0,
@@ -738,7 +745,7 @@
738 745
       "ctor": "Float64Array",
739 746
       "array": [
740 747
         135.995,
741
-        -40.114,
748
+        120.59,
742 749
         0,
743 750
         0,
744 751
         0,
@@ -821,7 +828,7 @@
821 828
     "_srcBlendFactor": 770,
822 829
     "_dstBlendFactor": 771,
823 830
     "_spriteFrame": {
824
-      "__uuid__": "0fd37f0e-be15-49c0-99e5-245518a30bf4"
831
+      "__uuid__": "d9e93c14-b1c5-4357-9c31-a8c57de9fd8a"
825 832
     },
826 833
     "_type": 0,
827 834
     "_sizeMode": 1,
@@ -838,6 +845,90 @@
838 845
     "_id": ""
839 846
   },
840 847
   {
848
+    "__type__": "cc.Button",
849
+    "_name": "",
850
+    "_objFlags": 0,
851
+    "node": {
852
+      "__id__": 2
853
+    },
854
+    "_enabled": true,
855
+    "_normalMaterial": null,
856
+    "_grayMaterial": null,
857
+    "duration": 0.1,
858
+    "zoomScale": 1.2,
859
+    "clickEvents": [
860
+      {
861
+        "__id__": 23
862
+      }
863
+    ],
864
+    "_N$interactable": true,
865
+    "_N$enableAutoGrayEffect": false,
866
+    "_N$transition": 0,
867
+    "transition": 0,
868
+    "_N$normalColor": {
869
+      "__type__": "cc.Color",
870
+      "r": 255,
871
+      "g": 255,
872
+      "b": 255,
873
+      "a": 255
874
+    },
875
+    "_N$pressedColor": {
876
+      "__type__": "cc.Color",
877
+      "r": 211,
878
+      "g": 211,
879
+      "b": 211,
880
+      "a": 255
881
+    },
882
+    "pressedColor": {
883
+      "__type__": "cc.Color",
884
+      "r": 211,
885
+      "g": 211,
886
+      "b": 211,
887
+      "a": 255
888
+    },
889
+    "_N$hoverColor": {
890
+      "__type__": "cc.Color",
891
+      "r": 255,
892
+      "g": 255,
893
+      "b": 255,
894
+      "a": 255
895
+    },
896
+    "hoverColor": {
897
+      "__type__": "cc.Color",
898
+      "r": 255,
899
+      "g": 255,
900
+      "b": 255,
901
+      "a": 255
902
+    },
903
+    "_N$disabledColor": {
904
+      "__type__": "cc.Color",
905
+      "r": 124,
906
+      "g": 124,
907
+      "b": 124,
908
+      "a": 255
909
+    },
910
+    "_N$normalSprite": null,
911
+    "_N$pressedSprite": null,
912
+    "pressedSprite": null,
913
+    "_N$hoverSprite": null,
914
+    "hoverSprite": null,
915
+    "_N$disabledSprite": null,
916
+    "_N$target": {
917
+      "__id__": 2
918
+    },
919
+    "_id": ""
920
+  },
921
+  {
922
+    "__type__": "cc.ClickEvent",
923
+    "target": {
924
+      "__id__": 1
925
+    },
926
+    "component": "",
927
+    "_componentId": "69095pa90NEa5NTEfWSjLCs",
928
+    "handler": "onClicked",
929
+    "customEventData": ""
930
+  },
931
+  {
841 932
     "__type__": "cc.PrefabInfo",
842 933
     "root": {
843 934
       "__id__": 1
@@ -849,6 +940,34 @@
849 940
     "sync": false
850 941
   },
851 942
   {
943
+    "__type__": "69095pa90NEa5NTEfWSjLCs",
944
+    "_name": "",
945
+    "_objFlags": 0,
946
+    "node": {
947
+      "__id__": 1
948
+    },
949
+    "_enabled": true,
950
+    "bg": {
951
+      "__id__": 21
952
+    },
953
+    "surfaceBg": {
954
+      "__id__": 7
955
+    },
956
+    "surface": {
957
+      "__id__": 5
958
+    },
959
+    "itemName": {
960
+      "__id__": 16
961
+    },
962
+    "cost": {
963
+      "__id__": 13
964
+    },
965
+    "selfButton": {
966
+      "__id__": 22
967
+    },
968
+    "_id": ""
969
+  },
970
+  {
852 971
     "__type__": "cc.PrefabInfo",
853 972
     "root": {
854 973
       "__id__": 1

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 1375 - 0
assets/resources/edt_prefab/Shop/ShopItemAlert.prefab


+ 8 - 0
assets/resources/edt_prefab/Shop/ShopItemAlert.prefab.meta

@@ -0,0 +1,8 @@
1
+{
2
+  "ver": "1.2.6",
3
+  "uuid": "7e848fb7-5342-48d4-a20d-04d998bfff5e",
4
+  "optimizationPolicy": "AUTO",
5
+  "asyncLoadAssets": false,
6
+  "readonly": false,
7
+  "subMetas": {}
8
+}

+ 29 - 20
assets/resources/edt_prefab/Shop/ShopMain.prefab

@@ -269,7 +269,7 @@
269 269
     "_contentSize": {
270 270
       "__type__": "cc.Size",
271 271
       "width": 810,
272
-      "height": 961
272
+      "height": 861
273 273
     },
274 274
     "_anchorPoint": {
275 275
       "__type__": "cc.Vec2",
@@ -358,7 +358,7 @@
358 358
       "ctor": "Float64Array",
359 359
       "array": [
360 360
         0,
361
-        -242.5,
361
+        -142.5,
362 362
         0,
363 363
         0,
364 364
         0,
@@ -1527,7 +1527,7 @@
1527 1527
     "_alignFlags": 41,
1528 1528
     "_left": 0,
1529 1529
     "_right": 0,
1530
-    "_top": 100,
1530
+    "_top": 0,
1531 1531
     "_bottom": 0,
1532 1532
     "_verticalCenter": 0,
1533 1533
     "_horizontalCenter": 0,
@@ -1599,7 +1599,7 @@
1599 1599
       "ctor": "Float64Array",
1600 1600
       "array": [
1601 1601
         0,
1602
-        -479.5,
1602
+        -379.5,
1603 1603
         0,
1604 1604
         0,
1605 1605
         0,
@@ -2265,7 +2265,7 @@
2265 2265
       "__id__": 50
2266 2266
     },
2267 2267
     "_children": [],
2268
-    "_active": false,
2268
+    "_active": true,
2269 2269
     "_components": [
2270 2270
       {
2271 2271
         "__id__": 55
@@ -2452,7 +2452,7 @@
2452 2452
       "__id__": 45
2453 2453
     },
2454 2454
     "_enabled": true,
2455
-    "allowSwitchOff": true,
2455
+    "allowSwitchOff": false,
2456 2456
     "_id": ""
2457 2457
   },
2458 2458
   {
@@ -2849,7 +2849,7 @@
2849 2849
     "component": "",
2850 2850
     "_componentId": "ae0e6EA5rhN/IfKEQFEHpxI",
2851 2851
     "handler": "typeChooseToggleOnClicked",
2852
-    "customEventData": "1"
2852
+    "customEventData": "100"
2853 2853
   },
2854 2854
   {
2855 2855
     "__type__": "cc.PrefabInfo",
@@ -3235,7 +3235,7 @@
3235 3235
     "component": "",
3236 3236
     "_componentId": "ae0e6EA5rhN/IfKEQFEHpxI",
3237 3237
     "handler": "typeChooseToggleOnClicked",
3238
-    "customEventData": "2"
3238
+    "customEventData": "200"
3239 3239
   },
3240 3240
   {
3241 3241
     "__type__": "cc.PrefabInfo",
@@ -3621,7 +3621,7 @@
3621 3621
     "component": "",
3622 3622
     "_componentId": "ae0e6EA5rhN/IfKEQFEHpxI",
3623 3623
     "handler": "typeChooseToggleOnClicked",
3624
-    "customEventData": "3"
3624
+    "customEventData": "300"
3625 3625
   },
3626 3626
   {
3627 3627
     "__type__": "cc.PrefabInfo",
@@ -4007,7 +4007,7 @@
4007 4007
     "component": "",
4008 4008
     "_componentId": "ae0e6EA5rhN/IfKEQFEHpxI",
4009 4009
     "handler": "typeChooseToggleOnClicked",
4010
-    "customEventData": "4"
4010
+    "customEventData": "400"
4011 4011
   },
4012 4012
   {
4013 4013
     "__type__": "cc.PrefabInfo",
@@ -4393,7 +4393,7 @@
4393 4393
     "component": "",
4394 4394
     "_componentId": "ae0e6EA5rhN/IfKEQFEHpxI",
4395 4395
     "handler": "typeChooseToggleOnClicked",
4396
-    "customEventData": "5"
4396
+    "customEventData": "600"
4397 4397
   },
4398 4398
   {
4399 4399
     "__type__": "cc.PrefabInfo",
@@ -4779,7 +4779,7 @@
4779 4779
     "component": "",
4780 4780
     "_componentId": "ae0e6EA5rhN/IfKEQFEHpxI",
4781 4781
     "handler": "typeChooseToggleOnClicked",
4782
-    "customEventData": "6"
4782
+    "customEventData": "700"
4783 4783
   },
4784 4784
   {
4785 4785
     "__type__": "cc.PrefabInfo",
@@ -5165,7 +5165,7 @@
5165 5165
     "component": "",
5166 5166
     "_componentId": "ae0e6EA5rhN/IfKEQFEHpxI",
5167 5167
     "handler": "typeChooseToggleOnClicked",
5168
-    "customEventData": "7"
5168
+    "customEventData": "500"
5169 5169
   },
5170 5170
   {
5171 5171
     "__type__": "cc.PrefabInfo",
@@ -5551,7 +5551,7 @@
5551 5551
     "component": "",
5552 5552
     "_componentId": "ae0e6EA5rhN/IfKEQFEHpxI",
5553 5553
     "handler": "typeChooseToggleOnClicked",
5554
-    "customEventData": "8"
5554
+    "customEventData": "99999"
5555 5555
   },
5556 5556
   {
5557 5557
     "__type__": "cc.PrefabInfo",
@@ -5738,7 +5738,7 @@
5738 5738
       "ctor": "Float64Array",
5739 5739
       "array": [
5740 5740
         0,
5741
-        -644,
5741
+        -544,
5742 5742
         0,
5743 5743
         0,
5744 5744
         0,
@@ -7647,7 +7647,7 @@
7647 7647
       "ctor": "Float64Array",
7648 7648
       "array": [
7649 7649
         0,
7650
-        -749,
7650
+        -649,
7651 7651
         0,
7652 7652
         0,
7653 7653
         0,
@@ -7684,7 +7684,7 @@
7684 7684
   },
7685 7685
   {
7686 7686
     "__type__": "cc.Node",
7687
-    "_name": "goodsView",
7687
+    "_name": "shopView",
7688 7688
     "_objFlags": 0,
7689 7689
     "_parent": {
7690 7690
       "__id__": 4
@@ -7722,7 +7722,7 @@
7722 7722
       "ctor": "Float64Array",
7723 7723
       "array": [
7724 7724
         0,
7725
-        -872.5,
7725
+        -772.5,
7726 7726
         0,
7727 7727
         0,
7728 7728
         0,
@@ -7801,7 +7801,7 @@
7801 7801
     "_layoutSize": {
7802 7802
       "__type__": "cc.Size",
7803 7803
       "width": 810,
7804
-      "height": 961
7804
+      "height": 861
7805 7805
     },
7806 7806
     "_resize": 1,
7807 7807
     "_N$layoutType": 2,
@@ -7814,7 +7814,7 @@
7814 7814
     "_N$startAxis": 0,
7815 7815
     "_N$paddingLeft": 0,
7816 7816
     "_N$paddingRight": 0,
7817
-    "_N$paddingTop": 100,
7817
+    "_N$paddingTop": 0,
7818 7818
     "_N$paddingBottom": 0,
7819 7819
     "_N$spacingX": 0,
7820 7820
     "_N$spacingY": 0,
@@ -8088,6 +8088,15 @@
8088 8088
     "goldNumText": {
8089 8089
       "__id__": 29
8090 8090
     },
8091
+    "shopView": {
8092
+      "__id__": 200
8093
+    },
8094
+    "itemPrefab": {
8095
+      "__uuid__": "78f4e0fb-a10a-4b65-8574-2d5ca9a94ffb"
8096
+    },
8097
+    "hotToggle": {
8098
+      "__id__": 57
8099
+    },
8091 8100
     "_id": ""
8092 8101
   },
8093 8102
   {

BIN
assets/resources/res_image/itemicon/box-djk00.png


BIN
assets/resources/res_image/itemicon/box-djk01.png


+ 3 - 3
assets/resources/res_image/itemicon/box-djk01.png.meta

@@ -1,6 +1,6 @@
1 1
 {
2 2
   "ver": "2.3.4",
3
-  "uuid": "ad5bd4cb-0ba3-4229-880d-63cdd385b942",
3
+  "uuid": "9721ea21-46d3-4f35-be97-87562717ce18",
4 4
   "type": "sprite",
5 5
   "wrapMode": "clamp",
6 6
   "filterMode": "bilinear",
@@ -13,8 +13,8 @@
13 13
   "subMetas": {
14 14
     "box-djk01": {
15 15
       "ver": "1.0.4",
16
-      "uuid": "472c1131-112b-4bb9-934e-80404cbd0a89",
17
-      "rawTextureUuid": "ad5bd4cb-0ba3-4229-880d-63cdd385b942",
16
+      "uuid": "d9e93c14-b1c5-4357-9c31-a8c57de9fd8a",
17
+      "rawTextureUuid": "9721ea21-46d3-4f35-be97-87562717ce18",
18 18
       "trimType": "auto",
19 19
       "trimThreshold": 1,
20 20
       "rotated": false,

BIN
assets/resources/res_image/itemicon/box-djk02.png


+ 9 - 9
assets/resources/res_image/itemicon/box-djk02.png.meta

@@ -1,31 +1,31 @@
1 1
 {
2 2
   "ver": "2.3.4",
3
-  "uuid": "b338c127-caad-45b6-8c77-41e7faafdb6e",
3
+  "uuid": "12c5973d-c5d2-463d-8bab-f934a56e43ce",
4 4
   "type": "sprite",
5 5
   "wrapMode": "clamp",
6 6
   "filterMode": "bilinear",
7 7
   "premultiplyAlpha": false,
8 8
   "genMipmaps": false,
9 9
   "packable": true,
10
-  "width": 402,
11
-  "height": 322,
10
+  "width": 400,
11
+  "height": 320,
12 12
   "platformSettings": {},
13 13
   "subMetas": {
14 14
     "box-djk02": {
15 15
       "ver": "1.0.4",
16
-      "uuid": "cb82e61f-0ae7-49ed-982c-cd2a0a2d8424",
17
-      "rawTextureUuid": "b338c127-caad-45b6-8c77-41e7faafdb6e",
16
+      "uuid": "9175e5d9-4107-4c9b-b7b4-47011325bd72",
17
+      "rawTextureUuid": "12c5973d-c5d2-463d-8bab-f934a56e43ce",
18 18
       "trimType": "auto",
19 19
       "trimThreshold": 1,
20 20
       "rotated": false,
21 21
       "offsetX": 0,
22 22
       "offsetY": 0.5,
23
-      "trimX": 1,
24
-      "trimY": 1,
23
+      "trimX": 0,
24
+      "trimY": 0,
25 25
       "width": 400,
26 26
       "height": 319,
27
-      "rawWidth": 402,
28
-      "rawHeight": 322,
27
+      "rawWidth": 400,
28
+      "rawHeight": 320,
29 29
       "borderTop": 0,
30 30
       "borderBottom": 0,
31 31
       "borderLeft": 0,

BIN
assets/resources/res_image/itemicon/box-djk03.png


BIN
assets/resources/res_image/itemicon/box-djk05.png


BIN
assets/resources/res_image/itemicon/box-djk06.png


+ 4 - 4
assets/resources/res_image/itemicon/box-djk00.png.meta

@@ -1,6 +1,6 @@
1 1
 {
2 2
   "ver": "2.3.4",
3
-  "uuid": "38452b54-ff35-4199-a177-eb4297a20c7d",
3
+  "uuid": "87a7d873-e978-4127-9d45-ee5d32b00434",
4 4
   "type": "sprite",
5 5
   "wrapMode": "clamp",
6 6
   "filterMode": "bilinear",
@@ -11,10 +11,10 @@
11 11
   "height": 322,
12 12
   "platformSettings": {},
13 13
   "subMetas": {
14
-    "box-djk00": {
14
+    "box-djk06": {
15 15
       "ver": "1.0.4",
16
-      "uuid": "0fd37f0e-be15-49c0-99e5-245518a30bf4",
17
-      "rawTextureUuid": "38452b54-ff35-4199-a177-eb4297a20c7d",
16
+      "uuid": "97a15320-24cb-4716-842a-4727cb1aac2c",
17
+      "rawTextureUuid": "87a7d873-e978-4127-9d45-ee5d32b00434",
18 18
       "trimType": "auto",
19 19
       "trimThreshold": 1,
20 20
       "rotated": false,

BIN
assets/resources/res_image/itemicon/box-djk07.png


+ 36 - 0
assets/resources/res_image/itemicon/box-djk07.png.meta

@@ -0,0 +1,36 @@
1
+{
2
+  "ver": "2.3.4",
3
+  "uuid": "ace9f8ca-42b9-4079-a05d-b89d7ee69e79",
4
+  "type": "sprite",
5
+  "wrapMode": "clamp",
6
+  "filterMode": "bilinear",
7
+  "premultiplyAlpha": false,
8
+  "genMipmaps": false,
9
+  "packable": true,
10
+  "width": 402,
11
+  "height": 322,
12
+  "platformSettings": {},
13
+  "subMetas": {
14
+    "box-djk07": {
15
+      "ver": "1.0.4",
16
+      "uuid": "f1eb829d-5e44-407e-9400-1fd55baa5e91",
17
+      "rawTextureUuid": "ace9f8ca-42b9-4079-a05d-b89d7ee69e79",
18
+      "trimType": "auto",
19
+      "trimThreshold": 1,
20
+      "rotated": false,
21
+      "offsetX": 0,
22
+      "offsetY": 0.5,
23
+      "trimX": 1,
24
+      "trimY": 1,
25
+      "width": 400,
26
+      "height": 319,
27
+      "rawWidth": 402,
28
+      "rawHeight": 322,
29
+      "borderTop": 0,
30
+      "borderBottom": 0,
31
+      "borderLeft": 0,
32
+      "borderRight": 0,
33
+      "subMetas": {}
34
+    }
35
+  }
36
+}

BIN
assets/resources/res_image/itemicon/other-tag01.png


+ 3 - 3
assets/resources/res_image/itemicon/other-tag01.png.meta

@@ -1,6 +1,6 @@
1 1
 {
2 2
   "ver": "2.3.4",
3
-  "uuid": "29f89797-e186-46fe-8fe0-4145e68f6763",
3
+  "uuid": "6bf00208-f71b-4ff7-965b-5ae112c60358",
4 4
   "type": "sprite",
5 5
   "wrapMode": "clamp",
6 6
   "filterMode": "bilinear",
@@ -13,8 +13,8 @@
13 13
   "subMetas": {
14 14
     "other-tag01": {
15 15
       "ver": "1.0.4",
16
-      "uuid": "871f5d91-9530-4a1d-99aa-5b2b03dbf0d6",
17
-      "rawTextureUuid": "29f89797-e186-46fe-8fe0-4145e68f6763",
16
+      "uuid": "89c5efb0-9fc4-4397-a520-17a1e87d6f5a",
17
+      "rawTextureUuid": "6bf00208-f71b-4ff7-965b-5ae112c60358",
18 18
       "trimType": "auto",
19 19
       "trimThreshold": 1,
20 20
       "rotated": false,

BIN
assets/resources/res_image/itemicon/other-tag02.png


+ 3 - 3
assets/resources/res_image/itemicon/other-tag02.png.meta

@@ -1,6 +1,6 @@
1 1
 {
2 2
   "ver": "2.3.4",
3
-  "uuid": "6bf00208-f71b-4ff7-965b-5ae112c60358",
3
+  "uuid": "3ace7804-dfd9-4f8c-bb7e-8154beaaa0af",
4 4
   "type": "sprite",
5 5
   "wrapMode": "clamp",
6 6
   "filterMode": "bilinear",
@@ -13,8 +13,8 @@
13 13
   "subMetas": {
14 14
     "other-tag02": {
15 15
       "ver": "1.0.4",
16
-      "uuid": "89c5efb0-9fc4-4397-a520-17a1e87d6f5a",
17
-      "rawTextureUuid": "6bf00208-f71b-4ff7-965b-5ae112c60358",
16
+      "uuid": "224fed28-9a74-40f4-84f9-5446fa5e90b7",
17
+      "rawTextureUuid": "3ace7804-dfd9-4f8c-bb7e-8154beaaa0af",
18 18
       "trimType": "auto",
19 19
       "trimThreshold": 1,
20 20
       "rotated": false,

BIN
assets/resources/res_image/itemicon/other-tag04.png


BIN
assets/resources/res_image/itemicon/other-tag05.png


+ 0 - 38
assets/resources/res_json/GoodsConfig.json

@@ -172,43 +172,5 @@
172 172
     ],
173 173
     "rmb": 64800,
174 174
     "jfid": 10206
175
-  },
176
-  {
177
-    "id": 10301,
178
-    "name": "蝴蝶刀",
179
-    "aliasName": "蝴蝶刀",
180
-    "inShop": 1,
181
-    "items": [
182
-      {
183
-        "id": 10001,
184
-        "count": 1
185
-      }
186
-    ],
187
-    "price": [
188
-      {
189
-        "id": 102,
190
-        "count": 100
191
-      }
192
-    ],
193
-    "rmb": 100
194
-  },
195
-  {
196
-    "id": 10401,
197
-    "name": "M4A4",
198
-    "aliasName": "M4A4",
199
-    "inShop": 1,
200
-    "items": [
201
-      {
202
-        "id": 20001,
203
-        "count": 1
204
-      }
205
-    ],
206
-    "price": [
207
-      {
208
-        "id": 102,
209
-        "count": 100
210
-      }
211
-    ],
212
-    "rmb": 100
213 175
   }
214 176
 ]

+ 18 - 0
assets/resources/res_json/ResItemConfig.json

@@ -36,6 +36,8 @@
36 36
     "modelType": 1,
37 37
     "surface": 1,
38 38
     "model": 112,
39
+    "inShop": 1,
40
+    "hot": 1,
39 41
     "enableComposite": false,
40 42
     "price": 135000,
41 43
     "priceConst": 85
@@ -48,6 +50,8 @@
48 50
     "modelType": 1,
49 51
     "surface": 2,
50 52
     "model": 112,
53
+    "inShop": 1,
54
+    "hot": 1,
51 55
     "enableComposite": false,
52 56
     "price": 145000,
53 57
     "priceConst": 85
@@ -60,6 +64,8 @@
60 64
     "modelType": 1,
61 65
     "surface": 3,
62 66
     "model": 112,
67
+    "inShop": 1,
68
+    "hot": 1,
63 69
     "enableComposite": false,
64 70
     "price": 155000,
65 71
     "priceConst": 85
@@ -72,6 +78,8 @@
72 78
     "modelType": 1,
73 79
     "surface": 4,
74 80
     "model": 112,
81
+    "inShop": 1,
82
+    "hot": 1,
75 83
     "enableComposite": false,
76 84
     "price": 165000,
77 85
     "priceConst": 85
@@ -84,6 +92,8 @@
84 92
     "modelType": 1,
85 93
     "surface": 5,
86 94
     "model": 112,
95
+    "inShop": 1,
96
+    "hot": 1,
87 97
     "enableComposite": false,
88 98
     "price": 175000,
89 99
     "priceConst": 85
@@ -96,6 +106,8 @@
96 106
     "modelType": 1,
97 107
     "surface": 6,
98 108
     "model": 112,
109
+    "inShop": 1,
110
+    "hot": 1,
99 111
     "enableComposite": false,
100 112
     "price": 185000,
101 113
     "priceConst": 85
@@ -108,6 +120,8 @@
108 120
     "modelType": 1,
109 121
     "surface": 1,
110 122
     "model": 118,
123
+    "inShop": 1,
124
+    "hot": 1,
111 125
     "enableComposite": false,
112 126
     "price": 185000,
113 127
     "priceConst": 85
@@ -120,6 +134,8 @@
120 134
     "modelType": 3,
121 135
     "surface": 3,
122 136
     "model": 406,
137
+    "inShop": 1,
138
+    "hot": 1,
123 139
     "enableComposite": false,
124 140
     "price": 205000,
125 141
     "priceConst": 85
@@ -132,6 +148,8 @@
132 148
     "modelType": 2,
133 149
     "surface": 2,
134 150
     "model": 702,
151
+    "inShop": 1,
152
+    "hot": 1,
135 153
     "enableComposite": false,
136 154
     "price": 195000,
137 155
     "priceConst": 85

+ 4 - 0
assets/script/app/AppInit.js

@@ -54,5 +54,9 @@ module.exports = {
54 54
         // 支付数据管理器
55 55
         ns.PayMgr = require('PayMgr'); 
56 56
         ns.PayMgr.init();
57
+
58
+        // 商城数据管理器
59
+        ns.ShopMgr = require('ShopMgr'); 
60
+        ns.ShopMgr.init();
57 61
     }
58 62
 };

+ 4 - 1
assets/script/app/config/ConfigBase.js

@@ -47,7 +47,10 @@ cc.Class({
47 47
         }
48 48
 
49 49
         // 缓存数据
50
-        this.indexsCache[data[this.mainKey]] = data;
50
+        if (data) {
51
+            this.indexsCache[data[this.mainKey]] = data;
52
+        }
53
+        
51 54
         return data;
52 55
     },
53 56
 

+ 1 - 0
assets/script/app/constants/AppConstants.js

@@ -20,6 +20,7 @@ window.JMC.Proxy = cc.Enum({
20 20
 window.JMC.ALERT_ID = cc.Enum({
21 21
     DEFAULT: 0,                             // 默认
22 22
     DEBUG: 999,                             // 测试
23
+    SHOP_ITEM_ALERT: 1,                     // 商品兑换弹窗
23 24
 });
24 25
 
25 26
 // 物品类型枚举声明

+ 56 - 0
assets/script/app/view/shop/ShopItem.js

@@ -0,0 +1,56 @@
1
+cc.Class({
2
+    extends: cc.Component,
3
+
4
+    editor: {
5
+        menu: 'Shop/ShopItem'
6
+    },
7
+
8
+    properties: {
9
+        bg: cc.Sprite,
10
+        surfaceBg: cc.Sprite,
11
+        surface: cc.Label,
12
+        itemName: cc.Label,
13
+        cost: cc.Label,
14
+        selfButton: cc.Button
15
+    },
16
+
17
+    reloadData (data) {
18
+        this._data = data;
19
+        this.initUI();
20
+    },
21
+
22
+    enabelClick (enable) {
23
+        this.selfButton.interactable = enable;
24
+    },
25
+
26
+    initUI () {
27
+        if (!this._data) return;
28
+
29
+        let quality = this._data.quality;
30
+        let path = cc.js.formatStr("res_image/itemicon/box-djk0%d", quality);
31
+        cc.loader.loadRes(path, cc.SpriteFrame, (error, spriteFrame) => {
32
+		    if (!error && cc.isValid(this.node, true)) {
33
+                this.bg.spriteFrame = spriteFrame;
34
+            }
35
+		});
36
+
37
+        let surface = this._data.surface;
38
+        let surfacepath =  cc.js.formatStr("res_image/itemicon/other-tag0%d", surface);
39
+        cc.loader.loadRes(surfacepath, cc.SpriteFrame, (error, spriteFrame) => {
40
+            if (!error && cc.isValid(this.node, true)) {
41
+                this.surfaceBg.spriteFrame = spriteFrame;
42
+            }
43
+        });
44
+
45
+        this.surface.string = this._data.surfaceStr;
46
+        this.cost.string = this._data.cost;
47
+        this.itemName.string = this._data.name;
48
+    },
49
+
50
+    onClicked () {
51
+        if (!this._data || !this._data.cb) return;
52
+
53
+        this._data.cb(this._data);
54
+    }
55
+
56
+});

+ 9 - 0
assets/script/app/view/shop/ShopItem.js.meta

@@ -0,0 +1,9 @@
1
+{
2
+  "ver": "1.0.8",
3
+  "uuid": "69095a5a-f743-446b-9353-11f5928cb0ac",
4
+  "isPlugin": false,
5
+  "loadPluginInWeb": true,
6
+  "loadPluginInNative": true,
7
+  "loadPluginInEditor": false,
8
+  "subMetas": {}
9
+}

+ 41 - 0
assets/script/app/view/shop/ShopItemAlert.js

@@ -0,0 +1,41 @@
1
+const JMAlertBase = require('JMAlertBase');
2
+
3
+cc.Class({
4
+    extends: JMAlertBase,
5
+
6
+    editor: {
7
+        menu: 'Shop/ShopItemAlert'
8
+    },
9
+
10
+    properties: {
11
+        shopItemPrefab: cc.Prefab,
12
+        shopItemNode: cc.Node
13
+    },
14
+
15
+    reloadData(data) {
16
+        this._data = data;
17
+        this.initUI();
18
+    },
19
+
20
+    initUI () {
21
+        if (!this._data) return;
22
+
23
+        let itemNode = cc.instantiate(this.shopItemPrefab);
24
+        let shopItemCtr = itemNode.getComponent('ShopItem');
25
+        shopItemCtr.reloadData(this._data);
26
+        shopItemCtr.enabelClick(false);
27
+        this.shopItemNode.addChild(itemNode);
28
+    },
29
+
30
+    certainOnClicked () {
31
+        let goldNum = G.BagMgr.getItemNumById(JMC.ITEM_ID.GOLD);
32
+        if (goldNum < this._data.cost) {
33
+            G.AppUtils.getSceneCtrl().addToast('金币不足,分解饰品可获得');
34
+        }
35
+        else {
36
+            G.ShopMgr.requestShopBuyItem(this._data.config.id, 1);
37
+            this.close();
38
+        }
39
+    }
40
+
41
+});

+ 9 - 0
assets/script/app/view/shop/ShopItemAlert.js.meta

@@ -0,0 +1,9 @@
1
+{
2
+  "ver": "1.0.8",
3
+  "uuid": "2e017624-cfc6-4a57-967e-8b8485c8d081",
4
+  "isPlugin": false,
5
+  "loadPluginInWeb": true,
6
+  "loadPluginInNative": true,
7
+  "loadPluginInEditor": false,
8
+  "subMetas": {}
9
+}

+ 59 - 17
assets/script/app/view/shop/ShopMain.js

@@ -19,6 +19,9 @@ cc.Class({
19 19
 
20 20
     properties: {
21 21
         goldNumText: cc.Label,
22
+        shopView: cc.Node,
23
+        itemPrefab: cc.Prefab,
24
+        hotToggle: cc.Toggle,
22 25
     },
23 26
 
24 27
     onLoad() {
@@ -28,30 +31,40 @@ cc.Class({
28 31
 
29 32
     initData() {
30 33
         this.goods = {};
31
-        let goodConfig = G.CfgMgr.goodsConfig.table;
32
-        for (let config of goodConfig) {
34
+        let itemConfig = G.CfgMgr.resItemConfig.table;
35
+        for (let config of itemConfig) {
33 36
             if (!config.inShop) {
34 37
                 continue;
35 38
             }
36 39
 
37
-            if (!config.items || config.items.length == 0) {
38
-                continue;
39
-            }
40
+            let itemname = config.name;
41
+            let cost = config.price ? config.price : 0;
40 42
 
41
-            let item = config.items[0];
42
-            let itemConfig = G.CfgMgr.resItemConfig.getByMainKey(item.id);
43
-
44
-            if (!itemConfig) {
45
-                continue;
43
+            let surface = config.surface;
44
+            let surfaceConfig = G.CfgMgr.resItemSurfaceConfig.getByMainKey(surface);
45
+            let surfaceStr = "";
46
+            if (surfaceConfig) {
47
+                surfaceStr = surfaceConfig.name;
46 48
             }
47 49
 
48
-            let name = itemConfig.name;
49
-            let cost = 0;
50
-            // if (config.price)
50
+            surface = surfaceStr == "" ? 0 : surface;
51
+            let quality = config.quality;
52
+            let model = config.model;
53
+
54
+            let itemData = {
55
+                name: itemname, 
56
+                cost: cost,
57
+                surface: surface,
58
+                surfaceStr: surfaceStr,
59
+                quality: quality,
60
+                model: model,
61
+                itemConfig: config,
62
+                cb: this.shopItemOnClicked
63
+            }
51 64
 
52 65
             let tagType = TagType.OTHER;
53 66
             for (var temp in TagType) {
54
-                if (TagType[temp] == itemConfig.type) {
67
+                if (TagType[temp] == config.type) {
55 68
                     tagType = TagType[temp];
56 69
                     break;
57 70
                 }
@@ -61,18 +74,47 @@ cc.Class({
61 74
                 this.goods[tagType] = [];
62 75
             }
63 76
 
64
-            this.goods[tagType].push(config);
77
+            this.goods[tagType].push(itemData);
78
+            if (config.hot) {
79
+                if (!this.goods[TagType.HOT]) {
80
+                    this.goods[TagType.HOT] = [];
81
+                }
82
+                this.goods[TagType.HOT].push(itemData);
83
+            }
65 84
         }
66 85
     },
67 86
 
68 87
     initUI() {
69
-        let goldNum = G.BagMgr.getItemNumById(JMC.ITEM_ID.SPECIAL_GOLD);
88
+        let goldNum = G.BagMgr.getItemNumById(JMC.ITEM_ID.GOLD);
89
+        this.goldNumText.string = goldNum;
90
+        this.hotToggle.isChecked = true;
91
+        this.showShopViewByTag(TagType.HOT);
92
+    },
93
+
94
+    showShopViewByTag(tag) {
95
+        let list = this.goods[tag];
96
+
97
+        this.shopView.removeAllChildren();
98
+        if (!list || list.length == 0) return;
70 99
 
100
+        for (let i = 0; i < list.length; i++) {
101
+            let data = list[i];
102
+            let itemNode = cc.instantiate(this.itemPrefab);
103
+            let shopItemCtr = itemNode.getComponent('ShopItem');
104
+            shopItemCtr.reloadData(data);
105
+            this.shopView.addChild(itemNode);
106
+        }
71 107
     },
72 108
 
73 109
     typeChooseToggleOnClicked(toggleData, eventKey) {
110
+        this.showShopViewByTag(eventKey);
111
+    },
74 112
 
113
+    shopItemOnClicked(data) {
114
+        G.AppUtils.getSceneCtrl().showAlert(
115
+            'edt_prefab/Shop/ShopItemAlert',
116
+            data
117
+        );
75 118
     }
76 119
 
77
-
78 120
 });

+ 7 - 0
assets/script/core/model/shop.meta

@@ -0,0 +1,7 @@
1
+{
2
+  "ver": "1.0.1",
3
+  "uuid": "1677dce8-6134-4324-a141-fe471ea31ce3",
4
+  "isSubpackage": false,
5
+  "subpackageName": "",
6
+  "subMetas": {}
7
+}

+ 66 - 0
assets/script/core/model/shop/ShopMgr.js

@@ -0,0 +1,66 @@
1
+/**
2
+ * 商城数据管理
3
+ */
4
+let ShopMgr = {
5
+
6
+    init() {
7
+        if (CC_EDITOR) {
8
+            return;
9
+        }
10
+
11
+        this._initEventListener();
12
+        this._initPublishListener();
13
+    },
14
+
15
+    _initEventListener() {
16
+        // 通用消息
17
+        G.PublicMgr.on(JMC.PUBLIC_MSG.SWITCH_ACCOUNT, JMC.PUBLIC_MSG_ORDER.BAG, this.handleDidSwitchAccount, this);
18
+        G.PublicMgr.on(JMC.PUBLIC_MSG.LOGIN_SUCCESS, JMC.PUBLIC_MSG_ORDER.BAG, this.handleDidLoginSuccess, this);
19
+        G.PublicMgr.on(JMC.PUBLIC_MSG.DISCONNECTED, JMC.PUBLIC_MSG_ORDER.BAG, this.handleDidDisconnected, this);
20
+    },
21
+
22
+    _initPublishListener() {
23
+        
24
+    },
25
+
26
+    handleDidLoginSuccess() {
27
+    },
28
+
29
+    handleDidDisconnected() {
30
+    },
31
+
32
+    handleDidSwitchAccount() {
33
+    },
34
+
35
+
36
+    //* ************* 客户端请求/响应 ************* *//
37
+
38
+    // # 购买道具
39
+    // shop_buy_item 2303 {
40
+    //     request {
41
+    //         id 0: integer                   # 道具ID
42
+    //         count 1: integer                # 购买数量,空则为1
43
+    //     }
44
+    //     response {
45
+    //         code 0: integer
46
+    //         items 1: *DataItem              # 发放物品
47
+    //     }
48
+    // }
49
+    requestShopBuyItem(itemId, count) {
50
+        let data = {
51
+            id: itemId,
52
+            count: count
53
+        }
54
+        G.NetworkMgr.sendSocketRequest('shop_buy_item', data, this._responseShopBuyItem.bind(this));
55
+    },
56
+
57
+    _responseShopBuyItem(data) {
58
+        let responseInfo = data.responseInfo;
59
+        if (responseInfo.code === 200) {
60
+            G.AppUtils.getSceneCtrl().addToast('兑换成功');
61
+        }
62
+    }
63
+}
64
+
65
+
66
+module.exports = ShopMgr;

+ 9 - 0
assets/script/core/model/shop/ShopMgr.js.meta

@@ -0,0 +1,9 @@
1
+{
2
+  "ver": "1.0.8",
3
+  "uuid": "cb267c7c-a2f9-4162-b4f9-db03628c43bd",
4
+  "isPlugin": false,
5
+  "loadPluginInWeb": true,
6
+  "loadPluginInNative": true,
7
+  "loadPluginInEditor": false,
8
+  "subMetas": {}
9
+}