薛鸿潇 5 lat temu
rodzic
commit
799ff756d4

+ 0 - 49
mk_framework/assets/script/game/component/OpenWindow.ts

@@ -1,49 +0,0 @@
-/**
- * 窗口打开模式
- */
-enum WindowOpenMode {
-    /**
-     * 对当前打开的窗口不作处理并添加新的窗口
-     */
-    NotCloseAndAdd,
-    /**
-     * 如果新的窗口和当前打开的窗口路径一致则传递参数且不打开,否则为NotCloseAndAdd模式
-     */
-    NotCloseAndCover,
-    /**
-     * 关闭当前打开的窗口并添加新的窗口
-     */
-    CloseAndAdd,
-    /**
-     * 如果新的窗口和当前打开的窗口路径一致则传递参数且不打开,否则为CloseAndCover模式
-     */
-    CloseAndCover
-}
-
-const { ccclass, property } = cc._decorator;
-/**
- * 打开窗口组件,定义窗口的参数、窗口的打开等
- * @author 薛鸿潇
- */
-@ccclass
-export default class OpenWindow extends cc.Component {
-
-    @property({ tooltip: "要加载的预制体对象相对于resources的路径" })
-    public prefabPath: string = '';
-    @property({ tooltip: "窗口打开的模式", type: cc.Enum(WindowOpenMode) })
-    public openMode: WindowOpenMode = WindowOpenMode.NotCloseAndAdd;
-    @property({ tooltip: "自定义参数" })
-    public params: string[] = [];
-    @property({ tooltip: "窗口打开触发的节点,不填则无触发", type: [cc.Node] })
-    public openFroms: cc.Node[] = [];
-    onLoad() {
-
-    }
-
-    start() {
-
-    }
-    private async open() {
-
-    }
-}

+ 0 - 9
mk_framework/assets/script/game/component/OpenWindow.ts.meta

@@ -1,9 +0,0 @@
-{
-  "ver": "1.0.8",
-  "uuid": "7d3b9a5b-f60e-4981-aec4-dcf0abc9bc65",
-  "isPlugin": false,
-  "loadPluginInWeb": true,
-  "loadPluginInNative": true,
-  "loadPluginInEditor": false,
-  "subMetas": {}
-}

+ 3 - 0
mk_framework/assets/script/game/component/PageView.ts

@@ -23,6 +23,7 @@ export default class PageView extends cc.Component {
     start() {
     start() {
 
 
     }
     }
+
     /**
     /**
      * 初始化列表
      * 初始化列表
      * @param list_data 数据列表
      * @param list_data 数据列表
@@ -59,6 +60,7 @@ export default class PageView extends cc.Component {
             }
             }
         }
         }
     }
     }
+
     /**
     /**
      * 返回当前页
      * 返回当前页
      */
      */
@@ -66,6 +68,7 @@ export default class PageView extends cc.Component {
         let index = this.comp_page_view.getCurrentPageIndex();
         let index = this.comp_page_view.getCurrentPageIndex();
         this.comp_page_view.setCurrentPageIndex(index);
         this.comp_page_view.setCurrentPageIndex(index);
     }
     }
+    
     /** 清理子节点 
     /** 清理子节点 
      * - need_destroy 销毁
      * - need_destroy 销毁
     */
     */

+ 5 - 0
mk_framework/assets/script/game/component/TabSwitching.ts

@@ -29,6 +29,7 @@ export default class TabSwitching extends cc.Component {
 
 
     start() {
     start() {
     }
     }
+
     /**
     /**
      * 初始化按钮事件
      * 初始化按钮事件
      */
      */
@@ -37,6 +38,7 @@ export default class TabSwitching extends cc.Component {
             this.arr_btn_tab[i].node.on('click', this.onClockTabCall, this);
             this.arr_btn_tab[i].node.on('click', this.onClockTabCall, this);
         }
         }
     }
     }
