1.新增历史和收藏界面
Showing
15 changed files
with
149 additions
and
29 deletions
assets/Scene/sceneHistoryAndCollect.fire
0 → 100644
This diff is collapsed.
Click to expand it.
... | @@ -469,7 +469,8 @@ cc.Class({ | ... | @@ -469,7 +469,8 @@ cc.Class({ |
469 | 469 | ||
470 | doCurrentFocusTVLinkAction: function (strAction) { | 470 | doCurrentFocusTVLinkAction: function (strAction) { |
471 | let strTVLink = this._fiCurrentFocus.getTVLink(); | 471 | let strTVLink = this._fiCurrentFocus.getTVLink(); |
472 | cc.log("tvlink===============" + strTVLink); | 472 | let cellData = JSON.stringify(this._fiCurrentFocus.node.getComponent(ListCell)._cellData); |
473 | // cc.log("tvlink===============" + JSON.stringify(this._fiCurrentFocus.node.getComponent(ListCell)._cellData)); | ||
473 | try { | 474 | try { |
474 | let oTVLink = JSON.parse(strTVLink); | 475 | let oTVLink = JSON.parse(strTVLink); |
475 | let aOperationList = oTVLink.click; | 476 | let aOperationList = oTVLink.click; |
... | @@ -478,6 +479,7 @@ cc.Class({ | ... | @@ -478,6 +479,7 @@ cc.Class({ |
478 | switch (aOperationList[i].action) { | 479 | switch (aOperationList[i].action) { |
479 | case "changeLayout": | 480 | case "changeLayout": |
480 | default: | 481 | default: |
482 | aOperationList[i]['parameters']["cellData"] = cellData; | ||
481 | this.doTVLinkAction(aOperationList[i]); | 483 | this.doTVLinkAction(aOperationList[i]); |
482 | break; | 484 | break; |
483 | } | 485 | } | ... | ... |
... | @@ -34,6 +34,7 @@ cc.Class({ | ... | @@ -34,6 +34,7 @@ cc.Class({ |
34 | this._oSceneContext._packageName = ""; | 34 | this._oSceneContext._packageName = ""; |
35 | this._oSceneContext._className = ""; | 35 | this._oSceneContext._className = ""; |
36 | this._oSceneContext._downloadUrl = ""; | 36 | this._oSceneContext._downloadUrl = ""; |
37 | this._oSceneContext._cellData = ""; | ||
37 | this._oSceneContext._iCurrentLeftIndex = 1; | 38 | this._oSceneContext._iCurrentLeftIndex = 1; |
38 | this._oSceneContext.focusPath = "ButtonOpen"; | 39 | this._oSceneContext.focusPath = "ButtonOpen"; |
39 | 40 | ||
... | @@ -55,10 +56,12 @@ cc.Class({ | ... | @@ -55,10 +56,12 @@ cc.Class({ |
55 | this._oSceneContext._packageName = aSceneParameter[aSceneParameter.length - 1].packageName; | 56 | this._oSceneContext._packageName = aSceneParameter[aSceneParameter.length - 1].packageName; |
56 | this._oSceneContext._className = aSceneParameter[aSceneParameter.length - 1].activityName; | 57 | this._oSceneContext._className = aSceneParameter[aSceneParameter.length - 1].activityName; |
57 | this._oSceneContext._downloadUrl = aSceneParameter[aSceneParameter.length - 1].downloadUrl; | 58 | this._oSceneContext._downloadUrl = aSceneParameter[aSceneParameter.length - 1].downloadUrl; |
59 | this._oSceneContext._cellData = aSceneParameter[aSceneParameter.length - 1].cellData; | ||
58 | } else if (aSceneParameter) { | 60 | } else if (aSceneParameter) { |
59 | this._oSceneContext._packageName = aSceneParameter.packageName; | 61 | this._oSceneContext._packageName = aSceneParameter.packageName; |
60 | this._oSceneContext._className = aSceneParameter.activityName; | 62 | this._oSceneContext._className = aSceneParameter.activityName; |
61 | this._oSceneContext._downloadUrl = aSceneParameter.downloadUrl; | 63 | this._oSceneContext._downloadUrl = aSceneParameter.downloadUrl; |
64 | this._oSceneContext._cellData = aSceneParameter.cellData; | ||
62 | } | 65 | } |
63 | 66 | ||
64 | cc.log("类名:" + this._oSceneContext._packageName); | 67 | cc.log("类名:" + this._oSceneContext._packageName); |
... | @@ -84,6 +87,28 @@ cc.Class({ | ... | @@ -84,6 +87,28 @@ cc.Class({ |
84 | this.initPrefab(); //获取导航栏信息 | 87 | this.initPrefab(); //获取导航栏信息 |
85 | // this.getTypeList(); | 88 | // this.getTypeList(); |
86 | this.checkPfbReadyAndInitPage(); | 89 | this.checkPfbReadyAndInitPage(); |
90 | this.saveHistory(); | ||
91 | }, | ||
92 | |||
93 | saveHistory: function () { | ||
94 | var oDataCell = JSON.parse(this._oSceneContext._cellData); | ||
95 | var gameHistory = JSON.parse(cc.sys.localStorage.getItem("gameHistoryList")); | ||
96 | if (gameHistory != null) { | ||
97 | if (-1 == JSON.stringify(gameHistory.resultSet).indexOf(JSON.stringify(oDataCell))) { | ||
98 | gameHistory.resultSet.push(oDataCell); | ||
99 | gameHistory.count++; | ||
100 | cc.sys.localStorage.setItem("gameHistoryList", JSON.stringify(gameHistory)); | ||
101 | } | ||
102 | } else { | ||
103 | let oData = {}; | ||
104 | oData.businessCode = "success"; | ||
105 | oData.count = 1; | ||
106 | oData.resultSet = []; | ||
107 | oData.resultSet.push(oDataCell); | ||
108 | cc.sys.localStorage.setItem("gameHistoryList", JSON.stringify(oData)); | ||
109 | } | ||
110 | |||
111 | cc.log("检查存储的数据:" + cc.sys.localStorage.getItem("gameHistoryList")); | ||
87 | }, | 112 | }, |
88 | 113 | ||
89 | initPrefab: function () { | 114 | initPrefab: function () { | ... | ... |
assets/Script/historyAndCollect.js
0 → 100644
This diff is collapsed.
Click to expand it.
... | @@ -15,6 +15,7 @@ cc.Class({ | ... | @@ -15,6 +15,7 @@ cc.Class({ |
15 | normalName: cc.Label, | 15 | normalName: cc.Label, |
16 | Name: cc.Label, | 16 | Name: cc.Label, |
17 | textScore: cc.Label, //分数 | 17 | textScore: cc.Label, //分数 |
18 | _cellData: null, | ||
18 | }, | 19 | }, |
19 | 20 | ||
20 | statics: { | 21 | statics: { |
... | @@ -32,6 +33,7 @@ cc.Class({ | ... | @@ -32,6 +33,7 @@ cc.Class({ |
32 | }, | 33 | }, |
33 | 34 | ||
34 | render(oData, iRecordIndex) { | 35 | render(oData, iRecordIndex) { |
36 | this._cellData = oData; | ||
35 | // this.id = oData.id; | 37 | // this.id = oData.id; |
36 | // cc.log("categoryList-->name: "+JSON.stringify(oData)); | 38 | // cc.log("categoryList-->name: "+JSON.stringify(oData)); |
37 | this.activeName1.string = oData.name; | 39 | this.activeName1.string = oData.name; |
... | @@ -65,7 +67,7 @@ cc.Class({ | ... | @@ -65,7 +67,7 @@ cc.Class({ |
65 | // cc.loader.loadRes(oData.image[0].fileUrl, cc.Texture2D, function (err, texture) { | 67 | // cc.loader.loadRes(oData.image[0].fileUrl, cc.Texture2D, function (err, texture) { |
66 | // self.pic.spriteFrame = new cc.SpriteFrame(texture); | 68 | // self.pic.spriteFrame = new cc.SpriteFrame(texture); |
67 | // }); | 69 | // }); |
68 | cc.log("pfbCategoryListCell.."+self.pic); | 70 | cc.log("pfbCategoryListCell.." + self.pic); |
69 | if (self.pic) { | 71 | if (self.pic) { |
70 | Network.loadImageInNativeRuntime( | 72 | Network.loadImageInNativeRuntime( |
71 | Common.TOPDRAW_IMAGE_SERVER + oData.image[0].fileUrl, null, | 73 | Common.TOPDRAW_IMAGE_SERVER + oData.image[0].fileUrl, null, | ... | ... |
assets/Script/test.js
0 → 100644
... | @@ -68,28 +68,10 @@ cc.Class({ | ... | @@ -68,28 +68,10 @@ cc.Class({ |
68 | this._nodeEpisodeList = cc.find("EpisodeList", this._nodeEpisodeListWrapper); | 68 | this._nodeEpisodeList = cc.find("EpisodeList", this._nodeEpisodeListWrapper); |
69 | this._nodeEpisodeList.addComponent(TVScrollParameter); | 69 | this._nodeEpisodeList.addComponent(TVScrollParameter); |
70 | 70 | ||
71 | // this.initPrefab(); | ||
72 | this.checkPfbReadyAndInitPage(); | 71 | this.checkPfbReadyAndInitPage(); |
73 | this.checkDataReadyAndInitFocus(); | 72 | this.checkDataReadyAndInitFocus(); |
74 | }, | 73 | }, |
75 | 74 | ||
76 | // initPrefab: function () { | ||
77 | // for (let i = 0; i < 4; i++) { | ||
78 | // let nodeEpisodeCell = cc.instantiate(this.PFB_EPISODE); | ||
79 | // nodeEpisodeCell.x = nodeEpisodeCell.width / 2 + (i) * (nodeEpisodeCell.width + 20); | ||
80 | // this._nodeEpisodeList.addChild(nodeEpisodeCell, 10, "EpisodeListCell" + i); | ||
81 | // let fiEpisodeBlock = nodeEpisodeCell.addComponent(FocusInfo); | ||
82 | // fiEpisodeBlock.init('{"click": [{"action": "ChangeScene","parameters": {"sceneName":"sceneProgramPlayerFullScreen"}}]}' | ||
83 | // , true, null, null, 1.0); | ||
84 | // this._aFocusTargets[0]['episode_list_cell_' + i] = nodeEpisodeCell; | ||
85 | |||
86 | // // let borderX = nodeEpisodeCell.x - nodeEpisodeCell.width / 2; //搞边框 | ||
87 | // // let borderY = nodeEpisodeCell.y - nodeEpisodeCell.height / 2; | ||
88 | // // this._graphicsLine.roundRect(borderX, borderY, 278, 175, 20);//圆角矩形路径 | ||
89 | // // this._graphicsLine.stroke(); //绘制路径 | ||
90 | // } | ||
91 | // }, | ||
92 | |||
93 | getGatherDetailList: function () { | 75 | getGatherDetailList: function () { |
94 | Network.ajax("GET", Common.TOPDRAW_API_SERVER + "videoDetail/movie_detail_list_by_media.json", null, null, | 76 | Network.ajax("GET", Common.TOPDRAW_API_SERVER + "videoDetail/movie_detail_list_by_media.json", null, null, |
95 | function (strResponse) { | 77 | function (strResponse) { |
... | @@ -199,6 +181,7 @@ cc.Class({ | ... | @@ -199,6 +181,7 @@ cc.Class({ |
199 | 181 | ||
200 | // this.getTypeList(); | 182 | // this.getTypeList(); |
201 | 183 | ||
184 | this.checkCollect(); | ||
202 | this.getGatherDetailList(); //获取剧集列表 | 185 | this.getGatherDetailList(); //获取剧集列表 |
203 | this.getPlayURLAndPlay(); | 186 | this.getPlayURLAndPlay(); |
204 | } else { | 187 | } else { |
... | @@ -213,6 +196,25 @@ cc.Class({ | ... | @@ -213,6 +196,25 @@ cc.Class({ |
213 | }, this, "uuid"); | 196 | }, this, "uuid"); |
214 | }, | 197 | }, |
215 | 198 | ||
199 | checkCollect: function () { | ||
200 | var collectList = JSON.parse(cc.sys.localStorage.getItem("collectList")); | ||
201 | if (collectList != null) { | ||
202 | if (-1 != JSON.stringify(collectList.resultSet).indexOf(this._strResponse)) { | ||
203 | this._bCollected = true; | ||
204 | // collectList.resultSet.push(JSON.parse(strResponse)); | ||
205 | // collectList.count++; | ||
206 | // cc.sys.localStorage.setItem("collectList", JSON.stringify(collectList)); | ||
207 | } | ||
208 | } else { | ||
209 | let oData = {}; | ||
210 | oData.businessCode = "success"; | ||
211 | oData.count = 0; | ||
212 | oData.resultSet = []; | ||
213 | // oData.resultSet.push(JSON.parse(strResponse)); | ||
214 | cc.sys.localStorage.setItem("collectList", JSON.stringify(oData)); | ||
215 | } | ||
216 | }, | ||
217 | |||
216 | getPlayURLAndPlay: function () { | 218 | getPlayURLAndPlay: function () { |
217 | try { | 219 | try { |
218 | this._ComOperation.initPlayer(64, 56, 564, 317, true, true); //这里采用左右边距对应android坐标 fix jerry | 220 | this._ComOperation.initPlayer(64, 56, 564, 317, true, true); //这里采用左右边距对应android坐标 fix jerry |
... | @@ -358,15 +360,15 @@ cc.Class({ | ... | @@ -358,15 +360,15 @@ cc.Class({ |
358 | case cc.macro.KEY.enter: | 360 | case cc.macro.KEY.enter: |
359 | case cc.macro.KEY.space: | 361 | case cc.macro.KEY.space: |
360 | case Common.ANDROID_KEY.enter: | 362 | case Common.ANDROID_KEY.enter: |
361 | if (0 == this._fiCurrentFocus.node.name.indexOf('Collect')) { | 363 | if (0 == this._fiCurrentFocus.node.name.indexOf('ButtonCollect')) { |
362 | this._bCollected = !this._bCollected; | 364 | this._bCollected = !this._bCollected; |
363 | if (this._bCollected) { | 365 | this.collectMovie(); |
364 | this.commonSimpleTip("恭喜您!收藏成功!", 3); | 366 | |
365 | } | 367 | return; |
366 | let icon = this._bCollected ? "GameDetail/be_collected" : "GameDetail/not_collected"; | 368 | // let icon = this._bCollected ? "GameDetail/be_collected" : "GameDetail/not_collected"; |
367 | cc.loader.loadRes(icon, cc.Texture2D, function (err, texture) { | 369 | // cc.loader.loadRes(icon, cc.Texture2D, function (err, texture) { |
368 | self._fiCurrentFocus.node.getComponent(cc.Sprite).spriteFrame = new cc.SpriteFrame(texture, cc.rect(0, 56, self._fiCurrentFocus.node.width, 56)); | 370 | // self._fiCurrentFocus.node.getComponent(cc.Sprite).spriteFrame = new cc.SpriteFrame(texture, cc.rect(0, 56, self._fiCurrentFocus.node.width, 56)); |
369 | }); | 371 | // }); |
370 | } else if (0 == this._fiCurrentFocus.node.name.indexOf('LabelDesc')) { | 372 | } else if (0 == this._fiCurrentFocus.node.name.indexOf('LabelDesc')) { |
371 | cc.find("FullDesc", this.node).active = true; | 373 | cc.find("FullDesc", this.node).active = true; |
372 | } else if (0 == this._fiCurrentFocus.node.name.indexOf('ButtonOpen') || 0 == this._fiCurrentFocus.node.name.indexOf('Pic')) { | 374 | } else if (0 == this._fiCurrentFocus.node.name.indexOf('ButtonOpen') || 0 == this._fiCurrentFocus.node.name.indexOf('Pic')) { |
... | @@ -383,6 +385,29 @@ cc.Class({ | ... | @@ -383,6 +385,29 @@ cc.Class({ |
383 | } | 385 | } |
384 | }, | 386 | }, |
385 | 387 | ||
388 | collectMovie: function () { | ||
389 | |||
390 | var collectList = JSON.parse(cc.sys.localStorage.getItem("collectList")); | ||
391 | // cc.log("//////" + JSON.stringify(this._oInit)); | ||
392 | if (this._bCollected && -1 == JSON.stringify(collectList.resultSet).indexOf(JSON.stringify(this._oInit))) { | ||
393 | this.commonSimpleTip("恭喜您!收藏成功!", 3); | ||
394 | collectList.resultSet.push(this._oInit); | ||
395 | collectList.count++; | ||
396 | cc.sys.localStorage.setItem("collectList", JSON.stringify(collectList)); | ||
397 | } else if (-1 != (JSON.stringify(collectList.resultSet).indexOf(JSON.stringify(this._oInit)))) { | ||
398 | this.commonSimpleTip("取消收藏!", 3); | ||
399 | for (let i = 0; i < collectList.resultSet.length; i++) { | ||
400 | if (JSON.stringify(collectList.resultSet[i]) == JSON.stringify(this._oInit)) { | ||
401 | collectList.resultSet.splice(i, 1); | ||
402 | collectList.count <= 0 ? collectList.count = 0 : collectList.count--; | ||
403 | cc.sys.localStorage.setItem("collectList", JSON.stringify(collectList)); | ||
404 | } | ||
405 | } | ||
406 | } | ||
407 | |||
408 | cc.log("检查存储:" + cc.sys.localStorage.getItem("collectList")); | ||
409 | }, | ||
410 | |||
386 | doCurrentFocusTVLinkAction: function (strAction) { | 411 | doCurrentFocusTVLinkAction: function (strAction) { |
387 | let strTVLink = this._fiCurrentFocus.getTVLink(); | 412 | let strTVLink = this._fiCurrentFocus.getTVLink(); |
388 | cc.log("tvlink===============" + strTVLink); | 413 | cc.log("tvlink===============" + strTVLink); | ... | ... |
assets/Texture/Main/blank_hint.jpg
0 → 100644

38.1 KB
assets/Texture/Mask/cartoon_cell_mask.png
0 → 100644

3.67 KB

7.16 KB

10.5 KB

10.1 KB

10.4 KB
... | @@ -18,7 +18,17 @@ | ... | @@ -18,7 +18,17 @@ |
18 | "height": 168 | 18 | "height": 168 |
19 | } | 19 | } |
20 | ] | 20 | ] |
21 | } | 21 | }, |
22 | "image": [ | ||
23 | { | ||
24 | "extension": ".png", | ||
25 | "size": 100405, | ||
26 | "enable": true, | ||
27 | "fileUrl": "upload/image/games/o宝脑力训练270-167.jpg", | ||
28 | "width": 270, | ||
29 | "height": 167 | ||
30 | } | ||
31 | ] | ||
22 | } | 32 | } |
23 | ] | 33 | ] |
24 | } | 34 | } |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
1 | { | ||
2 | "//": "upload/image/category/", | ||
3 | "businessCode": "success", | ||
4 | "count": 7, | ||
5 | "currentTime": 1581664965116, | ||
6 | "description": "", | ||
7 | "resultSet": [ | ||
8 | { | ||
9 | "name": "游戏历史", | ||
10 | "image": [ | ||
11 | { | ||
12 | "extension": ".png", | ||
13 | "code": "image_e9fea105-0412-4600-a0f1-f606a003c63f", | ||
14 | "size": 74263, | ||
15 | "enable": true, | ||
16 | "name": "b2b1bb5f-a956-4930-9273-eb72920a9faa.png", | ||
17 | "fileUrl": "upload/image/historyAndCollect/icon_history.png", | ||
18 | "id": 7509, | ||
19 | "type": 2, | ||
20 | "width": 202, | ||
21 | "height": 94 | ||
22 | } | ||
23 | ] | ||
24 | }, | ||
25 | { | ||
26 | "name": "我的收藏", | ||
27 | "image": [ | ||
28 | { | ||
29 | "extension": ".png", | ||
30 | "code": "image_e9fea105-0412-4600-a0f1-f606a003c63f", | ||
31 | "size": 74263, | ||
32 | "enable": true, | ||
33 | "name": "b2b1bb5f-a956-4930-9273-eb72920a9faa.png", | ||
34 | "fileUrl": "upload/image/historyAndCollect/icon_collect.png", | ||
35 | "id": 7509, | ||
36 | "type": 2, | ||
37 | "width": 202, | ||
38 | "height": 94 | ||
39 | } | ||
40 | ] | ||
41 | } | ||
42 | ] | ||
43 | } | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
-
Please register or sign in to post a comment