Commit 40c814d2 40c814d25d358094dbed4bcfef6bdd7340aee1dd by 金学艇

1.左侧标签快速切换后,焦点无法右移

2.首页【经营策略】导航栏游戏详情页返回向下翻页无焦点
1 parent c4f60729
......@@ -192,7 +192,7 @@
"array": [
0,
0,
271.0659484863281,
265.0037841796875,
0,
0,
0,
......@@ -5708,8 +5708,8 @@
}
],
"_useOriginalSize": false,
"_string": "v0.9.0.2020031610",
"_N$string": "v0.9.0.2020031610",
"_string": "v1.0.0.2020031617",
"_N$string": "v1.0.0.2020031617",
"_fontSize": 24,
"_lineHeight": 24,
"_enableWrapText": true,
......
......@@ -25,6 +25,7 @@ cc.Class({
onLoad: function () {
this._super();
this._oInit = {};
this._lastFocus = null;
this._oSceneContext._iCurrentLeftIndex = 0;
this._oSceneContext.focusPath = "TypeListArea/TypeListWrapper/TypeList/topNavi" + this._oSceneContext._iCurrentLeftIndex;
this._bIsDataListMoving = false;
......@@ -311,7 +312,7 @@ cc.Class({
this._cFocus.init('focusContainer', this,
nodeInitFocus.getComponent(FocusInfo),
Common.SCREEN_WIDTH, Common.SCREEN_HEIGHT, 10, 6, 1.1, true);
this._lastFocus = nodeInitFocus.getComponent(FocusInfo);
if (0 == nodeInitFocus.name.indexOf("topNavi")) {
this._cFocus.hide();
}
......@@ -373,10 +374,23 @@ cc.Class({
return [fiFocusTarget, oScrollParameter];
},
onKeyUp: function (event) {
// cc.log(this._lastFocus.node.name + " down->抬起。。。" + this._fiCurrentFocus.node.name);
cc.log("抬起:" + event.keyCode);
if (0 == this._lastFocus.node.getName().indexOf('topNavi')
&& 0 == this._fiCurrentFocus.node.getName().indexOf('topNavi')
&& event.keyCode != (Common.ANDROID_KEY.left || cc.macro.KEY.left)) {
this.scheduleOnce(function () {
this.getSimulateRequest();
}, 0);
}
},
onKeyDown: function (event) {
this._super(event);
var fiFocusTarget = null;
var fiCurrentFocus = this._fiCurrentFocus;
this._lastFocus = this._fiCurrentFocus; //存储上一个节点
switch (event.keyCode) {
case cc.macro.KEY.up:
case Common.ANDROID_KEY.up:
......@@ -546,12 +560,14 @@ cc.Class({
}
if (0 == fiFrom.node.getName().indexOf('topNavi')) {
this._oSceneContext._iCurrentLeftIndex = iIndex;
this._oSceneContext.categoryRecordIndexOfFirstCell = 0; //将列表记录置空
this.scheduleOnce(function () {
// this.requestMediaList(1); //重新渲染CategoryList
this.getSimulateRequest();
}, 0);
// this.scheduleOnce(function () { //这个放到onKeyUp中去,解决长按导致的焦点丢失
// cc.log("onAfter..." + iIndex);
// // this.requestMediaList(1); //重新渲染CategoryList
// this.getSimulateRequest();
// }, 0);
}
}
......
......@@ -65,12 +65,15 @@ cc.Class({
// cc.loader.loadRes(oData.image[0].fileUrl, cc.Texture2D, function (err, texture) {
// self.pic.spriteFrame = new cc.SpriteFrame(texture);
// });
Network.loadImageInNativeRuntime(
Common.TOPDRAW_IMAGE_SERVER + oData.image[0].fileUrl, null,
function (texture, iRequestId) {
self.pic.spriteFrame = new cc.SpriteFrame(texture);
}, function () { }, this
);
cc.log("pfbCategoryListCell.."+self.pic);
if (self.pic) {
Network.loadImageInNativeRuntime(
Common.TOPDRAW_IMAGE_SERVER + oData.image[0].fileUrl, null,
function (texture, iRequestId) {
self.pic.spriteFrame = new cc.SpriteFrame(texture);
}, function () { }, this
);
}
}
// cc.log("category list cell location: "+oData.image[0].fileUrl);
this.node.getComponent(FocusInfo).setTVLink(oData.tvlink);
......
//分类-动漫
var Common = require('Common');
var FocusInfo = require('FocusInfo');
var ListCell = require('ListCell');
var Network = require('Network');
cc.Class({
extends: ListCell,
properties: {
id: 0,
pic: cc.Sprite,
activeName1: cc.Label,
activeName2: cc.Label,
normalName: cc.Label,
Name: cc.Label,
textScore: cc.Label, //分数
},
statics: {
PFB_NAME: 'Prefab/pfbMainCategoryListCell',
CELL_NAME: 'CategoryListCell',
},
init: function (iCellIndex, bIsFocusEnable, compSceneCanvas) {
//准备焦点坐标
let fiCategoryBlock = this.node.addComponent(FocusInfo);
fiCategoryBlock.init(
null, true, null, null, 1.1
);
compSceneCanvas.addNodeToFocusTarget(0, this.node.name, this.node);
},
render(oData, iRecordIndex) {
// this.id = oData.id;
// cc.log("categoryList-->name: "+JSON.stringify(oData));
this.activeName1.string = oData.name;
this.activeName2.string = oData.name;
this.normalName.string = oData.name;
this.Name.string = oData.name;
// this.activeName1._updateRenderData(true);
// this.activeName2._updateRenderData(true);
// this.normalName._updateRenderData(true);
if (oData.score) {
this.textScore.string = parseInt(oData.score * 10) / 10;
}
if (oData.play_times) {
let value = parseInt(oData.play_times);
if (value > 10000) {
this.textPlayTimes.string = parseInt(value / 10000) + "万+";
} else {
this.textPlayTimes.string = value;
}
}
if (oData.image[0]) {
var self = this;
// Network.loadImageInNativeRuntime(
// Common.TOPDRAW_IMAGE_SERVER + oData.image[0].fileUrl,null,
// function (texture) {
// self.pic.spriteFrame = new cc.SpriteFrame(texture);
// }, null, this
// );
// cc.log("categoryList..."+oData.image[0].fileUrl);
// cc.loader.loadRes(oData.image[0].fileUrl, cc.Texture2D, function (err, texture) {
// self.pic.spriteFrame = new cc.SpriteFrame(texture);
// });
cc.log("pfbCategoryListCell.." + self.pic);
if (self.pic) {
Network.loadImageInNativeRuntime(
Common.TOPDRAW_IMAGE_SERVER + oData.image[0].fileUrl, null,
function (texture, iRequestId) {
self.pic.spriteFrame = new cc.SpriteFrame(texture);
}, function () { }, this
);
}
}
// cc.log("category list cell location: "+oData.image[0].fileUrl);
this.node.getComponent(FocusInfo).setTVLink(oData.tvlink);
},
enableFocusInfo: function () {
this.node.getComponent(FocusInfo).setEnable(true);
},
disableFocusInfo: function () {
this.node.getComponent(FocusInfo).setEnable(false);
},
setUIWithFocus: function () {
let nodeCellName = this.node.getChildByName('Name');
cc.find("NormalName", nodeCellName).opacity = 255;
//超出滚动
let nodeScreenTitleText = cc.find('ActiveName/NameContainer/NameText', nodeCellName);
let fOriginalX = nodeScreenTitleText.x;
let fOriginalY = nodeScreenTitleText.y;
let nodeScreenTitleText1 = nodeScreenTitleText.getChildByName('NameText1');
let nodeScreenTitleText2 = nodeScreenTitleText.getChildByName('NameText2');
nodeScreenTitleText2.x = nodeScreenTitleText1.x + nodeScreenTitleText1.width + 10;//TODO:补丁,解决滚动重叠
if (nodeScreenTitleText1.width > nodeScreenTitleText.width) {
cc.find("ActiveName/NameContainer", nodeCellName).opacity = 255;
cc.find("NormalName", nodeCellName).opacity = 0;
let fEndPositionDelta = (nodeScreenTitleText1.width + 30);
//下方时长和字有关系,才能速度一样
var ftaScreenTitleMoveToTarget = cc.moveTo(10 * (nodeScreenTitleText1.width / nodeScreenTitleText.width), fOriginalX - fEndPositionDelta, fOriginalY);
var ftaScreenTitleMoveToBack = cc.moveTo(0, fOriginalX, fOriginalY);
var sequenceMediaTitle = cc.sequence(ftaScreenTitleMoveToTarget, ftaScreenTitleMoveToBack);
var repeatScreenTitle = cc.repeat(sequenceMediaTitle, 10);
repeatScreenTitle.setTag(Common.OVERLENGTH_MOVING);
nodeScreenTitleText.runAction(repeatScreenTitle);
nodeScreenTitleText2.active = true;
}
},
setUIWithoutFocus: function () {
let nodeCellName = this.node.getChildByName('Name');
cc.find("NormalName", nodeCellName).opacity = 255;
//如有滚动停止滚动
let nodeScreenTitleText = cc.find('ActiveName/NameContainer/NameText', nodeCellName);
if (null != nodeScreenTitleText.getActionByTag(Common.OVERLENGTH_MOVING)) {
nodeScreenTitleText.stopActionByTag(Common.OVERLENGTH_MOVING);
nodeScreenTitleText.getChildByName('NameText2').active = false;
cc.find("ActiveName/NameContainer", nodeCellName).opacity = 0;
}
nodeScreenTitleText.x = 0;
},
});
......@@ -153,7 +153,7 @@ cc.Class({
}, i);
let fiNav = nodeNav.addComponent(FocusInfo);
fiNav.init(null, true, null, null, 1.1); //最后一个参数决定要不要放大显示
fiNav.init(null, false, null, null, 1.1); //最后一个参数决定要不要放大显示
this._aFocusTargets[0]["view_pager_label" + i] = nodeNav;
}
......@@ -219,6 +219,7 @@ cc.Class({
cc.find("scrollContent/BlockShadow", this.node).active = true;
} else {
this.getSimulateRequest();
cc.log("不显示轮播图。。。");
cc.find("scrollContent/ViewPagerArea", this.node).active = false;
cc.find("scrollContent/BlockShadow", this.node).active = false;
}
......@@ -702,7 +703,7 @@ cc.Class({
// switch (strAppId) {
// case BusinessParameter.CARTOON_APPID:
// this._oSceneContext.focusPath = this._oSceneContext.focusPath || "SongList/DataContainerMask/DataContainer/ListCell0/SongTitleContainer";
this._strSongListCellComponentName = "pfbCategoryListCell";
this._strSongListCellComponentName = "pfbMainCategoryListCell";
this._iBeginPositionX = -440;
this._iBeginPositionY = 160;
this._iShowCellRows = 2;
......@@ -845,8 +846,10 @@ cc.Class({
fiViewPagerArea.init('', false, null, null, 1.0);
this._aFocusTargets[0]['view_pager_area'] = cc.find('scrollContent/ViewPagerArea', this.node);
cc.find("scrollContent/ViewPagerArea", this.node).active = false; //打补丁,解决第一次不能跳转到轮播图上面的问题
cc.find("scrollContent/ViewPagerArea", this.node).active = true;
if (this._oSceneContext._iCurrentLeftIndex == 1) {
cc.find("scrollContent/ViewPagerArea", this.node).active = false; //打补丁,解决第一次不能跳转到轮播图上面的问题
cc.find("scrollContent/ViewPagerArea", this.node).active = true;
}
let fiHotUpdateBtn = cc.find('update/update_panel/update_btn', this.node).addComponent(FocusInfo); //热更新按钮
fiHotUpdateBtn.init('', false, null, null, 1.1);
......@@ -883,11 +886,11 @@ cc.Class({
return;
}
if (this._oSceneContext._iCurrentLeftIndex > 1) { //不是第一个焦点框就跳过去,恢复记忆
this.scheduleOnce(function () {
this._cFocus.flyFocus(this._fiCurrentFocus, nodeInitFocus.getComponent(FocusInfo), Common.MOVE_DIRECTION_RIGHT, null, null);
}, 0);
}
// if (this._oSceneContext._iCurrentLeftIndex > 1) { //不是第一个焦点框就跳过去,恢复记忆
// this.scheduleOnce(function () {
// this._cFocus.flyFocus(this._fiCurrentFocus, nodeInitFocus.getComponent(FocusInfo), Common.MOVE_DIRECTION_RIGHT, null, null);
// }, 0);
// }
},
keyDownDirection: function (Direct) {
......@@ -896,6 +899,7 @@ cc.Class({
var oScrollParameter = null;
let aCheckResult;
fiFocusTarget = this._cFocus.findTarget(fiCurrentFocus, this._aFocusTargets, this._iSceneStatus, Direct);
// cc.log("目标节点:" + fiFocusTarget.node.name);
if (!fiFocusTarget) { return; }
aCheckResult = this.checkFocusTarget(fiFocusTarget, null, Direct);
fiFocusTarget = aCheckResult[0];
......@@ -921,7 +925,8 @@ cc.Class({
},
checkFocusTarget: function (fiFocusTarget, oScrollParameter, Direct) {
// cc.log("目标节点名称:" + fiFocusTarget.node.name);
if (fiFocusTarget)
cc.log("目标节点名称:" + fiFocusTarget.node.name);
var leftNavLayout = this.targetAry[0].target;
// if (!this._bInitCategoryListSuccess) {
......@@ -1323,20 +1328,18 @@ cc.Class({
var rightNodeLayout = this.targetAry[1].target;
let blockShadow = cc.find("scrollContent/BlockShadow", this.node);
if (iIndex == 1) {
this.scheduleOnce(function () {
// this.getRightRecommendRequestData();
}, 0);
cc.find("scrollContent/ViewPagerArea", this.node).active = true;
cc.find("scrollContent/BlockShadow", this.node).active = true;
// cc.find("scrollContent/CategoryListRecommendLayout", this.node).active = false;
blockShadow.active = true;
} else {
cc.find("scrollContent/ViewPagerArea", this.node).active = false;
cc.find("scrollContent/BlockShadow", this.node).active = false;
// cc.find("scrollContent/CategoryListRecommendLayout", this.node).active = true;
blockShadow.active = false;
}
if (rightNodeLayout.childrenCount == 0 && iIndex == 1) { //恢复光标的界面可能需要初始化瀑布流
this.getRightRecommendRequestData();
}
for (let i = 0; i < rightNodeLayout.childrenCount; i++) {
if (iIndex == 1) { //“休闲益智”采用单独的框架渲染 || iIndex == 3
rightNodeLayout.children[i].active = true;
......