Commit 31fc8e35 31fc8e35e144fb6e411b78bb7125df9955ce5089 by 金学艇

1.修改了视频详情页

1 parent 12218b03
......@@ -31,7 +31,15 @@ cc.Class({
this._bIsDataListMoving = false;
this._bInitCategoryListSuccess = false;
if (this._cApplication.getBackStatus()) {
let aSceneParameter = this._cApplication.getSceneParameter();
cc.log("gameDetail->aSceneParameter..." + JSON.stringify(aSceneParameter));
if (aSceneParameter.length) {
this._oSceneContext._iCurrentLeftIndex = aSceneParameter[aSceneParameter.length - 1].currentIndex || 0;
} else if (aSceneParameter) {
this._oSceneContext._iCurrentLeftIndex = aSceneParameter.currentIndex || 0;
}
if (this._cApplication.getBackStatus()) { //返回值放到下方,否则恢复的数据是首页带回来的数值
//恢复上下文 包括
//光标位置 focusPath
let oSceneContext = this._cApplication.popSceneContext();
......@@ -41,14 +49,7 @@ cc.Class({
}
this._cApplication.setBackStatus(false);
}
let aSceneParameter = this._cApplication.getSceneParameter();
cc.log("gameDetail->aSceneParameter..." + JSON.stringify(aSceneParameter));
if (aSceneParameter.length) {
this._oSceneContext._iCurrentLeftIndex = aSceneParameter[aSceneParameter.length - 1].currentIndex || 0;
} else if (aSceneParameter) {
this._oSceneContext._iCurrentLeftIndex = aSceneParameter.currentIndex || 0;
}
cc.log("back status: " + this._oSceneContext._iCurrentLeftIndex);
this._nodeTypeListWrapper = cc.find("TypeListArea/TypeListWrapper", this.node);
this._nodeTypeList = cc.find("TypeList", this._nodeTypeListWrapper);
......
......@@ -101,14 +101,18 @@ cc.Class({
if (i >= oJSONResult.resultSet.length) {//数据较少时
continue;
}
let nodeEpisodeCell = cc.instantiate(this.PFB_EPISODE);
nodeEpisodeCell.x = nodeEpisodeCell.width / 2 + (i) * (nodeEpisodeCell.width + 20);
cc.find("EpisodeNum/Text", nodeEpisodeCell).getComponent(cc.Label).string = oJSONResult.resultSet[i].name;
this._nodeEpisodeList.addChild(nodeEpisodeCell, 10, "EpisodeListCell" + i);
let nodeEpisodeCell = cc.find("EpisodeListCell" + i, this._nodeEpisodeList);
if (nodeEpisodeCell == null) {
nodeEpisodeCell = cc.instantiate(this.PFB_EPISODE);
this._nodeEpisodeList.addChild(nodeEpisodeCell, 10, "EpisodeListCell" + i);
let fiEpisodeBlock = nodeEpisodeCell.addComponent(FocusInfo);
fiEpisodeBlock.init('', true, null, null, 1.0);
this._aFocusTargets[0]['episode_list_cell_' + i] = nodeEpisodeCell;
}
let fiEpisodeBlock = nodeEpisodeCell.addComponent(FocusInfo);
fiEpisodeBlock.init('', true, null, null, 1.0);
this._aFocusTargets[0]['episode_list_cell_' + i] = nodeEpisodeCell;
nodeEpisodeCell.x = nodeEpisodeCell.width / 2 + (i) * (nodeEpisodeCell.width + 12);
cc.find("EpisodeNum/Text", nodeEpisodeCell).getComponent(cc.Label).string = oJSONResult.resultSet[i].name;
}
if (!this._bIsNaviDataInit) {
......@@ -124,6 +128,7 @@ cc.Class({
}, this, "uuid");
},
//1-20、21-40、41-60
initNaviList: function () {
//剧集分类
let sum = this._oEpisode.count / 20;
......@@ -135,21 +140,21 @@ cc.Class({
continue;
}
nodeNaviListCell = cc.instantiate(this.PFB_NAVI);
nodeNaviListCell.x = nodeNaviListCell.width / 2 + (i - 1) * (nodeNaviListCell.width + 23);
nodeNaviListCell.x = nodeNaviListCell.width / 2 + (i - 1) * (nodeNaviListCell.width + 12);
i == Math.ceil(sum) ? nodeNaviListCell.getChildByName('Text').getComponent(cc.Label).string = (20 * i - 19) + "-" + this._oEpisode.count
: nodeNaviListCell.getChildByName('Text').getComponent(cc.Label).string = (20 * i - 19) + "-" + 20 * i;//TODO:最后显示应该是41-52而不是41-60
this._nodeNaviList.addChild(nodeNaviListCell, 10, "NaviListCell" + i);
cc.loader.loadRes('VideoDetail/navi_bg', cc.Texture2D, function (err, texture) {
let spriteFrame = new cc.SpriteFrame();
if (i == 1) {
cc.find('Text', nodeNaviListCell).color = new cc.Color(112, 69, 61);
spriteFrame.setTexture(texture, cc.rect(0, 42, 110, 42));
} else {
spriteFrame.setTexture(texture, cc.rect(0, 0, 110, 42));
}
nodeNaviListCell.getChildByName('Bg').getComponent(cc.Sprite).spriteFrame = spriteFrame;
spriteFrame._calculateUV();
});
// cc.loader.loadRes('VideoDetail/navi_bg', cc.Texture2D, function (err, texture) {
// let spriteFrame = new cc.SpriteFrame();
// if (i == 1) {
// cc.find('Text', nodeNaviListCell).color = new cc.Color(112, 69, 61);
// spriteFrame.setTexture(texture, cc.rect(0, 42, 110, 42));
// } else {
// spriteFrame.setTexture(texture, cc.rect(0, 0, 110, 42));
// }
// nodeNaviListCell.getChildByName('Bg').getComponent(cc.Sprite).spriteFrame = spriteFrame;
// spriteFrame._calculateUV();
// });
//准备焦点坐标
let fiNaviBlock = nodeNaviListCell.addComponent(FocusInfo);
fiNaviBlock.init('', true, null, null, 1.0);
......@@ -308,7 +313,7 @@ cc.Class({
}
if (fiFocusTarget && 0 == fiFocusTarget.node.name.indexOf("EpisodeListCell")) {
if (fiFocusTarget.node.x - fiFocusTarget.node.width / 2 + this._nodeEpisodeList.x >= this._nodeEpisodeListWrapper.width) {
if (fiFocusTarget.node.x + fiFocusTarget.node.width / 2 + this._nodeEpisodeList.x >= this._nodeEpisodeListWrapper.width) {
oScrollParameter = this._nodeEpisodeList.getComponent(TVScrollParameter);
oScrollParameter.setHasRelation(true);
oScrollParameter.setStep((fiFocusTarget.node.x + fiFocusTarget.node.width / 2 + this._nodeEpisodeList.x) - this._nodeEpisodeListWrapper.width + 20);
......@@ -318,7 +323,7 @@ cc.Class({
if (fiFocusTarget.node.x + this._nodeEpisodeList.x < 0) {
oScrollParameter = this._nodeEpisodeList.getComponent(TVScrollParameter);
oScrollParameter.setHasRelation(true);
oScrollParameter.setStep(-fiFocusTarget.node.x + fiFocusTarget.node.width / 2 - this._nodeEpisodeList.x + 16);
oScrollParameter.setStep(-fiFocusTarget.node.x + fiFocusTarget.node.width / 2 - this._nodeEpisodeList.x);
oScrollParameter.setTargetPosition(this._nodeEpisodeList.x + oScrollParameter.getStep())
// this._oSceneContext._nodeNaviListX = this._nodeEpisodeList.x + oScrollParameter.getStep();
}
......@@ -417,11 +422,20 @@ cc.Class({
if (0 == fiFrom.node.getName().indexOf('NaviListCell') && 0 == fiTo.node.getName().indexOf('NaviListCell')) { //剧集分类1-20.21-40...
cc.find('Text', fiFrom.node).color = new cc.Color(255, 255, 255);
// fiFrom.node.getChildByName('Bg').getComponent(cc.Sprite).spriteFrame.setRect(cc.rect(0, 0, fiFrom.node.getChildByName('Bg').width, fiFrom.node.getChildByName('Bg').height));
cc.loader.loadRes('VideoDetail/navi_bg', cc.Texture2D, function (err, texture) {
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));
});
// cc.loader.loadRes('VideoDetail/navi_bg', cc.Texture2D, function (err, texture) {
// 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));
// });
}
// if (0 == fiFrom.node.getName().indexOf('EpisodeListCell')) { //剧集分类1-20.21-40...
// fiFrom.node.width = 104;
// // cc.find('Text', fiTo.node).color = new cc.Color(255, 204, 1);
// // 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));
// // cc.loader.loadRes('VideoDetail/navi_bg', cc.Texture2D, function (err, texture) {
// // 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));
// // });
// }
},
onAfterFocusChange: function (event) {
......@@ -456,16 +470,25 @@ cc.Class({
this._oSceneContext.currentPage = 1; //页面恢复
cc.find('Text', fiTo.node).color = new cc.Color(112, 69, 61);
cc.find('Text', fiTo.node).color = new cc.Color(255, 204, 1);
// 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));
cc.loader.loadRes('VideoDetail/navi_bg', cc.Texture2D, function (err, texture) {
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));
});
// cc.loader.loadRes('VideoDetail/navi_bg', cc.Texture2D, function (err, texture) {
// 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));
// });
let index = fiTo.node.name.replace('NaviListCell', '');
this._iCurrentNaviNumLoc = index;
this._oSceneContext.requestedStart = index * 20 - 20;
this.getGatherDetailList();
}
// if (0 == fiTo.node.getName().indexOf('EpisodeListCell')) { //剧集分类1-20.21-40...
// fiTo.node.width = 378;
// // cc.find('Text', fiTo.node).color = new cc.Color(255, 204, 1);
// // 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));
// // cc.loader.loadRes('VideoDetail/navi_bg', cc.Texture2D, function (err, texture) {
// // 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));
// // });
// }
},
doCurrentFocusTVLinkAction: function (strAction) {
......