Просмотр исходного кода

Merge branch 'master' of http://git.mokasz.com/zouyong/mk_framework

kaka 5 лет назад
Родитель
Сommit
7c69e1ec54

+ 222 - 66
assets/resources/module/cashNormal/cashNormal.prefab

@@ -21,23 +21,23 @@
         "__id__": 2
       },
       {
-        "__id__": 35
+        "__id__": 39
       }
     ],
     "_active": true,
     "_components": [
       {
-        "__id__": 41
+        "__id__": 46
       },
       {
-        "__id__": 42
+        "__id__": 47
       },
       {
-        "__id__": 43
+        "__id__": 48
       }
     ],
     "_prefab": {
-      "__id__": 44
+      "__id__": 49
     },
     "_opacity": 255,
     "_color": {
@@ -98,23 +98,23 @@
         "__id__": 3
       },
       {
-        "__id__": 6
+        "__id__": 7
       },
       {
-        "__id__": 12
+        "__id__": 13
       },
       {
-        "__id__": 24
+        "__id__": 26
       }
     ],
     "_active": true,
     "_components": [
       {
-        "__id__": 33
+        "__id__": 37
       }
     ],
     "_prefab": {
-      "__id__": 34
+      "__id__": 38
     },
     "_opacity": 255,
     "_color": {
@@ -175,10 +175,13 @@
     "_components": [
       {
         "__id__": 4
+      },
+      {
+        "__id__": 5
       }
     ],
     "_prefab": {
-      "__id__": 5
+      "__id__": 6
     },
     "_opacity": 255,
     "_color": {
@@ -260,6 +263,35 @@
     "_id": ""
   },
   {
+    "__type__": "cc.Widget",
+    "_name": "",
+    "_objFlags": 0,
+    "node": {
+      "__id__": 3
+    },
+    "_enabled": true,
+    "alignMode": 1,
+    "_target": {
+      "__id__": 1
+    },
+    "_alignFlags": 45,
+    "_left": 0,
+    "_right": 0,
+    "_top": 0,
+    "_bottom": 0,
+    "_verticalCenter": 0,
+    "_horizontalCenter": 0,
+    "_isAbsLeft": true,
+    "_isAbsRight": true,
+    "_isAbsTop": true,
+    "_isAbsBottom": true,
+    "_isAbsHorizontalCenter": true,
+    "_isAbsVerticalCenter": true,
+    "_originalWidth": 0,
+    "_originalHeight": 0,
+    "_id": ""
+  },
+  {
     "__type__": "cc.PrefabInfo",
     "root": {
       "__id__": 1
@@ -279,17 +311,17 @@
     },
     "_children": [
       {
-        "__id__": 7
+        "__id__": 8
       }
     ],
     "_active": false,
     "_components": [
       {
-        "__id__": 10
+        "__id__": 11
       }
     ],
     "_prefab": {
-      "__id__": 11
+      "__id__": 12
     },
     "_opacity": 255,
     "_color": {
@@ -343,17 +375,17 @@
     "_name": "标题",
     "_objFlags": 0,
     "_parent": {
-      "__id__": 6
+      "__id__": 7
     },
     "_children": [],
     "_active": true,
     "_components": [
       {
-        "__id__": 8
+        "__id__": 9
       }
     ],
     "_prefab": {
-      "__id__": 9
+      "__id__": 10
     },
     "_opacity": 255,
     "_color": {
@@ -407,7 +439,7 @@
     "_name": "",
     "_objFlags": 0,
     "node": {
-      "__id__": 7
+      "__id__": 8
     },
     "_enabled": true,
     "_materials": [
@@ -453,7 +485,7 @@
     "_name": "",
     "_objFlags": 0,
     "node": {
-      "__id__": 6
+      "__id__": 7
     },
     "_enabled": true,
     "_materials": [
@@ -500,17 +532,20 @@
     },
     "_children": [
       {
-        "__id__": 13
+        "__id__": 14
       }
     ],
     "_active": true,
     "_components": [
       {
-        "__id__": 22
+        "__id__": 23
+      },
+      {
+        "__id__": 24
       }
     ],
     "_prefab": {
-      "__id__": 23
+      "__id__": 25
     },
     "_opacity": 255,
     "_color": {
@@ -564,24 +599,24 @@
     "_name": "自动布局",
     "_objFlags": 0,
     "_parent": {
-      "__id__": 12
+      "__id__": 13
     },
     "_children": [
       {
-        "__id__": 14
+        "__id__": 15
       },
       {
-        "__id__": 17
+        "__id__": 18
       }
     ],
     "_active": true,
     "_components": [
       {
-        "__id__": 20
+        "__id__": 21
       }
     ],
     "_prefab": {
-      "__id__": 21
+      "__id__": 22
     },
     "_opacity": 255,
     "_color": {
@@ -635,17 +670,17 @@
     "_name": "累计提现",
     "_objFlags": 0,
     "_parent": {
-      "__id__": 13
+      "__id__": 14
     },
     "_children": [],
     "_active": true,
     "_components": [
       {
-        "__id__": 15
+        "__id__": 16
       }
     ],
     "_prefab": {
-      "__id__": 16
+      "__id__": 17
     },
     "_opacity": 255,
     "_color": {
@@ -699,7 +734,7 @@
     "_name": "",
     "_objFlags": 0,
     "node": {
-      "__id__": 14
+      "__id__": 15
     },
     "_enabled": true,
     "_materials": [
@@ -745,17 +780,17 @@
     "_name": "lbl累计提现",
     "_objFlags": 0,
     "_parent": {
-      "__id__": 13
+      "__id__": 14
     },
     "_children": [],
     "_active": true,
     "_components": [
       {
-        "__id__": 18
+        "__id__": 19
       }
     ],
     "_prefab": {
-      "__id__": 19
+      "__id__": 20
     },
     "_opacity": 255,
     "_color": {
@@ -809,7 +844,7 @@
     "_name": "",
     "_objFlags": 0,
     "node": {
-      "__id__": 17
+      "__id__": 18
     },
     "_enabled": true,
     "_materials": [
@@ -855,7 +890,7 @@
     "_name": "",
     "_objFlags": 0,
     "node": {
-      "__id__": 13
+      "__id__": 14
     },
     "_enabled": true,
     "_layoutSize": {
@@ -898,7 +933,7 @@
     "_name": "",
     "_objFlags": 0,
     "node": {
-      "__id__": 12
+      "__id__": 13
     },
     "_enabled": true,
     "_materials": [
@@ -926,6 +961,33 @@
     "_id": ""
   },
   {
+    "__type__": "cc.Widget",
+    "_name": "",
+    "_objFlags": 0,
+    "node": {
+      "__id__": 13
+    },
+    "_enabled": true,
+    "alignMode": 1,
+    "_target": null,
+    "_alignFlags": 1,
+    "_left": 0,
+    "_right": 0,
+    "_top": 0.06500000000005457,
+    "_bottom": 0,
+    "_verticalCenter": 0,
+    "_horizontalCenter": 0,
+    "_isAbsLeft": true,
+    "_isAbsRight": true,
+    "_isAbsTop": true,
+    "_isAbsBottom": true,
+    "_isAbsHorizontalCenter": true,
+    "_isAbsVerticalCenter": true,
+    "_originalWidth": 0,
+    "_originalHeight": 0,
+    "_id": ""
+  },
+  {
     "__type__": "cc.PrefabInfo",
     "root": {
       "__id__": 1
@@ -945,20 +1007,23 @@
     },
     "_children": [
       {
-        "__id__": 25
+        "__id__": 27
       }
     ],
     "_active": true,
     "_components": [
       {
-        "__id__": 30
+        "__id__": 33
       },
       {
-        "__id__": 31
+        "__id__": 34
+      },
+      {
+        "__id__": 35
       }
     ],
     "_prefab": {
-      "__id__": 32
+      "__id__": 36
     },
     "_opacity": 255,
     "_color": {
@@ -976,14 +1041,14 @@
     "_anchorPoint": {
       "__type__": "cc.Vec2",
       "x": 0.5,
-      "y": 0.5
+      "y": 1
     },
     "_trs": {
       "__type__": "TypedArray",
       "ctor": "Float64Array",
       "array": [
         0,
-        -69.584,
+        515.003,
         0,
         0,
         0,
@@ -1012,21 +1077,24 @@
     "_name": "view",
     "_objFlags": 0,
     "_parent": {
-      "__id__": 24
+      "__id__": 26
     },
     "_children": [
       {
-        "__id__": 26
+        "__id__": 28
       }
     ],
     "_active": true,
     "_components": [
       {
-        "__id__": 28
+        "__id__": 30
+      },
+      {
+        "__id__": 31
       }
     ],
     "_prefab": {
-      "__id__": 29
+      "__id__": 32
     },
     "_opacity": 255,
     "_color": {
@@ -1044,7 +1112,7 @@
     "_anchorPoint": {
       "__type__": "cc.Vec2",
       "x": 0.5,
-      "y": 0.5
+      "y": 1
     },
     "_trs": {
       "__type__": "TypedArray",
@@ -1080,13 +1148,13 @@
     "_name": "content",
     "_objFlags": 0,
     "_parent": {
-      "__id__": 25
+      "__id__": 27
     },
     "_children": [],
     "_active": true,
     "_components": [],
     "_prefab": {
-      "__id__": 27
+      "__id__": 29
     },
     "_opacity": 255,
     "_color": {
@@ -1111,7 +1179,7 @@
       "ctor": "Float64Array",
       "array": [
         0,
-        575,
+        0,
         0,
         0,
         0,
@@ -1151,7 +1219,7 @@
     "_name": "",
     "_objFlags": 0,
     "node": {
-      "__id__": 25
+      "__id__": 27
     },
     "_enabled": true,
     "_materials": [
@@ -1167,6 +1235,35 @@
     "_id": ""
   },
   {
+    "__type__": "cc.Widget",
+    "_name": "",
+    "_objFlags": 0,
+    "node": {
+      "__id__": 27
+    },
+    "_enabled": true,
+    "alignMode": 1,
+    "_target": {
+      "__id__": 1
+    },
+    "_alignFlags": 5,
+    "_left": 0,
+    "_right": 0,
+    "_top": 151.99699999999996,
+    "_bottom": 32.00300000000004,
+    "_verticalCenter": 0,
+    "_horizontalCenter": 0,
+    "_isAbsLeft": true,
+    "_isAbsRight": true,
+    "_isAbsTop": true,
+    "_isAbsBottom": true,
+    "_isAbsHorizontalCenter": true,
+    "_isAbsVerticalCenter": true,
+    "_originalWidth": 0,
+    "_originalHeight": 1150,
+    "_id": ""
+  },
+  {
     "__type__": "cc.PrefabInfo",
     "root": {
       "__id__": 1
@@ -1182,7 +1279,7 @@
     "_name": "",
     "_objFlags": 0,
     "node": {
-      "__id__": 24
+      "__id__": 26
     },
     "_enabled": true,
     "horizontal": false,
@@ -1194,10 +1291,10 @@
     "scrollEvents": [],
     "cancelInnerEvents": false,
     "_N$content": {
-      "__id__": 26
+      "__id__": 28
     },
     "content": {
-      "__id__": 26
+      "__id__": 28
     },
     "_N$horizontalScrollBar": null,
     "_N$verticalScrollBar": null,
@@ -1208,7 +1305,7 @@
     "_name": "",
     "_objFlags": 0,
     "node": {
-      "__id__": 24
+      "__id__": 26
     },
     "_enabled": true,
     "pre_item": [
@@ -1223,6 +1320,35 @@
     "_id": ""
   },
   {
+    "__type__": "cc.Widget",
+    "_name": "",
+    "_objFlags": 0,
+    "node": {
+      "__id__": 26
+    },
+    "_enabled": true,
+    "alignMode": 1,
+    "_target": {
+      "__id__": 1
+    },
+    "_alignFlags": 5,
+    "_left": 0,
+    "_right": 0,
+    "_top": 151.99699999999996,
+    "_bottom": 32.00300000000004,
+    "_verticalCenter": 0,
+    "_horizontalCenter": 0,
+    "_isAbsLeft": true,
+    "_isAbsRight": true,
+    "_isAbsTop": true,
+    "_isAbsBottom": true,
+    "_isAbsHorizontalCenter": true,
+    "_isAbsVerticalCenter": true,
+    "_originalWidth": 0,
+    "_originalHeight": 1150,
+    "_id": ""
+  },
+  {
     "__type__": "cc.PrefabInfo",
     "root": {
       "__id__": 1
@@ -1280,17 +1406,20 @@
     },
     "_children": [
       {
-        "__id__": 36
+        "__id__": 40
       }
     ],
     "_active": true,
     "_components": [
       {
-        "__id__": 39
+        "__id__": 43
+      },
+      {
+        "__id__": 44
       }
     ],
     "_prefab": {
-      "__id__": 40
+      "__id__": 45
     },
     "_opacity": 255,
     "_color": {
@@ -1344,17 +1473,17 @@
     "_name": "按钮纹理",
     "_objFlags": 0,
     "_parent": {
-      "__id__": 35
+      "__id__": 39
     },
     "_children": [],
     "_active": true,
     "_components": [
       {
-        "__id__": 37
+        "__id__": 41
       }
     ],
     "_prefab": {
-      "__id__": 38
+      "__id__": 42
     },
     "_opacity": 255,
     "_color": {
@@ -1408,7 +1537,7 @@
     "_name": "",
     "_objFlags": 0,
     "node": {
-      "__id__": 36
+      "__id__": 40
     },
     "_enabled": true,
     "_materials": [
@@ -1451,7 +1580,7 @@
     "_name": "",
     "_objFlags": 0,
     "node": {
-      "__id__": 35
+      "__id__": 39
     },
     "_enabled": true,
     "node_panel": {
@@ -1462,6 +1591,33 @@
     "_id": ""
   },
   {
+    "__type__": "cc.Widget",
+    "_name": "",
+    "_objFlags": 0,
+    "node": {
+      "__id__": 39
+    },
+    "_enabled": true,
+    "alignMode": 1,
+    "_target": null,
+    "_alignFlags": 9,
+    "_left": 0,
+    "_right": 0,
+    "_top": 20.966999999999985,
+    "_bottom": 0,
+    "_verticalCenter": 0,
+    "_horizontalCenter": 0,
+    "_isAbsLeft": true,
+    "_isAbsRight": true,
+    "_isAbsTop": true,
+    "_isAbsBottom": true,
+    "_isAbsHorizontalCenter": true,
+    "_isAbsVerticalCenter": true,
+    "_originalWidth": 0,
+    "_originalHeight": 0,
+    "_id": ""
+  },
+  {
     "__type__": "cc.PrefabInfo",
     "root": {
       "__id__": 1
@@ -1508,10 +1664,10 @@
     },
     "_enabled": true,
     "sroll_view": {
-      "__id__": 30
+      "__id__": 33
     },
     "lbl_rmb_total": {
-      "__id__": 18
+      "__id__": 19
     },
     "_id": ""
   },

+ 29 - 7
assets/script/game/component/TableView.ts

@@ -65,6 +65,7 @@ export default class TableView extends cc.Component {
             this.itemNode[i] = cc.instantiate(this.item[i]);
         }
         this.node.on('srollview-init', this.init, this);
+        this.node.on('srollview-update', this.updateList, this);
     }
 
     /**
@@ -99,11 +100,31 @@ export default class TableView extends cc.Component {
         // cc.log('tableView结束:' + this.testTime());
     }
 
-    /** 
-     * 刷新列表 
-     * 仅更新data数据
-    */
-    private updateList() {
+    /**
+     * 刷新列表
+     * - 仅支持使用1种预制体时,更新data数据
+     * @param itemData 
+     */
+    public updateList(itemData: Array<any>) {
+        this.itemData = itemData;
+        const old_count = this.itemArr.length;
+        for (let i = 0; i < old_count; i++) {
+            if (this.itemData[i]) {
+                if (!this.itemArr[i]) {
+                    let y = 0;
+                    if (i > 0) {
+                        y = this.itemArr[i - 1].y - this.itemArr[i - 1].height - this.itemInterval;// 下一条目纵坐标
+                    }
+                    let item_node = this.addItemNode(i, y);
+                    this.updateContentHeigh(this.itemArr[i].height - item_node.y);
+                }
+                let comp_script = this.itemArr[i].getComponent(this.scr_item[this.itemData[i].pfbType || 0]);
+                comp_script && comp_script.setItemData(this.itemData[i], this);
+            } else {
+                this.itemArr[i].destroy();
+                this.itemArr[i] = null;
+            }
+        }
 
     }
 
@@ -142,8 +163,8 @@ export default class TableView extends cc.Component {
             if (i > 0) {
                 y = this.itemArr[i - 1].y - this.itemArr[i - 1].height - this.itemInterval;// 下一条目纵坐标
             }
-            this.addItemNode(i, y);
-            this.updateContentHeigh(this.itemArr[i].height - y);
+            let item_node = this.addItemNode(i, y);
+            this.updateContentHeigh(this.itemArr[i].height - item_node.y);
         }
     }
 
@@ -168,6 +189,7 @@ export default class TableView extends cc.Component {
         let comp_script = item.getComponent(this.scr_item[pfbType]);
         comp_script && comp_script.setItemData(this.itemData[i], this);
         this.itemArr.push(item);
+        return item;
         // cc.log('生成itemNode' + i);
     }
 

+ 19 - 13
assets/script/game/component/tween/EffectOpenAndClose.ts

@@ -112,12 +112,13 @@ export default class EffectOpenAndClose extends cc.Component {
                         if (node) {
                             let world_pos = node.parent.convertToWorldSpaceAR(node.getPosition());
                             let node_pos = this.effect_par.parent.convertToNodeSpaceAR(world_pos);
-                            cc.tween(this.effect_par)
-                                .to(0.3, { scale: 0, position: new cc.Vec3(node_pos.x, node_pos.y, 0) })
-                                .call(() => {
-                                    cb && cb();
-                                })
-                                .start()
+                            mk.tween.scaleParallelMove(this.effect_par, 0.3, 1, 0, node_pos, cb)
+                            // cc.tween(this.effect_par)
+                            //     .to(0.3, { scale: 0, position: new cc.Vec3(node_pos.x, node_pos.y, 0) })
+                            //     .call(() => {
+                            //         cb && cb();
+                            //     })
+                            //     .start()
                         } else {
                             cb && cb();
                             cc.error('关闭时动画节点未找到,请检查!!!!!')
@@ -125,13 +126,18 @@ export default class EffectOpenAndClose extends cc.Component {
                     }
                     break;
                 case EffectType.rightIn:
-                    cc.tween(this.effect_par)
-                        .to(0.3, { x: 1000 }, cc.easeOut(3))
-                        .call(() => {
-                            this.effect_par.active = false;
-                            cb && cb();
-                        })
-                        .start()
+                    mk.tween.move(this.effect_par, 0.3, this.effect_par.getPosition(), new cc.Vec2(this.effect_par.x, 1000), () => {
+                        this.effect_par.active = false;
+                        cb && cb();
+                    }, 'sineOut')
+
+                    // cc.tween(this.effect_par)
+                    //     .to(0.3, { x: 1000 }, cc.easeOut(3))
+                    //     .call(() => {
+                    //         this.effect_par.active = false;
+                    //         if (typeof cb == 'function') cb();
+                    //     })
+                    //     .start()
                     break;
             }
         } else {

+ 86 - 3
assets/script/mk/utils/TweenUtil.ts

@@ -6,7 +6,11 @@ const { ccclass, property } = cc._decorator;
  */
 @ccclass
 export default class TweenUtil {
-
+    /** 
+     * 缓动类型
+     */
+    public easing: typeof TweenEasing = TweenEasing
+    
     /**
      * 缩放效果
      * @param node 动画节点
@@ -18,7 +22,7 @@ export default class TweenUtil {
     public scale(node: cc.Node, time: number = 0.15, start_scale: number = 0, end_scale: number = 1, complete_fun?: Function) {
         node.scale = start_scale;
         let scale1 = cc.tween().to(time, { scale: end_scale });
-        let call1 = cc.tween().call(() => { complete_fun && complete_fun(); })
+        let call1 = cc.tween().call(() => { if (typeof complete_fun == 'function') complete_fun(); })
         cc.tween(node).then(scale1).then(call1).start()
     }
 
@@ -33,7 +37,86 @@ export default class TweenUtil {
     public scaleX(node: cc.Node, time: number = 0.15, start_scale: number = 0, end_scale: number = 1, complete_fun?: Function) {
         node.scaleX = start_scale;
         let scale1 = cc.tween().to(time, { scaleX: end_scale });
-        let call1 = cc.tween().call(() => { complete_fun && complete_fun(); })
+        let call1 = cc.tween().call(() => { if (typeof complete_fun == 'function') complete_fun(); })
         cc.tween(node).then(scale1).then(call1).start()
     }
+
+    /**
+     * 缩放移动效果
+     * @param node 动画节点
+     * @param time 动画时间
+     * @param start_scale 起始缩放属性
+     * @param end_scale 结束缩放属性
+     * @param end_pos 结束节点位置
+     * @param complete_fun 完成回调
+     */
+    public scaleParallelMove(node: cc.Node, time: number = 0.15, start_scale: number = 0, end_scale: number = 1, end_pos: cc.Vec2 = cc.Vec2.ZERO, complete_fun?: Function) {
+        node.scale = start_scale;
+        let scale1 = cc.tween().to(time, { scale: end_scale });
+        let pos1 = cc.tween().to(time, { position: new cc.Vec3(end_pos.x, end_pos.y, 0) });
+        let call1 = cc.tween().call(() => { if (typeof complete_fun == 'function') complete_fun(); })
+        let parallel = cc.tween().parallel(scale1, pos1)
+        cc.tween(node).then(parallel).then(call1).start();
+    }
+
+    /**
+     * 移动效果
+     * @param node 
+     * @param time 
+     * @param complete_fun 
+     */
+    public move(node: cc.Node, time: number = 0.15, start_pos: cc.Vec2 = cc.Vec2.ZERO, end_pos: cc.Vec2 = cc.Vec2.ZERO, complete_fun?: Function, easing?: keyof typeof TweenEasing) {
+        node.setPosition(start_pos);
+        let pos1 = cc.tween().to(time, { position: new cc.Vec3(end_pos.x, end_pos.y, 0) }, { easing: easing });// cc.easeOut(3)
+        let call1 = cc.tween().call(() => { if (typeof complete_fun == 'function') complete_fun(); })
+        cc.tween(node).then(pos1).then(call1).start();
+    }
 }
+/**
+ * 缓动类型
+ */
+enum TweenEasing {
+    linear,
+    smooth,
+    fade,
+    quadIn,
+    quadOut,
+    quadInOut,
+    quadOutIn,
+    cubicIn,
+    cubicOut,
+    cubicInOut,
+    cubicOutIn,
+    quartIn,
+    quartOut,
+    quartInOut,
+    quartOutIn,
+    quintIn,
+    quintOut,
+    quintInOut,
+    quintOutIn,
+    sineIn,
+    sineOut,
+    sineInOut,
+    sineOutIn,
+    expoIn,
+    expoOut,
+    expoInOut,
+    expoOutIn,
+    circIn,
+    circOut,
+    circInOut,
+    circOutIn,
+    elasticIn,
+    elasticOut,
+    elasticInOut,
+    elasticOutIn,
+    backIn,
+    backOut,
+    backInOut,
+    backOutIn,
+    bounceIn,
+    bounceOut,
+    bounceInOut,
+    bounceOutIn
+}