Przeglądaj źródła

【修改】 修改追梦界面

Hua 1 rok temu
rodzic
commit
475a84c08a

+ 30 - 60
assets/resources/edt_prefab/Bag/BagMain.prefab

@@ -2336,7 +2336,7 @@
2336 2336
     },
2337 2337
     "_contentSize": {
2338 2338
       "__type__": "cc.Size",
2339
-      "width": 15.57,
2339
+      "width": 9.32,
2340 2340
       "height": 50.4
2341 2341
     },
2342 2342
     "_anchorPoint": {
@@ -2387,8 +2387,8 @@
2387 2387
       }
2388 2388
     ],
2389 2389
     "_useOriginalSize": false,
2390
-    "_string": "3",
2391
-    "_N$string": "3",
2390
+    "_string": "-",
2391
+    "_N$string": "-",
2392 2392
     "_fontSize": 28,
2393 2393
     "_lineHeight": 40,
2394 2394
     "_enableWrapText": true,
@@ -2550,7 +2550,7 @@
2550 2550
     },
2551 2551
     "_contentSize": {
2552 2552
       "__type__": "cc.Size",
2553
-      "width": 54.5,
2553
+      "width": 9.32,
2554 2554
       "height": 50.4
2555 2555
     },
2556 2556
     "_anchorPoint": {
@@ -2601,8 +2601,8 @@
2601 2601
       }
2602 2602
     ],
2603 2603
     "_useOriginalSize": false,
2604
-    "_string": "6.14",
2605
-    "_N$string": "6.14",
2604
+    "_string": "-",
2605
+    "_N$string": "-",
2606 2606
     "_fontSize": 28,
2607 2607
     "_lineHeight": 40,
2608 2608
     "_enableWrapText": true,
@@ -3141,7 +3141,7 @@
3141 3141
     },
3142 3142
     "_contentSize": {
3143 3143
       "__type__": "cc.Size",
3144
-      "width": 15.57,
3144
+      "width": 9.32,
3145 3145
       "height": 50.4
3146 3146
     },
3147 3147
     "_anchorPoint": {
@@ -3192,8 +3192,8 @@
3192 3192
       }
3193 3193
     ],
3194 3194
     "_useOriginalSize": false,
3195
-    "_string": "0",
3196
-    "_N$string": "0",
3195
+    "_string": "-",
3196
+    "_N$string": "-",
3197 3197
     "_fontSize": 28,
3198 3198
     "_lineHeight": 40,
3199 3199
     "_enableWrapText": true,
@@ -3252,8 +3252,8 @@
3252 3252
     },
3253 3253
     "_contentSize": {
3254 3254
       "__type__": "cc.Size",
3255
-      "width": 100,
3256
-      "height": 40
3255
+      "width": 250,
3256
+      "height": 110
3257 3257
     },
3258 3258
     "_anchorPoint": {
3259 3259
       "__type__": "cc.Vec2",
@@ -3571,21 +3571,11 @@
3571 3571
     "_N$normalSprite": {
3572 3572
       "__uuid__": "b366a9f1-db10-4652-adfb-4b95ed5df3b6"
3573 3573
     },
3574
-    "_N$pressedSprite": {
3575
-      "__uuid__": "e9ec654c-97a2-4787-9325-e6a10375219a"
3576
-    },
3577
-    "pressedSprite": {
3578
-      "__uuid__": "e9ec654c-97a2-4787-9325-e6a10375219a"
3579
-    },
3580
-    "_N$hoverSprite": {
3581
-      "__uuid__": "f0048c10-f03e-4c97-b9d3-3506e1d58952"
3582
-    },
3583
-    "hoverSprite": {
3584
-      "__uuid__": "f0048c10-f03e-4c97-b9d3-3506e1d58952"
3585
-    },
3586
-    "_N$disabledSprite": {
3587
-      "__uuid__": "29158224-f8dd-4661-a796-1ffab537140e"
3588
-    },
3574
+    "_N$pressedSprite": null,
3575
+    "pressedSprite": null,
3576
+    "_N$hoverSprite": null,
3577
+    "hoverSprite": null,
3578
+    "_N$disabledSprite": null,
3589 3579
     "_N$target": {
3590 3580
       "__id__": 85
3591 3581
     },
@@ -3633,8 +3623,8 @@
3633 3623
     },
