Commit 40c814d2 40c814d25d358094dbed4bcfef6bdd7340aee1dd by 金学艇

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

2.首页【经营策略】导航栏游戏详情页返回向下翻页无焦点
1 parent c4f60729
...@@ -192,7 +192,7 @@ ...@@ -192,7 +192,7 @@
192 "array": [ 192 "array": [
193 0, 193 0,
194 0, 194 0,
195 271.0659484863281, 195 265.0037841796875,
196 0, 196 0,
197 0, 197 0,
198 0, 198 0,
...@@ -5708,8 +5708,8 @@ ...@@ -5708,8 +5708,8 @@
5708 } 5708 }
5709 ], 5709 ],
5710 "_useOriginalSize": false, 5710 "_useOriginalSize": false,
5711 "_string": "v0.9.0.2020031610", 5711 "_string": "v1.0.0.2020031617",
5712 "_N$string": "v0.9.0.2020031610", 5712 "_N$string": "v1.0.0.2020031617",
5713 "_fontSize": 24, 5713 "_fontSize": 24,
5714 "_lineHeight": 24, 5714 "_lineHeight": 24,
5715 "_enableWrapText": true, 5715 "_enableWrapText": true,
......
...@@ -25,6 +25,7 @@ cc.Class({ ...@@ -25,6 +25,7 @@ cc.Class({
25 onLoad: function () { 25 onLoad: function () {
26 this._super(); 26 this._super();
27 this._oInit = {}; 27 this._oInit = {};
28 this._lastFocus = null;
28 this._oSceneContext._iCurrentLeftIndex = 0; 29 this._oSceneContext._iCurrentLeftIndex = 0;
29 this._oSceneContext.focusPath = "TypeListArea/TypeListWrapper/TypeList/topNavi" + this._oSceneContext._iCurrentLeftIndex; 30 this._oSceneContext.focusPath = "TypeListArea/TypeListWrapper/TypeList/topNavi" + this._oSceneContext._iCurrentLeftIndex;
30 this._bIsDataListMoving = false; 31 this._bIsDataListMoving = false;
...@@ -311,7 +312,7 @@ cc.Class({ ...@@ -311,7 +312,7 @@ cc.Class({
311 this._cFocus.init('focusContainer', this, 312 this._cFocus.init('focusContainer', this,
312 nodeInitFocus.getComponent(FocusInfo), 313 nodeInitFocus.getComponent(FocusInfo),
313 Common.SCREEN_WIDTH, Common.SCREEN_HEIGHT, 10, 6, 1.1, true); 314 Common.SCREEN_WIDTH, Common.SCREEN_HEIGHT, 10, 6, 1.1, true);
314 315 this._lastFocus = nodeInitFocus.getComponent(FocusInfo);
315 if (0 == nodeInitFocus.name.indexOf("topNavi")) { 316 if (0 == nodeInitFocus.name.indexOf("topNavi")) {
316 this._cFocus.hide(); 317 this._cFocus.hide();
317 } 318 }
...@@ -373,10 +374,23 @@ cc.Class({ ...@@ -373,10 +374,23 @@ cc.Class({
373 return [fiFocusTarget, oScrollParameter]; 374 return [fiFocusTarget, oScrollParameter];
374 }, 375 },
375 376
377 onKeyUp: function (event) {
378 // cc.log(this._lastFocus.node.name + " down->抬起。。。" + this._fiCurrentFocus.node.name);
379 cc.log("抬起:" + event.keyCode);
380 if (0 == this._lastFocus.node.getName().indexOf('topNavi')
381 && 0 == this._fiCurrentFocus.node.getName().indexOf('topNavi')
382 && event.keyCode != (Common.ANDROID_KEY.left || cc.macro.KEY.left)) {
383 this.scheduleOnce(function () {
384 this.getSimulateRequest();
385 }, 0);
386 }
387 },
388
376 onKeyDown: function (event) { 389 onKeyDown: function (event) {
377 this._super(event); 390 this._super(event);
378 var fiFocusTarget = null; 391 var fiFocusTarget = null;
379 var fiCurrentFocus = this._fiCurrentFocus; 392 var fiCurrentFocus = this._fiCurrentFocus;
393 this._lastFocus = this._fiCurrentFocus; //存储上一个节点
380 switch (event.keyCode) { 394 switch (event.keyCode) {
381 case cc.macro.KEY.up: 395 case cc.macro.KEY.up:
382 case Common.ANDROID_KEY.up: 396 case Common.ANDROID_KEY.up:
...@@ -546,12 +560,14 @@ cc.Class({ ...@@ -546,12 +560,14 @@ cc.Class({
546 } 560 }
547 561
548 if (0 == fiFrom.node.getName().indexOf('topNavi')) { 562 if (0 == fiFrom.node.getName().indexOf('topNavi')) {
563
549 this._oSceneContext._iCurrentLeftIndex = iIndex; 564 this._oSceneContext._iCurrentLeftIndex = iIndex;
550 this._oSceneContext.categoryRecordIndexOfFirstCell = 0; //将列表记录置空 565 this._oSceneContext.categoryRecordIndexOfFirstCell = 0; //将列表记录置空
551 this.scheduleOnce(function () { 566 // this.scheduleOnce(function () { //这个放到onKeyUp中去,解决长按导致的焦点丢失
552 // this.requestMediaList(1); //重新渲染CategoryList 567 // cc.log("onAfter..." + iIndex);
553 this.getSimulateRequest(); 568 // // this.requestMediaList(1); //重新渲染CategoryList
554 }, 0); 569 // this.getSimulateRequest();
570 // }, 0);
555 } 571 }
556 } 572 }
557 573
......
...@@ -65,6 +65,8 @@ cc.Class({ ...@@ -65,6 +65,8 @@ cc.Class({
65 // cc.loader.loadRes(oData.image[0].fileUrl, cc.Texture2D, function (err, texture) { 65 // cc.loader.loadRes(oData.image[0].fileUrl, cc.Texture2D, function (err, texture) {
66 // self.pic.spriteFrame = new cc.SpriteFrame(texture); 66 // self.pic.spriteFrame = new cc.SpriteFrame(texture);
67 // }); 67 // });
68 cc.log("pfbCategoryListCell.."+self.pic);
69 if (self.pic) {
68 Network.loadImageInNativeRuntime( 70 Network.loadImageInNativeRuntime(
69 Common.TOPDRAW_IMAGE_SERVER + oData.image[0].fileUrl, null, 71 Common.TOPDRAW_IMAGE_SERVER + oData.image[0].fileUrl, null,
70 function (texture, iRequestId) { 72 function (texture, iRequestId) {
...@@ -72,6 +74,7 @@ cc.Class({ ...@@ -72,6 +74,7 @@ cc.Class({
72 }, function () { }, this 74 }, function () { }, this
73 ); 75 );
74 } 76 }
77 }
75 // cc.log("category list cell location: "+oData.image[0].fileUrl); 78 // cc.log("category list cell location: "+oData.image[0].fileUrl);
76 this.node.getComponent(FocusInfo).setTVLink(oData.tvlink); 79 this.node.getComponent(FocusInfo).setTVLink(oData.tvlink);
77 }, 80 },
......
1 //分类-动漫
2 var Common = require('Common');
3 var FocusInfo = require('FocusInfo');
4 var ListCell = require('ListCell');
5 var Network = require('Network');
6
7 cc.Class({
8 extends: ListCell,
9
10 properties: {
11 id: 0,
12 pic: cc.Sprite,
13 activeName1: cc.Label,
14 activeName2: cc.Label,
15 normalName: cc.Label,
16 Name: cc.Label,
17 textScore: cc.Label, //分数
18 },
19
20 statics: {
21 PFB_NAME: 'Prefab/pfbMainCategoryListCell',
22 CELL_NAME: 'CategoryListCell',
23 },
24
25 init: function (iCellIndex, bIsFocusEnable, compSceneCanvas) {
26 //准备焦点坐标
27 let fiCategoryBlock = this.node.addComponent(FocusInfo);
28 fiCategoryBlock.init(
29 null, true, null, null, 1.1
30 );
31 compSceneCanvas.addNodeToFocusTarget(0, this.node.name, this.node);
32 },
33
34 render(oData, iRecordIndex) {
35 // this.id = oData.id;
36 // cc.log("categoryList-->name: "+JSON.stringify(oData));
37 this.activeName1.string = oData.name;
38 this.activeName2.string = oData.name;
39 this.normalName.string = oData.name;
40 this.Name.string = oData.name;
41 // this.activeName1._updateRenderData(true);
42 // this.activeName2._updateRenderData(true);
43 // this.normalName._updateRenderData(true);
44 if (oData.score) {
45 this.textScore.string = parseInt(oData.score * 10) / 10;
46 }
47 if (oData.play_times) {
48 let value = parseInt(oData.play_times);
49 if (value > 10000) {
50 this.textPlayTimes.string = parseInt(value / 10000) + "万+";
51 } else {
52 this.textPlayTimes.string = value;
53 }
54 }
55 if (oData.image[0]) {
56 var self = this;
57
58 // Network.loadImageInNativeRuntime(
59 // Common.TOPDRAW_IMAGE_SERVER + oData.image[0].fileUrl,null,
60 // function (texture) {
61 // self.pic.spriteFrame = new cc.SpriteFrame(texture);
62 // }, null, this
63 // );
64 // cc.log("categoryList..."+oData.image[0].fileUrl);
65 // cc.loader.loadRes(oData.image[0].fileUrl, cc.Texture2D, function (err, texture) {
66 // self.pic.spriteFrame = new cc.SpriteFrame(texture);
67 // });
68 cc.log("pfbCategoryListCell.." + self.pic);
69 if (self.pic) {
70 Network.loadImageInNativeRuntime(
71 Common.TOPDRAW_IMAGE_SERVER + oData.image[0].fileUrl, null,
72 function (texture, iRequestId) {
73 self.pic.spriteFrame = new cc.SpriteFrame(texture);
74 }, function () { }, this
75 );
76 }
77 }
78 // cc.log("category list cell location: "+oData.image[0].fileUrl);
79 this.node.getComponent(FocusInfo).setTVLink(oData.tvlink);
80 },
81
82 enableFocusInfo: function () {
83 this.node.getComponent(FocusInfo).setEnable(true);
84 },
85
86 disableFocusInfo: function () {
87 this.node.getComponent(FocusInfo).setEnable(false);
88 },
89
90 setUIWithFocus: function () {
91 let nodeCellName = this.node.getChildByName('Name');
92 cc.find("NormalName", nodeCellName).opacity = 255;
93 //超出滚动
94 let nodeScreenTitleText = cc.find('ActiveName/NameContainer/NameText', nodeCellName);
95
96 let fOriginalX = nodeScreenTitleText.x;
97 let fOriginalY = nodeScreenTitleText.y;
98
99 let nodeScreenTitleText1 = nodeScreenTitleText.getChildByName('NameText1');
100 let nodeScreenTitleText2 = nodeScreenTitleText.getChildByName('NameText2');
101 nodeScreenTitleText2.x = nodeScreenTitleText1.x + nodeScreenTitleText1.width + 10;//TODO:补丁,解决滚动重叠
102 if (nodeScreenTitleText1.width > nodeScreenTitleText.width) {
103 cc.find("ActiveName/NameContainer", nodeCellName).opacity = 255;
104 cc.find("NormalName", nodeCellName).opacity = 0;
105 let fEndPositionDelta = (nodeScreenTitleText1.width + 30);
106 //下方时长和字有关系,才能速度一样
107 var ftaScreenTitleMoveToTarget = cc.moveTo(10 * (nodeScreenTitleText1.width / nodeScreenTitleText.width), fOriginalX - fEndPositionDelta, fOriginalY);
108 var ftaScreenTitleMoveToBack = cc.moveTo(0, fOriginalX, fOriginalY);
109 var sequenceMediaTitle = cc.sequence(ftaScreenTitleMoveToTarget, ftaScreenTitleMoveToBack);
110 var repeatScreenTitle = cc.repeat(sequenceMediaTitle, 10);
111 repeatScreenTitle.setTag(Common.OVERLENGTH_MOVING);
112 nodeScreenTitleText.runAction(repeatScreenTitle);
113 nodeScreenTitleText2.active = true;
114 }
115 },
116 setUIWithoutFocus: function () {
117 let nodeCellName = this.node.getChildByName('Name');
118 cc.find("NormalName", nodeCellName).opacity = 255;
119 //如有滚动停止滚动
120 let nodeScreenTitleText = cc.find('ActiveName/NameContainer/NameText', nodeCellName);
121 if (null != nodeScreenTitleText.getActionByTag(Common.OVERLENGTH_MOVING)) {
122 nodeScreenTitleText.stopActionByTag(Common.OVERLENGTH_MOVING);
123 nodeScreenTitleText.getChildByName('NameText2').active = false;
124 cc.find("ActiveName/NameContainer", nodeCellName).opacity = 0;
125 }
126 nodeScreenTitleText.x = 0;
127 },
128
129 });
...@@ -153,7 +153,7 @@ cc.Class({ ...@@ -153,7 +153,7 @@ cc.Class({
153 }, i); 153 }, i);
154 154
155 let fiNav = nodeNav.addComponent(FocusInfo); 155 let fiNav = nodeNav.addComponent(FocusInfo);
156 fiNav.init(null, true, null, null, 1.1); //最后一个参数决定要不要放大显示 156 fiNav.init(null, false, null, null, 1.1); //最后一个参数决定要不要放大显示
157 157
158 this._aFocusTargets[0]["view_pager_label" + i] = nodeNav; 158 this._aFocusTargets[0]["view_pager_label" + i] = nodeNav;
159 } 159 }
...@@ -219,6 +219,7 @@ cc.Class({ ...@@ -219,6 +219,7 @@ cc.Class({
219 cc.find("scrollContent/BlockShadow", this.node).active = true; 219 cc.find("scrollContent/BlockShadow", this.node).active = true;
220 } else { 220 } else {
221 this.getSimulateRequest(); 221 this.getSimulateRequest();
222 cc.log("不显示轮播图。。。");
222 cc.find("scrollContent/ViewPagerArea", this.node).active = false; 223 cc.find("scrollContent/ViewPagerArea", this.node).active = false;
223 cc.find("scrollContent/BlockShadow", this.node).active = false; 224 cc.find("scrollContent/BlockShadow", this.node).active = false;
224 } 225 }
...@@ -702,7 +703,7 @@ cc.Class({ ...@@ -702,7 +703,7 @@ cc.Class({
702 // switch (strAppId) { 703 // switch (strAppId) {
703 // case BusinessParameter.CARTOON_APPID: 704 // case BusinessParameter.CARTOON_APPID:
704 // this._oSceneContext.focusPath = this._oSceneContext.focusPath || "SongList/DataContainerMask/DataContainer/ListCell0/SongTitleContainer"; 705 // this._oSceneContext.focusPath = this._oSceneContext.focusPath || "SongList/DataContainerMask/DataContainer/ListCell0/SongTitleContainer";
705 this._strSongListCellComponentName = "pfbCategoryListCell"; 706 this._strSongListCellComponentName = "pfbMainCategoryListCell";
706 this._iBeginPositionX = -440; 707 this._iBeginPositionX = -440;
707 this._iBeginPositionY = 160; 708 this._iBeginPositionY = 160;
708 this._iShowCellRows = 2; 709 this._iShowCellRows = 2;
...@@ -845,8 +846,10 @@ cc.Class({ ...@@ -845,8 +846,10 @@ cc.Class({
845 fiViewPagerArea.init('', false, null, null, 1.0); 846 fiViewPagerArea.init('', false, null, null, 1.0);
846 this._aFocusTargets[0]['view_pager_area'] = cc.find('scrollContent/ViewPagerArea', this.node); 847 this._aFocusTargets[0]['view_pager_area'] = cc.find('scrollContent/ViewPagerArea', this.node);
847 848
849 if (this._oSceneContext._iCurrentLeftIndex == 1) {
848 cc.find("scrollContent/ViewPagerArea", this.node).active = false; //打补丁,解决第一次不能跳转到轮播图上面的问题 850 cc.find("scrollContent/ViewPagerArea", this.node).active = false; //打补丁,解决第一次不能跳转到轮播图上面的问题
849 cc.find("scrollContent/ViewPagerArea", this.node).active = true; 851 cc.find("scrollContent/ViewPagerArea", this.node).active = true;
852 }
850 853
851 let fiHotUpdateBtn = cc.find('update/update_panel/update_btn', this.node).addComponent(FocusInfo); //热更新按钮 854 let fiHotUpdateBtn = cc.find('update/update_panel/update_btn', this.node).addComponent(FocusInfo); //热更新按钮
852 fiHotUpdateBtn.init('', false, null, null, 1.1); 855 fiHotUpdateBtn.init('', false, null, null, 1.1);
...@@ -883,11 +886,11 @@ cc.Class({ ...@@ -883,11 +886,11 @@ cc.Class({
883 return; 886 return;
884 } 887 }
885 888
886 if (this._oSceneContext._iCurrentLeftIndex > 1) { //不是第一个焦点框就跳过去,恢复记忆 889 // if (this._oSceneContext._iCurrentLeftIndex > 1) { //不是第一个焦点框就跳过去,恢复记忆
887 this.scheduleOnce(function () { 890 // this.scheduleOnce(function () {
888 this._cFocus.flyFocus(this._fiCurrentFocus, nodeInitFocus.getComponent(FocusInfo), Common.MOVE_DIRECTION_RIGHT, null, null); 891 // this._cFocus.flyFocus(this._fiCurrentFocus, nodeInitFocus.getComponent(FocusInfo), Common.MOVE_DIRECTION_RIGHT, null, null);
889 }, 0); 892 // }, 0);
890 } 893 // }
891 }, 894 },
892 895
893 keyDownDirection: function (Direct) { 896 keyDownDirection: function (Direct) {
...@@ -896,6 +899,7 @@ cc.Class({ ...@@ -896,6 +899,7 @@ cc.Class({
896 var oScrollParameter = null; 899 var oScrollParameter = null;
897 let aCheckResult; 900 let aCheckResult;
898 fiFocusTarget = this._cFocus.findTarget(fiCurrentFocus, this._aFocusTargets, this._iSceneStatus, Direct); 901 fiFocusTarget = this._cFocus.findTarget(fiCurrentFocus, this._aFocusTargets, this._iSceneStatus, Direct);
902 // cc.log("目标节点:" + fiFocusTarget.node.name);
899 if (!fiFocusTarget) { return; } 903 if (!fiFocusTarget) { return; }
900 aCheckResult = this.checkFocusTarget(fiFocusTarget, null, Direct); 904 aCheckResult = this.checkFocusTarget(fiFocusTarget, null, Direct);
901 fiFocusTarget = aCheckResult[0]; 905 fiFocusTarget = aCheckResult[0];
...@@ -921,7 +925,8 @@ cc.Class({ ...@@ -921,7 +925,8 @@ cc.Class({
921 }, 925 },
922 926
923 checkFocusTarget: function (fiFocusTarget, oScrollParameter, Direct) { 927 checkFocusTarget: function (fiFocusTarget, oScrollParameter, Direct) {
924 // cc.log("目标节点名称:" + fiFocusTarget.node.name); 928 if (fiFocusTarget)
929 cc.log("目标节点名称:" + fiFocusTarget.node.name);
925 var leftNavLayout = this.targetAry[0].target; 930 var leftNavLayout = this.targetAry[0].target;
926 931
927 // if (!this._bInitCategoryListSuccess) { 932 // if (!this._bInitCategoryListSuccess) {
...@@ -1323,20 +1328,18 @@ cc.Class({ ...@@ -1323,20 +1328,18 @@ cc.Class({
1323 1328
1324 var rightNodeLayout = this.targetAry[1].target; 1329 var rightNodeLayout = this.targetAry[1].target;
1325 1330
1331 let blockShadow = cc.find("scrollContent/BlockShadow", this.node);
1326 if (iIndex == 1) { 1332 if (iIndex == 1) {
1327 this.scheduleOnce(function () {
1328 // this.getRightRecommendRequestData();
1329 }, 0);
1330
1331 cc.find("scrollContent/ViewPagerArea", this.node).active = true; 1333 cc.find("scrollContent/ViewPagerArea", this.node).active = true;
1332 cc.find("scrollContent/BlockShadow", this.node).active = true; 1334 blockShadow.active = true;
1333 // cc.find("scrollContent/CategoryListRecommendLayout", this.node).active = false;
1334 } else { 1335 } else {
1335 cc.find("scrollContent/ViewPagerArea", this.node).active = false; 1336 cc.find("scrollContent/ViewPagerArea", this.node).active = false;
1336 cc.find("scrollContent/BlockShadow", this.node).active = false; 1337 blockShadow.active = false;
1337 // cc.find("scrollContent/CategoryListRecommendLayout", this.node).active = true;
1338 } 1338 }
1339 1339
1340 if (rightNodeLayout.childrenCount == 0 && iIndex == 1) { //恢复光标的界面可能需要初始化瀑布流
1341 this.getRightRecommendRequestData();
1342 }
1340 for (let i = 0; i < rightNodeLayout.childrenCount; i++) { 1343 for (let i = 0; i < rightNodeLayout.childrenCount; i++) {
1341 if (iIndex == 1) { //“休闲益智”采用单独的框架渲染 || iIndex == 3 1344 if (iIndex == 1) { //“休闲益智”采用单独的框架渲染 || iIndex == 3
1342 rightNodeLayout.children[i].active = true; 1345 rightNodeLayout.children[i].active = true;
......