Laya 实现带有子菜单的List之母项子项通用

Laya 用List实现二级菜单之母项子项通用

@ixenos 2020-11-02 12:20:53

 

气死我了,上才艺

 1         private function listCateToggle(index:int):void{
 2             var dat:* = lui.listCate.getItem(index);
 3             if(dat){
 4                 var allArr:Array = lui.listCate.array;
 5                 if(dat["open"]){
 6                     dat["open"] = false;
 7                     var clearBuffer:Array = [];
 8                     for (var k:int = 0; k < allArr.length; k++) {
 9                         var aDat:* = allArr[k];
10                         if(aDat["open_parent"]==dat){
11                             clearBuffer.push(aDat);
12                         }
13                     }
14                     allArr.splice(index+1,clearBuffer.length);
15                     lui.listCate.array = allArr;
16                 }else{
17                     var lo:StageChapterSettingLO = dat;
18                     if(lo){
19                         var sloArr:Array = StageData.ins.getChapterStageLOs(lo.id);
20                         if(sloArr && sloArr.length>0){
21                             //数据处理,将其三等分成二维数组
22                             var dvide:int = Math.ceil(sloArr.length/3);
23                             var fragsArr:Array = [];
24                             for (var i:int = 0; i < dvide; i++) {
25                                 var frags:Array = [];
26                                 for (var j:int = i*3; j < i*3+3; j++) {
27                                     if(sloArr[j]){
28                                         frags.push(sloArr[j]);
29                                     }
30                                 }
31                                 frags["open_parent"] = dat;
32                                 fragsArr[i] = frags;
33                             }
34                             
35                             dat["open"] = true;
36                             var param:Array = [index+1,0].concat(fragsArr);
37                             allArr.splice.apply(allArr, param);
38                             lui.listCate.array = allArr;
39                         }
40                     }
41                 }
42             }
43         }

EGM EGM EGM ...

 

上一篇:无需密码卸载360天擎


下一篇:[BSidesSF2019]diskimage