3634 3624
     "_contentSize": {
3635 3625
       "__type__": "cc.Size",
3636
-      "width": 100,
3637
-      "height": 40
3626
+      "width": 250,
3627
+      "height": 110
3638 3628
     },
3639 3629
     "_anchorPoint": {
3640 3630
       "__type__": "cc.Vec2",
@@ -3952,21 +3942,11 @@
3952 3942
     "_N$normalSprite": {
3953 3943
       "__uuid__": "b366a9f1-db10-4652-adfb-4b95ed5df3b6"
3954 3944
     },
3955
-    "_N$pressedSprite": {
3956
-      "__uuid__": "e9ec654c-97a2-4787-9325-e6a10375219a"
3957
-    },
3958
-    "pressedSprite": {
3959
-      "__uuid__": "e9ec654c-97a2-4787-9325-e6a10375219a"
3960
-    },
3961
-    "_N$hoverSprite": {
3962
-      "__uuid__": "f0048c10-f03e-4c97-b9d3-3506e1d58952"
3963
-    },
3964
-    "hoverSprite": {
3965
-      "__uuid__": "f0048c10-f03e-4c97-b9d3-3506e1d58952"
3966
-    },
3967
-    "_N$disabledSprite": {
3968
-      "__uuid__": "29158224-f8dd-4661-a796-1ffab537140e"
3969
-    },
3945
+    "_N$pressedSprite": null,
3946
+    "pressedSprite": null,
3947
+    "_N$hoverSprite": null,
3948
+    "hoverSprite": null,
3949
+    "_N$disabledSprite": null,
3970 3950
     "_N$target": {
3971 3951
       "__id__": 94
3972 3952
     },
@@ -4014,8 +3994,8 @@
4014 3994
     },
4015 3995
     "_contentSize": {
4016 3996
       "__type__": "cc.Size",
4017
-      "width": 100,
4018
-      "height": 40
3997
+      "width": 250,
3998
+      "height": 110
4019 3999
     },
