complete sceneCategory
Showing
1 changed file
with
50 additions
and
21 deletions
| ... | @@ -361,7 +361,7 @@ cc.Class({ | ... | @@ -361,7 +361,7 @@ cc.Class({ |
| 361 | // 'parentId': this._oInit.aNavList[this._oSceneContext.iNaviIndex].parentId, //废弃使用该字段,筛选所有带有“基础分类”的结果 | 361 | // 'parentId': this._oInit.aNavList[this._oSceneContext.iNaviIndex].parentId, //废弃使用该字段,筛选所有带有“基础分类”的结果 |
| 362 | "sortField": "sequence", | 362 | "sortField": "sequence", |
| 363 | "sortDirection": "asc", | 363 | "sortDirection": "asc", |
| 364 | "parentId": this._oInit.aNavList[this._oSceneContext.iNaviIndex].id, | 364 | "parentId": this._oInit.aNavList[this._oSceneContext.iNaviIndex].id, // |
| 365 | 'token': Common.TEST_API_TOKEN_EDU, | 365 | 'token': Common.TEST_API_TOKEN_EDU, |
| 366 | }; | 366 | }; |
| 367 | Network.ajax("GET", Common.TOPDRAW_API_SERVER_EDU + "Category/ListByParent", null, oCatgoryListParas, | 367 | Network.ajax("GET", Common.TOPDRAW_API_SERVER_EDU + "Category/ListByParent", null, oCatgoryListParas, |
| ... | @@ -426,6 +426,7 @@ cc.Class({ | ... | @@ -426,6 +426,7 @@ cc.Class({ |
| 426 | 426 | ||
| 427 | //ture时渲染节目出来,需要两个值iRequestPageIndex,iCurrentActiveIndex | 427 | //ture时渲染节目出来,需要两个值iRequestPageIndex,iCurrentActiveIndex |
| 428 | updateCatPage: function (flag) { | 428 | updateCatPage: function (flag) { |
| 429 | var self = this; | ||
| 429 | this._nodeTypeList.y = 0; //每次初始化typeList,先推上去,如果回退回来的界面会有其他变量恢复它 | 430 | this._nodeTypeList.y = 0; //每次初始化typeList,先推上去,如果回退回来的界面会有其他变量恢复它 |
| 430 | //先释放以前数据 | 431 | //先释放以前数据 |
| 431 | // this._nodeTypeList.removeAllChildren(); //内存泄漏 | 432 | // this._nodeTypeList.removeAllChildren(); //内存泄漏 |
| ... | @@ -433,6 +434,7 @@ cc.Class({ | ... | @@ -433,6 +434,7 @@ cc.Class({ |
| 433 | //------------------------ | 434 | //------------------------ |
| 434 | for (let i = 0; i < this._nodeTypeList.childrenCount; i++) { | 435 | for (let i = 0; i < this._nodeTypeList.childrenCount; i++) { |
| 435 | this._nodeTypeList.children[i].active = false; | 436 | this._nodeTypeList.children[i].active = false; |
| 437 | // cc.log("子节点名称:"+this._nodeTypeList.children[i].name); | ||
| 436 | } | 438 | } |
| 437 | //------------------------ | 439 | //------------------------ |
| 438 | 440 | ||
| ... | @@ -443,6 +445,7 @@ cc.Class({ | ... | @@ -443,6 +445,7 @@ cc.Class({ |
| 443 | let id = this._oInit.oCatList[this._oInit.aNavList[this._oSceneContext.iNaviIndex].id][i].cId; | 445 | let id = this._oInit.oCatList[this._oInit.aNavList[this._oSceneContext.iNaviIndex].id][i].cId; |
| 444 | let nodeTypeListCell = cc.find("TypeListCell_" + id + "_" + i, this._nodeTypeList); | 446 | let nodeTypeListCell = cc.find("TypeListCell_" + id + "_" + i, this._nodeTypeList); |
| 445 | if (!nodeTypeListCell) { | 447 | if (!nodeTypeListCell) { |
| 448 | // cc.log("造新节点"); | ||
| 446 | nodeTypeListCell = cc.instantiate(this.PFB_TYPE); | 449 | nodeTypeListCell = cc.instantiate(this.PFB_TYPE); |
| 447 | nodeTypeListCell.y = -nodeTypeListCell.height / 2 - i * (nodeTypeListCell.height); | 450 | nodeTypeListCell.y = -nodeTypeListCell.height / 2 - i * (nodeTypeListCell.height); |
| 448 | this._nodeTypeList.addChild(nodeTypeListCell, 10, "TypeListCell_" + id + "_" + i); | 451 | this._nodeTypeList.addChild(nodeTypeListCell, 10, "TypeListCell_" + id + "_" + i); |
| ... | @@ -452,6 +455,8 @@ cc.Class({ | ... | @@ -452,6 +455,8 @@ cc.Class({ |
| 452 | this._aFocusTargets[0]['type_list_cell_' + id] = nodeTypeListCell; | 455 | this._aFocusTargets[0]['type_list_cell_' + id] = nodeTypeListCell; |
| 453 | } | 456 | } |
| 454 | nodeTypeListCell.active = true; | 457 | nodeTypeListCell.active = true; |
| 458 | // cc.log("nodeTypeListCell位置:"+nodeTypeListCell.position); // | ||
| 459 | // cc.log("nodeTypeList: "+this._nodeTypeList.active); | ||
| 455 | 460 | ||
| 456 | // nodeTypeListCell.getComponent('pfbCategoryTypeCell').init(this._oInit.oCatList[this._oInit.aNavList[this._oSceneContext.iNaviIndex].id][i], null); | 461 | // nodeTypeListCell.getComponent('pfbCategoryTypeCell').init(this._oInit.oCatList[this._oInit.aNavList[this._oSceneContext.iNaviIndex].id][i], null); |
| 457 | // cc.log("/////"+this._oInit.oCatList[this._oInit.aNavList[this._oSceneContext.iNaviIndex].id][i]); | 462 | // cc.log("/////"+this._oInit.oCatList[this._oInit.aNavList[this._oSceneContext.iNaviIndex].id][i]); |
| ... | @@ -464,32 +469,55 @@ cc.Class({ | ... | @@ -464,32 +469,55 @@ cc.Class({ |
| 464 | // cc.log("inittype------------------>" + this._oSceneContext.iTypeIndex); | 469 | // cc.log("inittype------------------>" + this._oSceneContext.iTypeIndex); |
| 465 | if (i == this._oSceneContext.iTypeIndex) { //默认第一个Type为选中状态 | 470 | if (i == this._oSceneContext.iTypeIndex) { //默认第一个Type为选中状态 |
| 466 | this._oSceneContext.iTypeId = id; | 471 | this._oSceneContext.iTypeId = id; |
| 467 | Network.loadImageInNativeRuntime( | 472 | //这种方式加载远程图片有问题 ,切换Type导航时不能显示图片 |
| 468 | Common.TOPDRAW_IMAGE_SERVER_EDU_RIGHT + this._oInit.oCatList[this._oInit.aNavList[this._oSceneContext.iNaviIndex].id][i].imgSrc, | 473 | // Network.loadImageInNativeRuntime( |
| 469 | function (texture) { | 474 | // Common.TOPDRAW_IMAGE_SERVER_EDU_RIGHT + this._oInit.oCatList[this._oInit.aNavList[this._oSceneContext.iNaviIndex].id][i].imgSrc, |
| 475 | // function (texture) { | ||
| 476 | // cc.find('Bg', nodeTypeListCell).getComponent(cc.Sprite).spriteFrame = new cc.SpriteFrame(texture, cc.rect(0, height, width, height)); | ||
| 477 | // count--; | ||
| 478 | // if (!count) { //可能为最后一个!!! | ||
| 479 | // self._bInitTypeSuccess = true; | ||
| 480 | // self.checkDataReadyAndInitFocus(); //弄焦点 | ||
| 481 | // } | ||
| 482 | // }, null, this | ||
| 483 | // ); | ||
| 484 | cc.loader.load(Common.TOPDRAW_IMAGE_SERVER_EDU_RIGHT + this._oInit.oCatList[this._oInit.aNavList[this._oSceneContext.iNaviIndex].id][i].imgSrc, | ||
| 485 | function (err, texture) { | ||
| 470 | cc.find('Bg', nodeTypeListCell).getComponent(cc.Sprite).spriteFrame = new cc.SpriteFrame(texture, cc.rect(0, height, width, height)); | 486 | cc.find('Bg', nodeTypeListCell).getComponent(cc.Sprite).spriteFrame = new cc.SpriteFrame(texture, cc.rect(0, height, width, height)); |
| 471 | count--; | 487 | count--; |
| 472 | if (!count) { //可能为最后一个!!! | 488 | if (!count) { //可能为最后一个!!! |
| 473 | self._bInitTypeSuccess = true; | 489 | self._bInitTypeSuccess = true; |
| 474 | self.checkDataReadyAndInitFocus(); //弄焦点 | 490 | self.checkDataReadyAndInitFocus(); //弄焦点 |
| 475 | } | 491 | } |
| 476 | }, null, this | 492 | }); |
| 477 | ); | ||
| 478 | } else { | 493 | } else { |
| 479 | var self = this; | 494 | var self = this; |
| 480 | Network.loadImageInNativeRuntime( | 495 | // cc.log("type list "+(Common.TOPDRAW_IMAGE_SERVER_EDU_RIGHT + this._oInit.oCatList[this._oInit.aNavList[this._oSceneContext.iNaviIndex].id][i].imgSrc)); |
| 481 | Common.TOPDRAW_IMAGE_SERVER_EDU_RIGHT + this._oInit.oCatList[this._oInit.aNavList[this._oSceneContext.iNaviIndex].id][i].imgSrc, | 496 | // Network.loadImageInNativeRuntime( |
| 482 | function (texture) { | 497 | // Common.TOPDRAW_IMAGE_SERVER_EDU_RIGHT + this._oInit.oCatList[this._oInit.aNavList[this._oSceneContext.iNaviIndex].id][i].imgSrc, |
| 498 | // function (texture) { | ||
| 499 | // cc.find('Bg', nodeTypeListCell).getComponent(cc.Sprite).spriteFrame = new cc.SpriteFrame(texture, cc.rect(0, 0, width, height)); | ||
| 500 | // count--; | ||
| 501 | // // cc.log("InitType-------------------->" + count); | ||
| 502 | // if (!count) { | ||
| 503 | // self._bInitTypeSuccess = true; | ||
| 504 | // self.checkDataReadyAndInitFocus(); //弄焦点 | ||
| 505 | // } | ||
| 506 | // }, null, this | ||
| 507 | // ); | ||
| 508 | |||
| 509 | cc.loader.load(Common.TOPDRAW_IMAGE_SERVER_EDU_RIGHT + this._oInit.oCatList[this._oInit.aNavList[this._oSceneContext.iNaviIndex].id][i].imgSrc, | ||
| 510 | function (err, texture) { | ||
| 483 | cc.find('Bg', nodeTypeListCell).getComponent(cc.Sprite).spriteFrame = new cc.SpriteFrame(texture, cc.rect(0, 0, width, height)); | 511 | cc.find('Bg', nodeTypeListCell).getComponent(cc.Sprite).spriteFrame = new cc.SpriteFrame(texture, cc.rect(0, 0, width, height)); |
| 484 | count--; | 512 | count--; |
| 485 | // cc.log("InitType-------------------->" + count); | 513 | if (!count) { //可能为最后一个!!! |
| 486 | if (!count) { | ||
| 487 | self._bInitTypeSuccess = true; | 514 | self._bInitTypeSuccess = true; |
| 488 | self.checkDataReadyAndInitFocus(); //弄焦点 | 515 | self.checkDataReadyAndInitFocus(); //弄焦点 |
| 489 | } | 516 | } |
| 490 | }, null, this | 517 | }); |
| 491 | ); | 518 | |
| 492 | } | 519 | } |
| 520 | // cc.log("nodeTypeListCell位置:"+nodeTypeListCell.position); | ||
| 493 | } | 521 | } |
| 494 | 522 | ||
| 495 | } | 523 | } |
| ... | @@ -756,12 +784,12 @@ cc.Class({ | ... | @@ -756,12 +784,12 @@ cc.Class({ |
| 756 | aCheckResult = this.checkFocusTarget(fiFocusTarget, oScrollParameter); | 784 | aCheckResult = this.checkFocusTarget(fiFocusTarget, oScrollParameter); |
| 757 | fiFocusTarget = aCheckResult[0]; | 785 | fiFocusTarget = aCheckResult[0]; |
| 758 | oScrollParameter = aCheckResult[1]; | 786 | oScrollParameter = aCheckResult[1]; |
| 759 | if (0 == this._fiCurrentFocus.node.name.indexOf("NaviCell") && 0 != fiFocusTarget.node.name.indexOf("NaviCell")) { | 787 | // if (0 == this._fiCurrentFocus.node.name.indexOf("NaviCell") && 0 != fiFocusTarget.node.name.indexOf("NaviCell")) { |
| 760 | if (this._bInitTypeSuccess != undefined && !this._bInitTypeSuccess) return; //type和promotion未初始完成不允许跳转(回退界面不会初始化this._bInitRighjtPromotionSuccess) | 788 | // if (this._bInitTypeSuccess != undefined && !this._bInitTypeSuccess) return; //type和promotion未初始完成不允许跳转(回退界面不会初始化this._bInitRighjtPromotionSuccess) |
| 761 | if (this._bInitRightPromotionSuccess != undefined && !this._bInitRightPromotionSuccess) return; | 789 | // if (this._bInitRightPromotionSuccess != undefined && !this._bInitRightPromotionSuccess) return; |
| 762 | if (this._bInitCategoryListSuccess != undefined && !this._bInitCategoryListSuccess) return; | 790 | // if (this._bInitCategoryListSuccess != undefined && !this._bInitCategoryListSuccess) return; |
| 763 | } | 791 | // } |
| 764 | 792 | cc.log("flyFocus....."); | |
| 765 | this.scheduleOnce(() => { //指定0让回调函数在下一帧立即执行(推荐位初始化图片后,需等待下一帧操作) | 793 | this.scheduleOnce(() => { //指定0让回调函数在下一帧立即执行(推荐位初始化图片后,需等待下一帧操作) |
| 766 | this._cFocus.flyFocus(this._fiCurrentFocus, fiFocusTarget, Direct, null, oScrollParameter); | 794 | this._cFocus.flyFocus(this._fiCurrentFocus, fiFocusTarget, Direct, null, oScrollParameter); |
| 767 | }, 0); | 795 | }, 0); |
| ... | @@ -944,7 +972,7 @@ cc.Class({ | ... | @@ -944,7 +972,7 @@ cc.Class({ |
| 944 | // fiFrom.node.getChildByName("Bg").getComponent(cc.Sprite).spriteFrame = new cc.SpriteFrame(texture, cc.rect(0, 0, fiFrom.node.width, fiFrom.node.height)); | 972 | // fiFrom.node.getChildByName("Bg").getComponent(cc.Sprite).spriteFrame = new cc.SpriteFrame(texture, cc.rect(0, 0, fiFrom.node.width, fiFrom.node.height)); |
| 945 | // }, null, this | 973 | // }, null, this |
| 946 | // ); | 974 | // ); |
| 947 | cc.loader.load(Common.TOPDRAW_IMAGE_SERVER + this._oInit.oCatList[this._oInit.aNavList[this._oSceneContext.iNaviIndex].id][this._oSceneContext.iTypeIndex].imgSrc, function (err, texture) { | 975 | cc.loader.load(Common.TOPDRAW_IMAGE_SERVER_EDU_RIGHT + this._oInit.oCatList[this._oInit.aNavList[this._oSceneContext.iNaviIndex].id][this._oSceneContext.iTypeIndex].imgSrc, function (err, texture) { |
| 948 | fiFrom.node.getChildByName("Bg").getComponent(cc.Sprite).spriteFrame = new cc.SpriteFrame(texture, cc.rect(0, 0, fiFrom.node.width, fiFrom.node.height)); | 976 | fiFrom.node.getChildByName("Bg").getComponent(cc.Sprite).spriteFrame = new cc.SpriteFrame(texture, cc.rect(0, 0, fiFrom.node.width, fiFrom.node.height)); |
| 949 | }); | 977 | }); |
| 950 | } | 978 | } |
| ... | @@ -985,7 +1013,8 @@ cc.Class({ | ... | @@ -985,7 +1013,8 @@ cc.Class({ |
| 985 | // fiTo.node.getChildByName("Bg").getComponent(cc.Sprite).spriteFrame = new cc.SpriteFrame(texture, cc.rect(0, fiTo.node.height, fiTo.node.width, fiTo.node.height)); | 1013 | // fiTo.node.getChildByName("Bg").getComponent(cc.Sprite).spriteFrame = new cc.SpriteFrame(texture, cc.rect(0, fiTo.node.height, fiTo.node.width, fiTo.node.height)); |
| 986 | // }, null, this | 1014 | // }, null, this |
| 987 | // ); | 1015 | // ); |
| 988 | cc.loader.load(Common.TOPDRAW_IMAGE_SERVER + this._oInit.oCatList[this._oInit.aNavList[this._oSceneContext.iNaviIndex].id][this._oSceneContext.iTypeIndex].imgSrc, function (err, texture) { | 1016 | // cc.log("切换后加载图片:"+(Common.TOPDRAW_IMAGE_SERVER + this._oInit.oCatList[this._oInit.aNavList[this._oSceneContext.iNaviIndex].id][this._oSceneContext.iTypeIndex].imgSrc)); |
| 1017 | cc.loader.load(Common.TOPDRAW_IMAGE_SERVER_EDU_RIGHT + this._oInit.oCatList[this._oInit.aNavList[this._oSceneContext.iNaviIndex].id][this._oSceneContext.iTypeIndex].imgSrc, function (err, texture) { | ||
| 989 | fiTo.node.getChildByName("Bg").getComponent(cc.Sprite).spriteFrame = new cc.SpriteFrame(texture, cc.rect(0, fiTo.node.height, fiTo.node.width, fiTo.node.height)); | 1018 | fiTo.node.getChildByName("Bg").getComponent(cc.Sprite).spriteFrame = new cc.SpriteFrame(texture, cc.rect(0, fiTo.node.height, fiTo.node.width, fiTo.node.height)); |
| 990 | }); | 1019 | }); |
| 991 | } | 1020 | } | ... | ... |
-
Please register or sign in to post a comment