+
     /**
     /**
      * 页签切换回调
      * 页签切换回调
      * @param comp_btn 按钮组件
      * @param comp_btn 按钮组件
@@ -53,6 +55,7 @@ export default class TabSwitching extends cc.Component {
         img_style_2.active = false;
         img_style_2.active = false;
         this.func && this.func(comp_btn, params);
         this.func && this.func(comp_btn, params);
     }
     }
+
     /**
     /**
      * ui界面注册的按钮事件
      * ui界面注册的按钮事件
      * @param func 事件
      * @param func 事件
@@ -61,6 +64,7 @@ export default class TabSwitching extends cc.Component {
     private onTabBtnClick(func: Function, target) {
     private onTabBtnClick(func: Function, target) {
         this.func = func.bind(target);
         this.func = func.bind(target);
     }
     }
+
     /**
     /**
      * 初始化页签状态
      * 初始化页签状态
      */
      */
@@ -72,6 +76,7 @@ export default class TabSwitching extends cc.Component {
             img_style_2.active = true;
             img_style_2.active = true;
         }
         }
     }
     }
+    
     /**
     /**
      * 切换到指定页签
      * 切换到指定页签
      * @param tab 页签下标
      * @param tab 页签下标

+ 28 - 21
mk_framework/assets/script/game/component/TableView.ts

@@ -40,17 +40,20 @@ export default class TableView extends cc.Component {
     private count: number = 0;
     private count: number = 0;
     private itemCanMoveDown: boolean = null;
     private itemCanMoveDown: boolean = null;
     private itemCanMoveUp: boolean = null;
     private itemCanMoveUp: boolean = null;
+
     onLoad() {
     onLoad() {
         this.initPro();
         this.initPro();
-        let itemData = [];
-        for (let i = 0; i < 20; i++) {
-            let test_data = {
-                pfbType: 0,
-            }
-            itemData.push(test_data);
-        }
-        this.init(itemData);
+        // 测试
+        // let itemData = [];
+        // for (let i = 0; i < 20; i++) {
+        //     let test_data = {
+        //         pfbType: 0,
+        //     }
+        //     itemData.push(test_data);
+        // }
+        // this.init(itemData);
     }
     }
+
     private initPro() {
     private initPro() {
         this.scrollView = this.node.getComponent(cc.ScrollView);
         this.scrollView = this.node.getComponent(cc.ScrollView);
         this.content = this.scrollView.content;
         this.content = this.scrollView.content;
@@ -61,12 +64,9 @@ export default class TableView extends cc.Component {
         }
         }
         this.node.on('srollview-init', this.init, this);
         this.node.on('srollview-init', this.init, this);
     }
     }
-    //itemData是item数据,itemPosMap是滚动条滚动时要用到的item位置数据.
+    
     /**
     /**
      * @param itemData 列表数据
      * @param itemData 列表数据
-     * @param scrollView 滑动组件
-     * @param item 预制体组
-     * @param itemInterval 间隔
      * @param isSkipInit 跳过初始化
      * @param isSkipInit 跳过初始化
      * @returns 
      * @returns 
      */
      */
@@ -76,12 +76,6 @@ export default class TableView extends cc.Component {
         }
         }
 
 
         this.itemData = itemData; //item数据
         this.itemData = itemData; //item数据
-        // this.scrollView = scrollView;
-        // this.item = item;
-        // this.itemInterval = itemInterval || 0; //间距
-        // 初始化各类属性
-        // this.content = this.scrollView.content;
-        // this.layerHeight = this.scrollView.node.height;
         this.firstItemIndex = 0;
         this.firstItemIndex = 0;
         this.lastItemIndex = 0;
         this.lastItemIndex = 0;
         this.firstItemData = {};
         this.firstItemData = {};
@@ -101,7 +95,9 @@ export default class TableView extends cc.Component {
         this.scrollView.node.on('scrolling', this.callback, this);
         this.scrollView.node.on('scrolling', this.callback, this);
         // cc.log('tableView结束:' + this.testTime());
         // cc.log('tableView结束:' + this.testTime());
     }
     }
-    /** 刷新列表 
+
+    /** 
+     * 刷新列表 
      * 仅更新data数据
      * 仅更新data数据
     */
     */
     private updateList() {
     private updateList() {
@@ -126,6 +122,7 @@ export default class TableView extends cc.Component {
             this.updateContentHeigh(this.itemPosMap.get(item_data_count - 1).endPos);
             this.updateContentHeigh(this.itemPosMap.get(item_data_count - 1).endPos);
         }
         }
     }
     }
