Commit b994d0fb b994d0fbd9d852eba636e8a8fde551766a52cba4 by 金学艇

1.解决首页瀑布流和分类页的光标记忆问题

1 parent 74e4a3d7
...@@ -189,7 +189,7 @@ ...@@ -189,7 +189,7 @@
189 "array": [ 189 "array": [
190 0, 190 0,
191 0, 191 0,
192 271.0659484863281, 192 265.0037841796875,
193 0, 193 0,
194 0, 194 0,
195 0, 195 0,
......
...@@ -5708,8 +5708,8 @@ ...@@ -5708,8 +5708,8 @@
5708 } 5708 }
5709 ], 5709 ],
5710 "_useOriginalSize": false, 5710 "_useOriginalSize": false,
5711 "_string": "v1.0.2.2020031115", 5711 "_string": "v0.9.0.2020031117",
5712 "_N$string": "v1.0.2.2020031115", 5712 "_N$string": "v0.9.0.2020031117",
5713 "_fontSize": 24, 5713 "_fontSize": 24,
5714 "_lineHeight": 24, 5714 "_lineHeight": 24,
5715 "_enableWrapText": true, 5715 "_enableWrapText": true,
......
...@@ -147,6 +147,39 @@ cc.Class({ ...@@ -147,6 +147,39 @@ cc.Class({
147 147
148 }, 148 },
149 149
150 onKeyUp: function (event) {
151 try {
152 this._super(event);
153 var fiFocusTarget = null;
154 var fiCurrentFocus = this._fiCurrentFocus;
155 var oScrollParameter = null;
156
157 let nodeFrom = null;
158 let nodeTo = null;
159 if (event.keyCode == cc.macro.KEY.right || event.keyCode == Common.ANDROID_KEY.right) {
160 if (fiCurrentFocus.node.name == "ProgressBtn" || this._fiCurrentFocus.node.name == "Play") {
161 this._ComOperation.resumePlayState();
162 this._iFakeProgressStep = 0;
163 this._bFakeProgressStart = false;
164 this.unschedule(this.fakeStepForward);
165 }
166 }
167 if (event.keyCode == cc.macro.KEY.left || event.keyCode == Common.ANDROID_KEY.left) {
168 if (fiCurrentFocus.node.name == "ProgressBtn" || this._fiCurrentFocus.node.name == "Play") {
169 this._ComOperation.resumePlayState();
170 this._iFakeProgressStep = 0;
171 this._bFakeProgressStart = false;
172 this.unschedule(this.fakeStepBackward);
173 }
174 }
175 } catch (error) {
176 if (cc.sys.isNative) {
177 jsb.reflection.callStaticMethod("org/cocos2dx/javascript/AppActivity", "logInSceneI", "(Ljava/lang/String;)V", "onKeyUp Error in VarietyVideo==>" + error);
178 }
179 }
180
181 },
182
150 onKeyDown: function (event) { 183 onKeyDown: function (event) {
151 try { 184 try {
152 this._super(event); 185 this._super(event);
...@@ -196,7 +229,7 @@ cc.Class({ ...@@ -196,7 +229,7 @@ cc.Class({
196 // if (!this._bMediaFree && this._fiCurrentFocus.node.name == "ProgressBtn") { 229 // if (!this._bMediaFree && this._fiCurrentFocus.node.name == "ProgressBtn") {
197 // fiFocusTarget = cc.find("VideoArea/PlayPanel/Operation/Group/Collect", this.node).getComponent(FocusInfo); 230 // fiFocusTarget = cc.find("VideoArea/PlayPanel/Operation/Group/Collect", this.node).getComponent(FocusInfo);
198 // } 231 // }
199 cc.log("向下滑动:"+fiFocusTarget.node.name); 232 cc.log("向下滑动:" + fiFocusTarget.node.name);
200 this._cFocus.flyFocus(this._fiCurrentFocus, fiFocusTarget, Common.MOVE_DIRECTION_DOWN, 1.0, oScrollParameter); 233 this._cFocus.flyFocus(this._fiCurrentFocus, fiFocusTarget, Common.MOVE_DIRECTION_DOWN, 1.0, oScrollParameter);
201 } 234 }
202 if (this._fiCurrentFocus.node.name == "Play" && this._bShowProgress) { 235 if (this._fiCurrentFocus.node.name == "Play" && this._bShowProgress) {
...@@ -488,7 +521,7 @@ cc.Class({ ...@@ -488,7 +521,7 @@ cc.Class({
488 521
489 this._ComOperation.initPlayer(0, 0, Common.SCREEN_WIDTH, Common.SCREEN_HEIGHT, true, true); //测试 522 this._ComOperation.initPlayer(0, 0, Common.SCREEN_WIDTH, Common.SCREEN_HEIGHT, true, true); //测试
490 let options = {}; 523 let options = {};
491 options.playurl = "https://135zyv5.xw0371.com/2018/10/29/X05c7CG3VB91gi1M/playlist.m3u8"; 524 options.playurl = "http://mirror.aarnet.edu.au/pub/TED-talks/911Mothers_2010W-480p.mp4";
492 this._ComOperation.setURL(options); //测试播放地址 525 this._ComOperation.setURL(options); //测试播放地址
493 } catch (error) { 526 } catch (error) {
494 if (cc.sys.isNative) { 527 if (cc.sys.isNative) {
......
...@@ -457,9 +457,9 @@ cc.Topdraw.TVCanvas = ...@@ -457,9 +457,9 @@ cc.Topdraw.TVCanvas =
457 this._oNextSceneParameter.sceneName = strForwardSceneName; 457 this._oNextSceneParameter.sceneName = strForwardSceneName;
458 aSceneParameter.push(this._oNextSceneParameter); 458 aSceneParameter.push(this._oNextSceneParameter);
459 aSceneContext.push(this._oSceneContext); 459 aSceneContext.push(this._oSceneContext);
460 this._cLog.screenI("跳转场景1111111"); 460 // this._cLog.screenI("跳转场景1111111");
461 this._ComOperation && this._ComOperation.end(); 461 this._ComOperation && this._ComOperation.end();
462 this._cLog.screenI("跳转场景2222222"); 462 // this._cLog.screenI("跳转场景2222222");
463 Common.g_strCurrentSceneName = strForwardSceneName; 463 Common.g_strCurrentSceneName = strForwardSceneName;
464 cc.director.loadScene(strForwardSceneName); 464 cc.director.loadScene(strForwardSceneName);
465 } 465 }
......
...@@ -26,7 +26,20 @@ cc.Class({ ...@@ -26,7 +26,20 @@ cc.Class({
26 this._super(); 26 this._super();
27 this._oInit = {}; 27 this._oInit = {};
28 this._oSceneContext._iCurrentLeftIndex = 0; 28 this._oSceneContext._iCurrentLeftIndex = 0;
29 this._oSceneContext.focusPath = "TypeListArea/TypeListWrapper/TypeList/topNavi" + this._oSceneContext._iCurrentLeftIndex;
29 this._bIsDataListMoving = false; 30 this._bIsDataListMoving = false;
31 this._bInitCategoryListSuccess = false;
32
33 if (this._cApplication.getBackStatus()) {
34 //恢复上下文 包括
35 //光标位置 focusPath
36 let oSceneContext = this._cApplication.popSceneContext();
37 if (oSceneContext) {
38 this._oSceneContext = oSceneContext;
39 cc.log(this._oSceneContext);
40 }
41 this._cApplication.setBackStatus(false);
42 }
30 43
31 this._nodeTypeListWrapper = cc.find("TypeListArea/TypeListWrapper", this.node); 44 this._nodeTypeListWrapper = cc.find("TypeListArea/TypeListWrapper", this.node);
32 this._nodeTypeList = cc.find("TypeList", this._nodeTypeListWrapper); 45 this._nodeTypeList = cc.find("TypeList", this._nodeTypeListWrapper);
...@@ -110,7 +123,7 @@ cc.Class({ ...@@ -110,7 +123,7 @@ cc.Class({
110 ); 123 );
111 this._aFocusTargets[0]["topNavi" + i] = node; 124 this._aFocusTargets[0]["topNavi" + i] = node;
112 } 125 }
113 this._oSceneContext.focusPath = "TypeListArea/TypeListWrapper/TypeList/topNavi" + this._oSceneContext._iCurrentLeftIndex; 126 // this._oSceneContext.focusPath = "TypeListArea/TypeListWrapper/TypeList/topNavi" + this._oSceneContext._iCurrentLeftIndex;
114 this.checkDataReadyAndInitFocus(); 127 this.checkDataReadyAndInitFocus();
115 // this.requestMediaList(1); 128 // this.requestMediaList(1);
116 this.getSimulateRequest(); 129 this.getSimulateRequest();
...@@ -258,13 +271,10 @@ cc.Class({ ...@@ -258,13 +271,10 @@ cc.Class({
258 iStart1, (lvCategoryList.getShowCellRows() + lvCategoryList.getAlphaCellRows()) * lvCategoryList.getCellCountEachRow(), 271 iStart1, (lvCategoryList.getShowCellRows() + lvCategoryList.getAlphaCellRows()) * lvCategoryList.getCellCountEachRow(),
259 null, null 272 null, null
260 ); 273 );
261 // lvCategoryList.loadData(
262 // function (strResponse) {
263 // cc.log("/////" + this._oInit[this._oSceneContext._iCurrentLeftIndex]);
264 // let strResponse = this.aCategoryListJson[this._oSceneContext._iCurrentLeftIndex];
265 let strResponse = this._oInit[this._oSceneContext._iCurrentLeftIndex]; 274 let strResponse = this._oInit[this._oSceneContext._iCurrentLeftIndex];
275 lvCategoryList.loadData(
276 function (strResponse) {
266 lvCategoryList.renderInitData(strResponse, function () { 277 lvCategoryList.renderInitData(strResponse, function () {
267 // cc.log("InitCategoryList-------------------->");
268 var oJSONResult = JSON.parse(strResponse); 278 var oJSONResult = JSON.parse(strResponse);
269 // if (oJSONResult.resultSet.length <= 0) { //没有数据就显示占位图 279 // if (oJSONResult.resultSet.length <= 0) { //没有数据就显示占位图
270 // cc.find('BlankIcon', this.node).opacity = 255; 280 // cc.find('BlankIcon', this.node).opacity = 255;
...@@ -274,18 +284,16 @@ cc.Class({ ...@@ -274,18 +284,16 @@ cc.Class({
274 this._bInitCategoryListSuccess = true; 284 this._bInitCategoryListSuccess = true;
275 this._oSceneContext.categoryRecordIndexOfFirstCell = lvCategoryList.getRecordIndexOfFirstCellInPage(); 285 this._oSceneContext.categoryRecordIndexOfFirstCell = lvCategoryList.getRecordIndexOfFirstCellInPage();
276 286
277 this.checkDataReadyAndInitFocus(this._bInitCategoryListSuccess); 287 this.checkDataReadyAndInitFocus();
278 }); 288 });
279 // }, 289 }, null, this, strResponse
280 // null, 290 );
281 // this
282 // );
283 }, 291 },
284 292
285 293
286 294
287 checkDataReadyAndInitFocus: function () { 295 checkDataReadyAndInitFocus: function () {
288 if (!this._bIsFocusInit) { 296 if (!this._bIsFocusInit && this._bInitCategoryListSuccess) {
289 this.scheduleOnce(() => { //指定0让回调函数在下一帧立即执行 297 this.scheduleOnce(() => { //指定0让回调函数在下一帧立即执行
290 this.initFocus(); 298 this.initFocus();
291 }, 0); 299 }, 0);
...@@ -303,7 +311,10 @@ cc.Class({ ...@@ -303,7 +311,10 @@ cc.Class({
303 this._cFocus.init('focusContainer', this, 311 this._cFocus.init('focusContainer', this,
304 nodeInitFocus.getComponent(FocusInfo), 312 nodeInitFocus.getComponent(FocusInfo),
305 Common.SCREEN_WIDTH, Common.SCREEN_HEIGHT, 10, 6, 1.1, true); 313 Common.SCREEN_WIDTH, Common.SCREEN_HEIGHT, 10, 6, 1.1, true);
314
315 if (0 == nodeInitFocus.name.indexOf("topNavi")) {
306 this._cFocus.hide(); 316 this._cFocus.hide();
317 }
307 318
308 //处理焦点位于下方问题 319 //处理焦点位于下方问题
309 if (this._oSceneContext.typeListY) { 320 if (this._oSceneContext.typeListY) {
...@@ -378,6 +389,7 @@ cc.Class({ ...@@ -378,6 +389,7 @@ cc.Class({
378 // cc.log("当前时多少条目:" + index); 389 // cc.log("当前时多少条目:" + index);
379 let lvCategoryList = this.node.getChildByName('CategoryList').getComponent(ListView); 390 let lvCategoryList = this.node.getChildByName('CategoryList').getComponent(ListView);
380 if (lvCategoryList.scrollARowUp(index, this._oInit[this._oSceneContext._iCurrentLeftIndex])) { 391 if (lvCategoryList.scrollARowUp(index, this._oInit[this._oSceneContext._iCurrentLeftIndex])) {
392 this._oSceneContext.categoryRecordIndexOfFirstCell = lvCategoryList.getRecordIndexOfFirstCellInPage();
381 return; 393 return;
382 } 394 }
383 } 395 }
...@@ -396,6 +408,7 @@ cc.Class({ ...@@ -396,6 +408,7 @@ cc.Class({
396 var index = parseInt(this._fiCurrentFocus.node.getName().replace('CategoryListCell', '')); 408 var index = parseInt(this._fiCurrentFocus.node.getName().replace('CategoryListCell', ''));
397 let lvCategoryList = this.node.getChildByName('CategoryList').getComponent(ListView); 409 let lvCategoryList = this.node.getChildByName('CategoryList').getComponent(ListView);
398 if (lvCategoryList.scrollARowDown(null, index, this._oInit[this._oSceneContext._iCurrentLeftIndex])) { 410 if (lvCategoryList.scrollARowDown(null, index, this._oInit[this._oSceneContext._iCurrentLeftIndex])) {
411 this._oSceneContext.categoryRecordIndexOfFirstCell = lvCategoryList.getRecordIndexOfFirstCellInPage();
399 return; 412 return;
400 } 413 }
401 } 414 }
...@@ -532,13 +545,15 @@ cc.Class({ ...@@ -532,13 +545,15 @@ cc.Class({
532 // ); 545 // );
533 } 546 }
534 547
548 if (0 == fiFrom.node.getName().indexOf('topNavi')) {
535 this._oSceneContext._iCurrentLeftIndex = iIndex; 549 this._oSceneContext._iCurrentLeftIndex = iIndex;
536 550 this._oSceneContext.categoryRecordIndexOfFirstCell = 0; //将列表记录置空
537 this.scheduleOnce(function () { 551 this.scheduleOnce(function () {
538 // this.requestMediaList(1); //重新渲染CategoryList 552 // this.requestMediaList(1); //重新渲染CategoryList
539 this.getSimulateRequest(); 553 this.getSimulateRequest();
540 }, 0); 554 }, 0);
541 } 555 }
556 }
542 557
543 if (0 == fiTo.node.getName().indexOf('CategoryListCell')) { 558 if (0 == fiTo.node.getName().indexOf('CategoryListCell')) {
544 fiTo.node.getChildByName("Normal").active = false; 559 fiTo.node.getChildByName("Normal").active = false;
......
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
39 "name": "frame1", 39 "name": "frame1",
40 "resultSet": [ 40 "resultSet": [
41 { 41 {
42 "name": "Carousel0", 42 "name": "Carousel1",
43 "code": "promotionItem_fd456495-2e32-44e1-9d92-450227d4afa3", 43 "code": "promotionItem_fd456495-2e32-44e1-9d92-450227d4afa3",
44 "left": 64, 44 "left": 64,
45 "top": 0, 45 "top": 0,
...@@ -49,7 +49,7 @@ ...@@ -49,7 +49,7 @@
49 "height": 167 49 "height": 167
50 }, 50 },
51 { 51 {
52 "name": "dailyRecommend", 52 "name": "dailyRecommend2",
53 "code": "promotionItem_4ca66642-33d0-41c9-9913-df131a79a375", 53 "code": "promotionItem_4ca66642-33d0-41c9-9913-df131a79a375",
54 "left": 359, 54 "left": 359,
55 "top": 0, 55 "top": 0,
...@@ -59,7 +59,7 @@ ...@@ -59,7 +59,7 @@
59 "height": 167 59 "height": 167
60 }, 60 },
61 { 61 {
62 "name": "dailyRecommend", 62 "name": "dailyRecommend3",
63 "code": "promotionItem_c5f58c16-48a5-4796-ab52-rwvh6u5j55", 63 "code": "promotionItem_c5f58c16-48a5-4796-ab52-rwvh6u5j55",
64 "left": 652, 64 "left": 652,
65 "top": 0, 65 "top": 0,
...@@ -69,7 +69,7 @@ ...@@ -69,7 +69,7 @@
69 "height": 167 69 "height": 167
70 }, 70 },
71 { 71 {
72 "name": "dailyRecommend", 72 "name": "dailyRecommend4",
73 "code": "promotionItem_c5f58c16-48a5-4796-ab52-41679fc88a6d", 73 "code": "promotionItem_c5f58c16-48a5-4796-ab52-41679fc88a6d",
74 "left": 946, 74 "left": 946,
75 "top": 0, 75 "top": 0,
...@@ -141,19 +141,19 @@ ...@@ -141,19 +141,19 @@
141 "code": "promotionItem_e29b33e4-8954-4eerthy6rthg54er" 141 "code": "promotionItem_e29b33e4-8954-4eerthy6rthg54er"
142 }, 142 },
143 { 143 {
144 "name": "Subject3", 144 "name": "Subject4",
145 "imageURL": "upload/image/main/block4_4.png", 145 "imageURL": "upload/image/main/block4_4.png",
146 "tvlink": "{\"click\":[{\"action\":\"ChangeScene\",\"parameters\":{\"sceneName\":\"sceneGameCategory\"}}]}", 146 "tvlink": "{\"click\":[{\"action\":\"ChangeScene\",\"parameters\":{\"sceneName\":\"sceneGameCategory\"}}]}",
147 "code": "promotionItem_e29b33e4-8954-vwregv54thw6" 147 "code": "promotionItem_e29b33e4-8954-vwregv54thw6"
148 }, 148 },
149 { 149 {
150 "name": "Subject3", 150 "name": "Subject5",
151 "imageURL": "upload/image/main/block4_5.png", 151 "imageURL": "upload/image/main/block4_5.png",
152 "tvlink": "{\"click\":[{\"action\":\"ChangeScene\",\"parameters\":{\"sceneName\":\"sceneGameCategory\"}}]}", 152 "tvlink": "{\"click\":[{\"action\":\"ChangeScene\",\"parameters\":{\"sceneName\":\"sceneGameCategory\"}}]}",
153 "code": "promotionItem_e29b33e4-8954-bq4wrjhwbt4t" 153 "code": "promotionItem_e29b33e4-8954-bq4wrjhwbt4t"
154 }, 154 },
155 { 155 {
156 "name": "Subject4", 156 "name": "Subject6",
157 "imageURL": "upload/image/main/block4_6.png", 157 "imageURL": "upload/image/main/block4_6.png",
158 "tvlink": "{\"click\":[{\"action\":\"ChangeScene\",\"parameters\":{\"sceneName\":\"sceneGameCategory\"}}]}", 158 "tvlink": "{\"click\":[{\"action\":\"ChangeScene\",\"parameters\":{\"sceneName\":\"sceneGameCategory\"}}]}",
159 "code": "promotionItem_57aea4b3-7716-4we5j56trhgser2" 159 "code": "promotionItem_57aea4b3-7716-4we5j56trhgser2"
...@@ -184,7 +184,7 @@ ...@@ -184,7 +184,7 @@
184 "disable": true 184 "disable": true
185 }, 185 },
186 { 186 {
187 "name": "SingerList", 187 "name": "SingerList1",
188 "code": "promotionItem_0a911d4c-9223-4d49-se5hj54uh4w5g45w", 188 "code": "promotionItem_0a911d4c-9223-4d49-se5hj54uh4w5g45w",
189 "left": 63, 189 "left": 63,
190 "top": 64, 190 "top": 64,
...@@ -194,7 +194,7 @@ ...@@ -194,7 +194,7 @@
194 "height": 228 194 "height": 228
195 }, 195 },
196 { 196 {
197 "name": "SingerList", 197 "name": "SingerList2",
198 "code": "promotionItem_c388af5a-0351-43c4-e5sjhu45h54wh45h", 198 "code": "promotionItem_c388af5a-0351-43c4-e5sjhu45h54wh45h",
199 "left": 653, 199 "left": 653,
200 "top": 64, 200 "top": 64,
...@@ -214,7 +214,7 @@ ...@@ -214,7 +214,7 @@
214 "name": "frame3", 214 "name": "frame3",
215 "resultSet": [ 215 "resultSet": [
216 { 216 {
217 "name": "SingerList", 217 "name": "SingerList3",
218 "code": "promotionItem_c388af5a-0351-43c4we5jh45j45jh54hj", 218 "code": "promotionItem_c388af5a-0351-43c4we5jh45j45jh54hj",
219 "left": 63, 219 "left": 63,
220 "top": 24, 220 "top": 24,
...@@ -224,7 +224,7 @@ ...@@ -224,7 +224,7 @@
224 "height": 228 224 "height": 228
225 }, 225 },
226 { 226 {
227 "name": "SingerList", 227 "name": "SingerList4",
228 "code": "promotionItem_c388af5a-0351-43c4j56j54hw4h54", 228 "code": "promotionItem_c388af5a-0351-43c4j56j54hw4h54",
229 "left": 456, 229 "left": 456,
230 "top": 24, 230 "top": 24,
...@@ -234,7 +234,7 @@ ...@@ -234,7 +234,7 @@
234 "height": 228 234 "height": 228
235 }, 235 },
236 { 236 {
237 "name": "SingerList", 237 "name": "SingerList5",
238 "code": "promotionItem_c388af5a-0351-43c4-w45jh45h54h5h", 238 "code": "promotionItem_c388af5a-0351-43c4-w45jh45h54h5h",
239 "left": 848, 239 "left": 848,
240 "top": 24, 240 "top": 24,
......