4020 4000
     "_anchorPoint": {
4021 4001
       "__type__": "cc.Vec2",
@@ -4333,21 +4313,11 @@
4333 4313
     "_N$normalSprite": {
4334 4314
       "__uuid__": "b366a9f1-db10-4652-adfb-4b95ed5df3b6"
4335 4315
     },
4336
-    "_N$pressedSprite": {
4337
-      "__uuid__": "e9ec654c-97a2-4787-9325-e6a10375219a"
4338
-    },
4339
-    "pressedSprite": {
4340
-      "__uuid__": "e9ec654c-97a2-4787-9325-e6a10375219a"
4341
-    },
4342
-    "_N$hoverSprite": {
4343
-      "__uuid__": "f0048c10-f03e-4c97-b9d3-3506e1d58952"
4344
-    },
4345
-    "hoverSprite": {
4346
-      "__uuid__": "f0048c10-f03e-4c97-b9d3-3506e1d58952"
4347
-    },
4348
-    "_N$disabledSprite": {
4349
-      "__uuid__": "29158224-f8dd-4661-a796-1ffab537140e"
4350
-    },
4316
+    "_N$pressedSprite": null,
4317
+    "pressedSprite": null,
4318
+    "_N$hoverSprite": null,
4319
+    "hoverSprite": null,
4320
+    "_N$disabledSprite": null,
4351 4321
     "_N$target": {
4352 4322
       "__id__": 103
4353 4323
     },

Plik diff jest za duży
+ 231 - 196
assets/resources/edt_prefab/Dream/DreamMain.prefab


+ 7 - 3
assets/script/app/config/ConfigBase.js

@@ -9,17 +9,21 @@ cc.Class({
9 9
         multipleCache:null,
10 10
         table:null,
11 11
     },
12
-    
13
-    ctor(table, mainKey, multipleKey) {
12
+
13
+    ctor() {
14
+
15
+    },
16
+
17
+    initTable(table, mainKey, multipleKey) {
14 18
         this.table = table;
15 19
         this.mainKey = mainKey;
16 20
         this.multiple = multipleKey;
17 21
 
18 22
         this.indexsCache = {};
19 23
         this.multipleCache = {};
24
+        return this
20 25
     },
21 26
 
22
-
23 27
     // getObjectValue(object, key) {
24 28
     //     if (object.hasOwnProperty(key))
25 29
     //     {

+ 4 - 7
assets/script/app/constants/AppConstants.js

@@ -35,7 +35,10 @@ window.JMC.ITEM_ID = cc.Enum({
35 35
 window.JMC.PUBLIC_MSG = cc.Enum({
36 36
     SWITCH_ACCOUNT: 'switch_account',       // 已经切换账号
37 37
     LOGIN_SUCCESS: 'login_success',         // 已经登录
38
-    DISCONNECTED: 'disconnected'           // 已经断网
38
+    DISCONNECTED: 'disconnected',           // 已经断网
39
+
40
+    BAG_INFO: "BAG_INFO",                   // 背包基本信息
41
+    
39 42
 });
40 43
 
41 44
 // 通用消息类型优先级
@@ -55,9 +58,3 @@ window.JMC.ORDER_STATUS = cc.Enum({
55 58
     SUBMIT_ORDER_FAILED: 5,    // 提交订单失败
56 59
     SUBMIT_ORDER_UNKOWN: 6    // 提交订单未知结果
57 60
 });
58
-
59
-
60
-// 背包事件
61
-window.JMC.BAG = cc.Enum({
62
-    INFO: "JMC.BAG.INFO",             // 基本信息
63
-});

+ 2 - 7
assets/script/app/view/bag/BagMain.js

@@ -1,9 +1,4 @@
1
-// Learn cc.Class:
2
-//  - https://docs.cocos.com/creator/manual/en/scripting/class.html
3
-// Learn Attribute:
4
-//  - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html
5
-// Learn life-cycle callbacks:
6
-//  - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html
1
+
7 2
 let ButtonSelect2 = require('ButtonSelect2')
8 3
 cc.Class({
9 4
     extends: cc.Component,
@@ -15,7 +10,7 @@ cc.Class({
15 10
     onLoad () {
16 11
         G.BagMgr.requestInfo();
17 12
     },
18
-    
13
+
19 14
     start () {
20 15
 
21 16
     },

+ 60 - 0
assets/script/app/view/common/ViewBase.js

@@ -0,0 +1,60 @@
1
+cc.Class({
2
+    extends: cc.Component,
3
+    properties: {
4
+    },
5
+
6
+    init(param) {
7
+        super.init()
8
+
9
+    },
10
+
11
+    createComponent(type, parent, param, cb) {
12
+        let prefabPath = G.UIMgr.defaultUIPath + JMC.UIPath[type];
13
+        this.creawteUI(prefabPath, parent, param)
14
+    },
15
+
16
+    creawteUI(prefabPath, parent, param, cb, cache = false) {
17
+        G.LogUtils.warn('showAlert', prefabPath);
18
+        let self = this;
19
+        cc.loader.loadRes(prefabPath, cc.Prefab, (completedCount, totalCount, item) => {
20
+        }, (err, prefab) => {
21
+            if (err) {
22
+                G.AppUtils.getSceneCtrl().addToast('网络异常!');
23
+                G.LogUtils.error('[showAlert]', err);
24
+                if (cb) {
25
+                    cb(undefined, 'error', err);
26
+                }
27
+                return;
28
+            }
29
+
30
+            let node = cc.instantiate(prefab);
31
+            if (cb) {
32
+                cb(alert, 'willShow', undefined);
33
+            }
34
+
35
+            let ret = self.safeAddChild(parent, node);
36
+            if (!ret) {
37
+                return;
38
+            }
39
+
40
+            let viewBase = node.getComponent(ViewBase);
41
+            if (viewBase) {
42
+                viewBase.init(param)
43
+            }
44
+
45
+            if (!cache) {
46
+                cc.loader.releaseRes(prefabPath);
47
+            }
48
+        });
49
+    },
50
+
51
+    safeAddChild(parent, node) {
52
+        if (!cc.isValid(node) || !cc.isValid(parent)) {
53
+            return false;
54
+        }
55
+
56
+        parent.addChild(node);
57
+        cc.game.emit('e_ui_push_alert', {node});
58
+        return true;
59
+    },
60
+});

+ 9 - 0
assets/script/app/view/common/ViewBase.js.meta

@@ -0,0 +1,9 @@
1
+{
2
+  "ver": "1.0.8",
3
+  "uuid": "e7fbb318-ca91-4c18-ae79-4e24c87711c3",
4
+  "isPlugin": false,
5
+  "loadPluginInWeb": true,
6
+  "loadPluginInNative": true,
7
+  "loadPluginInEditor": false,
8
+  "subMetas": {}
9
+}

+ 7 - 0
assets/script/app/view/dream.meta

@@ -0,0 +1,7 @@
1
+{
2
+  "ver": "1.0.1",
3
+  "uuid": "de2d934e-3962-4f21-93dc-bd949372578b",
4
+  "isSubpackage": false,
5
+  "subpackageName": "",
6
+  "subMetas": {}
7
+}

+ 63 - 0
assets/script/app/view/dream/DreamMain.js

@@ -0,0 +1,63 @@
1
+let ButtonSelect1 = require('ButtonSelect1')
2
+let ViewBase = require('ViewBase')
3
+
4
+cc.Class({
5
+    extends: cc.ViewBase,
6
+    properties: {
7
+        button1: {
8
+            default: null,
9
+            type: ButtonSelect1,
10
+            serializable: true,
11
+        },
12
+
13
+        button2: {
14
+            default: null,
15
+            type: ButtonSelect1,
16
+            serializable: true,
17
+        },
18
+
19
+        button3: {
20
+            default: null,
21
+            type: ButtonSelect1,
22
+            serializable: true,
23
+        },
24
+
25
+        button4: {
26
+            default: null,
27
+            type: ButtonSelect1,
28
+            serializable: true,
29
+        },
30
+    },
31
+
32
+    onLoad () {
33
+        self.buttons = [
34
+            this.button1,
35
+            this.button2,
36
+            this.button3,
37
+            this.button4,
38
+        ];
39
+
40
+        this.views = [
41
+            {type:JMC.UIEnum.DreamMain, view:null, initing:false},
42
+            {type:JMC.UIEnum.DreamMain, view:null, initing:false},
43
+            {type:JMC.UIEnum.DreamMain, view:null, initing:false},
44
+            {type:JMC.UIEnum.DreamMain, view:null, initing:false},
45
+        ];
46
+
47
+        this.curViewType = null
48
+        this.onClickTitle(null, "0")
49
+    },
50
+    
51
+    onClickTitle(event, customEventData) {
52
+        let index = parseInt(customEventData)
53
+        let viewType = this.views[index]
54
+
55
+        this.curViewType = viewType;
56
+        this.createOrShowView(this.curViewType)
57
+    },
58
+
59
+    createOrShowView(type) {
60
+
61
+    }
62
+    // update (dt) {},
63
+});

+ 9 - 0
assets/script/app/view/dream/DreamMain.js.meta

@@ -0,0 +1,9 @@
1
+{
2
+  "ver": "1.0.8",
3
+  "uuid": "2fd79d10-127e-4962-86e7-35ae0dc0aa1b",
4
+  "isPlugin": false,
5
+  "loadPluginInWeb": true,
6
+  "loadPluginInNative": true,
7
+  "loadPluginInEditor": false,
8
+  "subMetas": {}
9
+}

+ 0 - 1
assets/script/app/view/navigation/NavigationMain.js

@@ -88,7 +88,6 @@ cc.Class({
88 88
             const button = this.buttons[i];
89 89
             button.setSelect(index == i)
90 90
         }
91
-
92 91
         G.UIMgr.open(this.views[index]);
93 92
     },
94 93
 

+ 24 - 28
assets/script/core/model/UIMgr.js

@@ -4,6 +4,7 @@
4 4
 
5 5
 require("UIInfo")
6 6
 const Proxy = require('Proxy');
7
+const ViewBase = require('ViewBase');
7 8
 
8 9
 /**
9 10
  * 登录数据管理
@@ -20,11 +21,14 @@ let UIMgr = {
20 21
             return;
21 22
         }
22 23
 
23
-        this.UIRoots = {
24
-            [window.JMC.Proxy.Main]:"Main",
25
-            [window.JMC.Proxy.Navigation]:"Navigation",
26
-            [window.JMC.Proxy.Toast]:"Toast",
27
-            [window.JMC.Proxy.UI]:"UI",
24
+        // 常亮定义
25
+        this.defaultUIPath = 'edt_prefab/';
26
+
27
+        this.uiRoots = {
28
+            [JMC.Proxy.Main]:"Main",
29
+            [JMC.Proxy.Navigation]:"Navigation",
30
+            [JMC.Proxy.Toast]:"Toast",
31
+            [JMC.Proxy.UI]:"UI",
28 32
         };
29 33
     },
30 34
 
@@ -35,20 +39,15 @@ let UIMgr = {
35 39
     },
36 40
 
37 41
     open(type, param) {
38
-        let prefabPath = 'edt_prefab/' + window.JMC.UIPath[type];
42
+        let prefabPath = this.defaultUIPath + JMC.UIPath[type];
39 43
         this.showUI(prefabPath, param)
40 44
     },
41 45
 
42
-    showUI(prefabPath, alertData, cb, cache = false) {
46
+    showUI(prefabPath, param, cb, cache = false) {
43 47
         G.LogUtils.warn('showAlert', prefabPath);
44 48
         let self = this;
45
-        let temp = undefined;
46
-        cc.loader.loadRes(prefabPath, cc.Prefab, (completedCount, totalCount, item)=>{
47
-            temp = G.AppUtils.getLoadProgressInfo(temp, completedCount, totalCount);
48
-            G.AppUtils.getSceneCtrl().updateLoadingProgress(temp.precent * 100, 100, item);
49
+        cc.loader.loadRes(prefabPath, cc.Prefab, (completedCount, totalCount, item) => {
49 50
         }, (err, prefab) => {
50
-            G.AppUtils.getSceneCtrl().updateLoadingProgress(100, 100, undefined);
51
-
52 51
             if (err) {
53 52
                 G.AppUtils.getSceneCtrl().addToast('网络异常!');
54 53
                 G.LogUtils.error('[showAlert]', err);
@@ -64,33 +63,30 @@ let UIMgr = {
64 63
             }
65 64
 
66 65
             let uiRoot = self.getUIRoot();
66
+
67 67
             let proxy = node.getComponent(Proxy);
68 68
             if (proxy){
69
-                uiRoot = uiRoot.getChildByName(self.UIRoots[proxy.type])
70
-                self.clearUIType(proxy.type, proxy.type == window.JMC.Proxy.Main)
69
+                uiRoot = uiRoot.getChildByName(self.uiRoots[proxy.type])
70
+                self.clearUIType(proxy.type, proxy.type == JMC.Proxy.Main)
71 71
             }
72
-            
73
-            // let uiRoot = this.getUIRoot();
74
-            // .getChildByName(this.UIRoots[type])
75
-            let ret = self.pushUI(uiRoot, node);
72
+
73
+            let ret = self.safeAddChild(uiRoot, node);
76 74
             if (!ret) {
77 75
                 return;
78 76
             }
79 77
 
78
+            let viewBase = node.getComponent(ViewBase);
79
+            if (viewBase) {
80
+                viewBase.init(param)
81
+            }
82
+
80 83
             if (!cache) {
81 84
                 cc.loader.releaseRes(prefabPath);
82 85
             }
83 86
         });
84 87
     },
85 88
 
86
-    /**
87
-     * 弹出指定弹框
88
-     *
89
-     * @author Pyden
90
-     * @date 2019-03-22
91
-     * @param {JMAlertBase} alert 弹框
92
-     */
93
-    pushUI (uiRoot, node) {
89
+    safeAddChild(uiRoot, node) {
94 90
         if (!cc.isValid(node) || !cc.isValid(uiRoot)) {
95 91
             return false;
96 92
         }
@@ -106,7 +102,7 @@ let UIMgr = {
106 102
         }
107 103
 
108 104
         let uiRoot = this.getUIRoot();
109
-        let typeRoot = uiRoot.getChildByName(this.UIRoots[type]);
105
+        let typeRoot = uiRoot.getChildByName(this.uiRoots[type]);
110 106
         typeRoot.removeAllChildren();
111 107
     }
112 108
 }

+ 1 - 1
assets/script/core/model/bag/BagMgr.js

@@ -25,7 +25,7 @@ let BagMgr = {
25 25
         if (responseInfo.code === 200) {
26 26
             // 玩家基础信息
27 27
             this._items = responseInfo.items;
28
-            G.PublicMgr.emit(JMC.BAG.INFO);
28
+            G.PublicMgr.emit(JMC.PUBLIC_MSG.BAG_INFO);
29 29
         } else {
30 30
             // 断开网络并且弹出重连窗口
31 31
             G.NetworkMgr.closeSocket();