+
     /**
     /**
      * 实例化所有用到的item,控制实例化item的数目,暂定超出两个
      * 实例化所有用到的item,控制实例化item的数目,暂定超出两个
      */
      */
@@ -146,6 +143,7 @@ export default class TableView extends cc.Component {
             this.updateContentHeigh(this.itemArr[i].height - y);
             this.updateContentHeigh(this.itemArr[i].height - y);
         }
         }
     }
     }
+
     /**
     /**
      * 添加条目节点
      * 添加条目节点
      * @param i 编号
      * @param i 编号
@@ -169,6 +167,7 @@ export default class TableView extends cc.Component {
         this.itemArr.push(item);
         this.itemArr.push(item);
         // cc.log('生成itemNode' + i);
         // cc.log('生成itemNode' + i);
     }
     }
+    
     /**
     /**
      * 更新centent高
      * 更新centent高
      * @param num  
      * @param num  
@@ -177,6 +176,7 @@ export default class TableView extends cc.Component {
         this.content.height = num > this.layerHeight ? num : this.layerHeight;
         this.content.height = num > this.layerHeight ? num : this.layerHeight;
         // cc.log('滚动条高度:', this.content.height);
         // cc.log('滚动条高度:', this.content.height);
     }
     }
+
     /**
     /**
      * 触摸滚动条的函数回调
      * 触摸滚动条的函数回调
      * @param event 
      * @param event 
@@ -246,6 +246,7 @@ export default class TableView extends cc.Component {
     private updateItemIndex() {
     private updateItemIndex() {
         //cc.log(this.firstItemIndex, this.lastItemIndex, this.itemArr, this.itemData)
         //cc.log(this.firstItemIndex, this.lastItemIndex, this.itemArr, this.itemData)
     }
     }
+
     /**
     /**
      * 得到滚动条此时状态下应有的itemNode元素,包括滚动条上方一个,滚动条下方一个
      * 得到滚动条此时状态下应有的itemNode元素,包括滚动条上方一个,滚动条下方一个
      * @returns 
      * @returns 
@@ -273,6 +274,7 @@ export default class TableView extends cc.Component {
         })
         })
         return arr;
         return arr;
     }
     }
+
     /**
     /**
      * 滚动到顶部【滚动条顺序是从上到下开始遍历】
      * 滚动到顶部【滚动条顺序是从上到下开始遍历】
      * @param num 
      * @param num 
@@ -287,8 +289,8 @@ export default class TableView extends cc.Component {
         }
         }
         num++;
         num++;
         return this.itemMoveUp(num);
         return this.itemMoveUp(num);
-
     }
     }
+
     /** 滚动到底部 */
     /** 滚动到底部 */
     private itemMoveDown(num: number) {
     private itemMoveDown(num: number) {
         if (num < 0 || this.firstItemIndex - 1 > num || num + 1 > this.itemData.length) {
         if (num < 0 || this.firstItemIndex - 1 > num || num + 1 > this.itemData.length) {
@@ -299,8 +301,8 @@ export default class TableView extends cc.Component {
         }
         }
         num--;
         num--;
         return this.itemMoveDown(num);
         return this.itemMoveDown(num);
-
     }
     }
+
     /**
     /**
      * 判断指定index位置是否存在itemNode
      * 判断指定index位置是否存在itemNode
      * @param index 节点下标
      * @param index 节点下标
@@ -314,6 +316,7 @@ export default class TableView extends cc.Component {
         }
         }
         return false;
         return false;
     }
     }
+
     /**
     /**
      * 移动条目
      * 移动条目
      * 逻辑判断,第一种情况,修改itemArr数组的某个对象,第二种情况实例化一个新itemNode
      * 逻辑判断,第一种情况,修改itemArr数组的某个对象,第二种情况实例化一个新itemNode
@@ -340,6 +343,7 @@ export default class TableView extends cc.Component {
         }
         }
         this.addItemNode(index, y);
         this.addItemNode(index, y);
     }
     }
+
     /**
     /**
      * 得到相关位置的排序index
      * 得到相关位置的排序index
      * 方法待验证,可能有问题
      * 方法待验证,可能有问题
@@ -384,6 +388,7 @@ export default class TableView extends cc.Component {
         }
         }
 
 
     }
     }
+
     /**
     /**
      * 清理条目
      * 清理条目
      */
      */
@@ -398,6 +403,7 @@ export default class TableView extends cc.Component {
             this.itemArr[i].destroy();
             this.itemArr[i].destroy();
         }
         }
     }
     }
