1.修改了视频详情页
Showing
3 changed files
with
61 additions
and
37 deletions
This diff is collapsed.
Click to expand it.
| ... | @@ -31,7 +31,15 @@ cc.Class({ | ... | @@ -31,7 +31,15 @@ cc.Class({ |
| 31 | this._bIsDataListMoving = false; | 31 | this._bIsDataListMoving = false; |
| 32 | this._bInitCategoryListSuccess = false; | 32 | this._bInitCategoryListSuccess = false; |
| 33 | 33 | ||
| 34 | if (this._cApplication.getBackStatus()) { | 34 | let aSceneParameter = this._cApplication.getSceneParameter(); |
| 35 | cc.log("gameDetail->aSceneParameter..." + JSON.stringify(aSceneParameter)); | ||
| 36 | if (aSceneParameter.length) { | ||
| 37 | this._oSceneContext._iCurrentLeftIndex = aSceneParameter[aSceneParameter.length - 1].currentIndex || 0; | ||
| 38 | } else if (aSceneParameter) { | ||
| 39 | this._oSceneContext._iCurrentLeftIndex = aSceneParameter.currentIndex || 0; | ||
| 40 | } | ||
| 41 | |||
| 42 | if (this._cApplication.getBackStatus()) { //返回值放到下方,否则恢复的数据是首页带回来的数值 | ||
| 35 | //恢复上下文 包括 | 43 | //恢复上下文 包括 |
| 36 | //光标位置 focusPath | 44 | //光标位置 focusPath |
| 37 | let oSceneContext = this._cApplication.popSceneContext(); | 45 | let oSceneContext = this._cApplication.popSceneContext(); |
| ... | @@ -41,14 +49,7 @@ cc.Class({ | ... | @@ -41,14 +49,7 @@ cc.Class({ |
| 41 | } | 49 | } |
| 42 | this._cApplication.setBackStatus(false); | 50 | this._cApplication.setBackStatus(false); |
| 43 | } | 51 | } |
| 44 | 52 | cc.log("back status: " + this._oSceneContext._iCurrentLeftIndex); | |
| 45 | let aSceneParameter = this._cApplication.getSceneParameter(); | ||
| 46 | cc.log("gameDetail->aSceneParameter..." + JSON.stringify(aSceneParameter)); | ||
| 47 | if (aSceneParameter.length) { | ||
| 48 | this._oSceneContext._iCurrentLeftIndex = aSceneParameter[aSceneParameter.length - 1].currentIndex || 0; | ||
| 49 | } else if (aSceneParameter) { | ||
| 50 | this._oSceneContext._iCurrentLeftIndex = aSceneParameter.currentIndex || 0; | ||
| 51 | } | ||
| 52 | 53 | ||
| 53 | this._nodeTypeListWrapper = cc.find("TypeListArea/TypeListWrapper", this.node); | 54 | this._nodeTypeListWrapper = cc.find("TypeListArea/TypeListWrapper", this.node); |
| 54 | this._nodeTypeList = cc.find("TypeList", this._nodeTypeListWrapper); | 55 | this._nodeTypeList = cc.find("TypeList", this._nodeTypeListWrapper); | ... | ... |
| ... | @@ -101,14 +101,18 @@ cc.Class({ | ... | @@ -101,14 +101,18 @@ cc.Class({ |
| 101 | if (i >= oJSONResult.resultSet.length) {//数据较少时 | 101 | if (i >= oJSONResult.resultSet.length) {//数据较少时 |
| 102 | continue; | 102 | continue; |
| 103 | } | 103 | } |
| 104 | let nodeEpisodeCell = cc.instantiate(this.PFB_EPISODE); | 104 | let nodeEpisodeCell = cc.find("EpisodeListCell" + i, this._nodeEpisodeList); |
| 105 | nodeEpisodeCell.x = nodeEpisodeCell.width / 2 + (i) * (nodeEpisodeCell.width + 20); | 105 | if (nodeEpisodeCell == null) { |
| 106 | cc.find("EpisodeNum/Text", nodeEpisodeCell).getComponent(cc.Label).string = oJSONResult.resultSet[i].name; | 106 | nodeEpisodeCell = cc.instantiate(this.PFB_EPISODE); |
| 107 | this._nodeEpisodeList.addChild(nodeEpisodeCell, 10, "EpisodeListCell" + i); | 107 | this._nodeEpisodeList.addChild(nodeEpisodeCell, 10, "EpisodeListCell" + i); |
| 108 | |||
| 109 | let fiEpisodeBlock = nodeEpisodeCell.addComponent(FocusInfo); | ||
| 110 | fiEpisodeBlock.init('', true, null, null, 1.0); | ||
| 111 | this._aFocusTargets[0]['episode_list_cell_' + i] = nodeEpisodeCell; | ||
| 112 | } | ||
| 108 | 113 | ||
| 109 | let fiEpisodeBlock = nodeEpisodeCell.addComponent(FocusInfo); | 114 | nodeEpisodeCell.x = nodeEpisodeCell.width / 2 + (i) * (nodeEpisodeCell.width + 12); |
| 110 | fiEpisodeBlock.init('', true, null, null, 1.0); | 115 | cc.find("EpisodeNum/Text", nodeEpisodeCell).getComponent(cc.Label).string = oJSONResult.resultSet[i].name; |
| 111 | this._aFocusTargets[0]['episode_list_cell_' + i] = nodeEpisodeCell; | ||
| 112 | } | 116 | } |
| 113 | 117 | ||
| 114 | if (!this._bIsNaviDataInit) { | 118 | if (!this._bIsNaviDataInit) { |
| ... | @@ -124,6 +128,7 @@ cc.Class({ | ... | @@ -124,6 +128,7 @@ cc.Class({ |
| 124 | }, this, "uuid"); | 128 | }, this, "uuid"); |
| 125 | }, | 129 | }, |
| 126 | 130 | ||
| 131 | //1-20、21-40、41-60 | ||
| 127 | initNaviList: function () { | 132 | initNaviList: function () { |
| 128 | //剧集分类 | 133 | //剧集分类 |
| 129 | let sum = this._oEpisode.count / 20; | 134 | let sum = this._oEpisode.count / 20; |
| ... | @@ -135,21 +140,21 @@ cc.Class({ | ... | @@ -135,21 +140,21 @@ cc.Class({ |
| 135 | continue; | 140 | continue; |
| 136 | } | 141 | } |
| 137 | nodeNaviListCell = cc.instantiate(this.PFB_NAVI); | 142 | nodeNaviListCell = cc.instantiate(this.PFB_NAVI); |
| 138 | nodeNaviListCell.x = nodeNaviListCell.width / 2 + (i - 1) * (nodeNaviListCell.width + 23); | 143 | nodeNaviListCell.x = nodeNaviListCell.width / 2 + (i - 1) * (nodeNaviListCell.width + 12); |
| 139 | i == Math.ceil(sum) ? nodeNaviListCell.getChildByName('Text').getComponent(cc.Label).string = (20 * i - 19) + "-" + this._oEpisode.count | 144 | i == Math.ceil(sum) ? nodeNaviListCell.getChildByName('Text').getComponent(cc.Label).string = (20 * i - 19) + "-" + this._oEpisode.count |
| 140 | : nodeNaviListCell.getChildByName('Text').getComponent(cc.Label).string = (20 * i - 19) + "-" + 20 * i;//TODO:最后显示应该是41-52而不是41-60 | 145 | : nodeNaviListCell.getChildByName('Text').getComponent(cc.Label).string = (20 * i - 19) + "-" + 20 * i;//TODO:最后显示应该是41-52而不是41-60 |
| 141 | this._nodeNaviList.addChild(nodeNaviListCell, 10, "NaviListCell" + i); | 146 | this._nodeNaviList.addChild(nodeNaviListCell, 10, "NaviListCell" + i); |
| 142 | cc.loader.loadRes('VideoDetail/navi_bg', cc.Texture2D, function (err, texture) { | 147 | // cc.loader.loadRes('VideoDetail/navi_bg', cc.Texture2D, function (err, texture) { |
| 143 | let spriteFrame = new cc.SpriteFrame(); | 148 | // let spriteFrame = new cc.SpriteFrame(); |
| 144 | if (i == 1) { | 149 | // if (i == 1) { |
| 145 | cc.find('Text', nodeNaviListCell).color = new cc.Color(112, 69, 61); | 150 | // cc.find('Text', nodeNaviListCell).color = new cc.Color(112, 69, 61); |
| 146 | spriteFrame.setTexture(texture, cc.rect(0, 42, 110, 42)); | 151 | // spriteFrame.setTexture(texture, cc.rect(0, 42, 110, 42)); |
| 147 | } else { | 152 | // } else { |
| 148 | spriteFrame.setTexture(texture, cc.rect(0, 0, 110, 42)); | 153 | // spriteFrame.setTexture(texture, cc.rect(0, 0, 110, 42)); |
| 149 | } | 154 | // } |
| 150 | nodeNaviListCell.getChildByName('Bg').getComponent(cc.Sprite).spriteFrame = spriteFrame; | 155 | // nodeNaviListCell.getChildByName('Bg').getComponent(cc.Sprite).spriteFrame = spriteFrame; |
| 151 | spriteFrame._calculateUV(); | 156 | // spriteFrame._calculateUV(); |
| 152 | }); | 157 | // }); |
| 153 | //准备焦点坐标 | 158 | //准备焦点坐标 |
| 154 | let fiNaviBlock = nodeNaviListCell.addComponent(FocusInfo); | 159 | let fiNaviBlock = nodeNaviListCell.addComponent(FocusInfo); |
| 155 | fiNaviBlock.init('', true, null, null, 1.0); | 160 | fiNaviBlock.init('', true, null, null, 1.0); |
| ... | @@ -308,7 +313,7 @@ cc.Class({ | ... | @@ -308,7 +313,7 @@ cc.Class({ |
| 308 | } | 313 | } |
| 309 | 314 | ||
| 310 | if (fiFocusTarget && 0 == fiFocusTarget.node.name.indexOf("EpisodeListCell")) { | 315 | if (fiFocusTarget && 0 == fiFocusTarget.node.name.indexOf("EpisodeListCell")) { |
| 311 | if (fiFocusTarget.node.x - fiFocusTarget.node.width / 2 + this._nodeEpisodeList.x >= this._nodeEpisodeListWrapper.width) { | 316 | if (fiFocusTarget.node.x + fiFocusTarget.node.width / 2 + this._nodeEpisodeList.x >= this._nodeEpisodeListWrapper.width) { |
| 312 | oScrollParameter = this._nodeEpisodeList.getComponent(TVScrollParameter); | 317 | oScrollParameter = this._nodeEpisodeList.getComponent(TVScrollParameter); |
| 313 | oScrollParameter.setHasRelation(true); | 318 | oScrollParameter.setHasRelation(true); |
| 314 | oScrollParameter.setStep((fiFocusTarget.node.x + fiFocusTarget.node.width / 2 + this._nodeEpisodeList.x) - this._nodeEpisodeListWrapper.width + 20); | 319 | oScrollParameter.setStep((fiFocusTarget.node.x + fiFocusTarget.node.width / 2 + this._nodeEpisodeList.x) - this._nodeEpisodeListWrapper.width + 20); |
| ... | @@ -318,7 +323,7 @@ cc.Class({ | ... | @@ -318,7 +323,7 @@ cc.Class({ |
| 318 | if (fiFocusTarget.node.x + this._nodeEpisodeList.x < 0) { | 323 | if (fiFocusTarget.node.x + this._nodeEpisodeList.x < 0) { |
| 319 | oScrollParameter = this._nodeEpisodeList.getComponent(TVScrollParameter); | 324 | oScrollParameter = this._nodeEpisodeList.getComponent(TVScrollParameter); |
| 320 | oScrollParameter.setHasRelation(true); | 325 | oScrollParameter.setHasRelation(true); |
| 321 | oScrollParameter.setStep(-fiFocusTarget.node.x + fiFocusTarget.node.width / 2 - this._nodeEpisodeList.x + 16); | 326 | oScrollParameter.setStep(-fiFocusTarget.node.x + fiFocusTarget.node.width / 2 - this._nodeEpisodeList.x); |
| 322 | oScrollParameter.setTargetPosition(this._nodeEpisodeList.x + oScrollParameter.getStep()) | 327 | oScrollParameter.setTargetPosition(this._nodeEpisodeList.x + oScrollParameter.getStep()) |
| 323 | // this._oSceneContext._nodeNaviListX = this._nodeEpisodeList.x + oScrollParameter.getStep(); | 328 | // this._oSceneContext._nodeNaviListX = this._nodeEpisodeList.x + oScrollParameter.getStep(); |
| 324 | } | 329 | } |
| ... | @@ -417,11 +422,20 @@ cc.Class({ | ... | @@ -417,11 +422,20 @@ cc.Class({ |
| 417 | if (0 == fiFrom.node.getName().indexOf('NaviListCell') && 0 == fiTo.node.getName().indexOf('NaviListCell')) { //剧集分类1-20.21-40... | 422 | if (0 == fiFrom.node.getName().indexOf('NaviListCell') && 0 == fiTo.node.getName().indexOf('NaviListCell')) { //剧集分类1-20.21-40... |
| 418 | cc.find('Text', fiFrom.node).color = new cc.Color(255, 255, 255); | 423 | cc.find('Text', fiFrom.node).color = new cc.Color(255, 255, 255); |
| 419 | // fiFrom.node.getChildByName('Bg').getComponent(cc.Sprite).spriteFrame.setRect(cc.rect(0, 0, fiFrom.node.getChildByName('Bg').width, fiFrom.node.getChildByName('Bg').height)); | 424 | // fiFrom.node.getChildByName('Bg').getComponent(cc.Sprite).spriteFrame.setRect(cc.rect(0, 0, fiFrom.node.getChildByName('Bg').width, fiFrom.node.getChildByName('Bg').height)); |
| 420 | cc.loader.loadRes('VideoDetail/navi_bg', cc.Texture2D, function (err, texture) { | 425 | // cc.loader.loadRes('VideoDetail/navi_bg', cc.Texture2D, function (err, texture) { |
| 421 | fiFrom.node.getChildByName('Bg').getComponent(cc.Sprite).spriteFrame = new cc.SpriteFrame(texture, cc.rect(0, 0, fiFrom.node.getChildByName('Bg').width, fiFrom.node.getChildByName('Bg').height)); | 426 | // fiFrom.node.getChildByName('Bg').getComponent(cc.Sprite).spriteFrame = new cc.SpriteFrame(texture, cc.rect(0, 0, fiFrom.node.getChildByName('Bg').width, fiFrom.node.getChildByName('Bg').height)); |
| 422 | }); | 427 | // }); |
| 423 | } | 428 | } |
| 424 | 429 | ||
| 430 | // if (0 == fiFrom.node.getName().indexOf('EpisodeListCell')) { //剧集分类1-20.21-40... | ||
| 431 | // fiFrom.node.width = 104; | ||
| 432 | // // cc.find('Text', fiTo.node).color = new cc.Color(255, 204, 1); | ||
| 433 | // // fiTo.node.getChildByName('Bg').getComponent(cc.Sprite).spriteFrame.setRect(cc.rect(0, fiTo.node.getChildByName('Bg').height, fiTo.node.getChildByName('Bg').width, fiTo.node.getChildByName('Bg').height)); | ||
| 434 | // // cc.loader.loadRes('VideoDetail/navi_bg', cc.Texture2D, function (err, texture) { | ||
| 435 | // // fiTo.node.getChildByName('Bg').getComponent(cc.Sprite).spriteFrame = new cc.SpriteFrame(texture, cc.rect(0, fiTo.node.getChildByName('Bg').height, fiTo.node.getChildByName('Bg').width, fiTo.node.getChildByName('Bg').height)); | ||
| 436 | // // }); | ||
| 437 | // } | ||
| 438 | |||
| 425 | }, | 439 | }, |
| 426 | 440 | ||
| 427 | onAfterFocusChange: function (event) { | 441 | onAfterFocusChange: function (event) { |
| ... | @@ -456,16 +470,25 @@ cc.Class({ | ... | @@ -456,16 +470,25 @@ cc.Class({ |
| 456 | 470 | ||
| 457 | this._oSceneContext.currentPage = 1; //页面恢复 | 471 | this._oSceneContext.currentPage = 1; //页面恢复 |
| 458 | 472 | ||
| 459 | cc.find('Text', fiTo.node).color = new cc.Color(112, 69, 61); | 473 | cc.find('Text', fiTo.node).color = new cc.Color(255, 204, 1); |
| 460 | // fiTo.node.getChildByName('Bg').getComponent(cc.Sprite).spriteFrame.setRect(cc.rect(0, fiTo.node.getChildByName('Bg').height, fiTo.node.getChildByName('Bg').width, fiTo.node.getChildByName('Bg').height)); | 474 | // fiTo.node.getChildByName('Bg').getComponent(cc.Sprite).spriteFrame.setRect(cc.rect(0, fiTo.node.getChildByName('Bg').height, fiTo.node.getChildByName('Bg').width, fiTo.node.getChildByName('Bg').height)); |
| 461 | cc.loader.loadRes('VideoDetail/navi_bg', cc.Texture2D, function (err, texture) { | 475 | // cc.loader.loadRes('VideoDetail/navi_bg', cc.Texture2D, function (err, texture) { |
| 462 | fiTo.node.getChildByName('Bg').getComponent(cc.Sprite).spriteFrame = new cc.SpriteFrame(texture, cc.rect(0, fiTo.node.getChildByName('Bg').height, fiTo.node.getChildByName('Bg').width, fiTo.node.getChildByName('Bg').height)); | 476 | // fiTo.node.getChildByName('Bg').getComponent(cc.Sprite).spriteFrame = new cc.SpriteFrame(texture, cc.rect(0, fiTo.node.getChildByName('Bg').height, fiTo.node.getChildByName('Bg').width, fiTo.node.getChildByName('Bg').height)); |
| 463 | }); | 477 | // }); |
| 464 | let index = fiTo.node.name.replace('NaviListCell', ''); | 478 | let index = fiTo.node.name.replace('NaviListCell', ''); |
| 465 | this._iCurrentNaviNumLoc = index; | 479 | this._iCurrentNaviNumLoc = index; |
| 466 | this._oSceneContext.requestedStart = index * 20 - 20; | 480 | this._oSceneContext.requestedStart = index * 20 - 20; |
| 467 | this.getGatherDetailList(); | 481 | this.getGatherDetailList(); |
| 468 | } | 482 | } |
| 483 | |||
| 484 | // if (0 == fiTo.node.getName().indexOf('EpisodeListCell')) { //剧集分类1-20.21-40... | ||
| 485 | // fiTo.node.width = 378; | ||
| 486 | // // cc.find('Text', fiTo.node).color = new cc.Color(255, 204, 1); | ||
| 487 | // // fiTo.node.getChildByName('Bg').getComponent(cc.Sprite).spriteFrame.setRect(cc.rect(0, fiTo.node.getChildByName('Bg').height, fiTo.node.getChildByName('Bg').width, fiTo.node.getChildByName('Bg').height)); | ||
| 488 | // // cc.loader.loadRes('VideoDetail/navi_bg', cc.Texture2D, function (err, texture) { | ||
| 489 | // // fiTo.node.getChildByName('Bg').getComponent(cc.Sprite).spriteFrame = new cc.SpriteFrame(texture, cc.rect(0, fiTo.node.getChildByName('Bg').height, fiTo.node.getChildByName('Bg').width, fiTo.node.getChildByName('Bg').height)); | ||
| 490 | // // }); | ||
| 491 | // } | ||
| 469 | }, | 492 | }, |
| 470 | 493 | ||
| 471 | doCurrentFocusTVLinkAction: function (strAction) { | 494 | doCurrentFocusTVLinkAction: function (strAction) { | ... | ... |
-
Please register or sign in to post a comment