+
     /**
     /**
      * 删除指定条目
      * 删除指定条目
      * @param i 节点.index
      * @param i 节点.index
@@ -425,6 +431,7 @@ export default class TableView extends cc.Component {
         if (!this.lastItemIndex) this.getItemIndex();// 初始化时没有初始化此值,会导致为0.不能创建新的item,此处校验
         if (!this.lastItemIndex) this.getItemIndex();// 初始化时没有初始化此值,会导致为0.不能创建新的item,此处校验
         this.itemMoveUp(this.firstItemIndex);//
         this.itemMoveUp(this.firstItemIndex);//
     }
     }
+
     /**
     /**
      * 重置指定item
      * 重置指定item
      * @param index 节点下标
      * @param index 节点下标

+ 21 - 5
mk_framework/assets/script/game/component/tween/FlyNode.ts

@@ -40,13 +40,15 @@ export default class FlyNode extends cc.Component {
     private node_fly: cc.Node = null;
     private node_fly: cc.Node = null;
     /** item容器 */
     /** item容器 */
     private arr_item: Array<cc.Node> = [];
     private arr_item: Array<cc.Node> = [];
+
     onLoad() {
     onLoad() {
         this.node.on('ui-fly-node', this.getNodeProgress, this);
         this.node.on('ui-fly-node', this.getNodeProgress, this);
     }
     }
-    /** 加载 小号图标组 
-     * - 0.8, 1.2范围内随机大小
-     * - -45, 45范围内随机角度
-    */
+
+    /**
+     * 加载 小号图标组 
+     * @param _fly_data 数据内容
+     */
     private getNodeProgress(_fly_data: any) {
     private getNodeProgress(_fly_data: any) {
         // 数据整理node_p, item_sf: cc.SpriteFrame, item_count: number, start_pos: cc.Vec2 = cc.Vec2.ZERO, item_scale: number = 1
         // 数据整理node_p, item_sf: cc.SpriteFrame, item_count: number, start_pos: cc.Vec2 = cc.Vec2.ZERO, item_scale: number = 1
         // this.fly_data = _fly_data;
         // this.fly_data = _fly_data;
@@ -95,7 +97,12 @@ export default class FlyNode extends cc.Component {
             this.movePos(node_item, initPos);
             this.movePos(node_item, initPos);
         }
         }
     }
     }
-    /** 移动到起始位置 */
+
+    /**
+     * 移动到起始位置
+     * @param node_item 
+     * @param initPos 
+     */
     private movePos(node_item, initPos) {
     private movePos(node_item, initPos) {
         let new_start_move_time = this.Range(0.3, 1, false);
         let new_start_move_time = this.Range(0.3, 1, false);
         //this.start_move_time
         //this.start_move_time
@@ -115,6 +122,14 @@ export default class FlyNode extends cc.Component {
         });
         });
         cc.tween(node_item).then(start_pos).then(dt1).then(parallel1).then(call1).start();
         cc.tween(node_item).then(start_pos).then(dt1).then(parallel1).then(call1).start();
     }
     }
+
+    /**
+     * 
+     * @param min 
+     * @param max 
+     * @param isInt 
+     * @returns 
+     */
     private Range(min: number, max: number, isInt: boolean = true): number {
     private Range(min: number, max: number, isInt: boolean = true): number {
         //return min + Math.ceil(Math.random() * 1000) % (max - min);         //不包含最大值
         //return min + Math.ceil(Math.random() * 1000) % (max - min);         //不包含最大值
         let del: number = max - min;
         let del: number = max - min;
@@ -127,6 +142,7 @@ export default class FlyNode extends cc.Component {
         }
         }
         return min;
         return min;
     }
     }
+
     onDestroy() {
     onDestroy() {
         const item_count = this.arr_item.length
         const item_count = this.arr_item.length
         for (let i = 0; i < item_count; i++) {
         for (let i = 0; i < item_count; i++) {