0904 tag
Showing
7 changed files
with
158 additions
and
0 deletions
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
... | @@ -864,6 +864,20 @@ cc.Class({ | ... | @@ -864,6 +864,20 @@ cc.Class({ |
864 | }); | 864 | }); |
865 | } | 865 | } |
866 | 866 | ||
867 | if (0 == fiFrom.node.getName().indexOf('EditorSprite')) { //我的收藏按钮 | ||
868 | // fiTo.node.getComponent(cc.Sprite).spriteFrame.setRect(cc.rect(0, 54, 142, 54)); | ||
869 | cc.loader.loadRes('button/editor_button', cc.Texture2D, function (err, texture) { | ||
870 | fiFrom.node.getComponent(cc.Sprite).spriteFrame = new cc.SpriteFrame(texture, cc.rect(0, 0, 137, 64)); | ||
871 | }); | ||
872 | } | ||
873 | |||
874 | if (0 == fiFrom.node.getName().indexOf('IndexSprite')) { //我的收藏按钮 | ||
875 | // fiTo.node.getComponent(cc.Sprite).spriteFrame.setRect(cc.rect(0, 54, 142, 54)); | ||
876 | cc.loader.loadRes('button/index_button', cc.Texture2D, function (err, texture) { | ||
877 | fiFrom.node.getComponent(cc.Sprite).spriteFrame = new cc.SpriteFrame(texture, cc.rect(0, 0, 137, 64)); | ||
878 | }); | ||
879 | } | ||
880 | |||
867 | // if (0 == fiFrom.node.getName().indexOf('OtherListCell')) { | 881 | // if (0 == fiFrom.node.getName().indexOf('OtherListCell')) { |
868 | // fiFrom.node.getChildByName("CollectionBg").opacity = 0; | 882 | // fiFrom.node.getChildByName("CollectionBg").opacity = 0; |
869 | // fiFrom.node.getComponent(ListCell).setUIWithoutFocus(); | 883 | // fiFrom.node.getComponent(ListCell).setUIWithoutFocus(); |
... | @@ -918,6 +932,19 @@ cc.Class({ | ... | @@ -918,6 +932,19 @@ cc.Class({ |
918 | }); | 932 | }); |
919 | } | 933 | } |
920 | 934 | ||
935 | if (0 == fiTo.node.getName().indexOf('EditorSprite')) { //我的收藏按钮 | ||
936 | // fiTo.node.getComponent(cc.Sprite).spriteFrame.setRect(cc.rect(0, 54, 142, 54)); | ||
937 | cc.loader.loadRes('button/editor_button', cc.Texture2D, function (err, texture) { | ||
938 | fiTo.node.getComponent(cc.Sprite).spriteFrame = new cc.SpriteFrame(texture, cc.rect(0, 64, 137, 64)); | ||
939 | }); | ||
940 | } | ||
941 | |||
942 | if (0 == fiTo.node.getName().indexOf('IndexSprite')) { //我的收藏按钮 | ||
943 | // fiTo.node.getComponent(cc.Sprite).spriteFrame.setRect(cc.rect(0, 54, 142, 54)); | ||
944 | cc.loader.loadRes('button/index_button', cc.Texture2D, function (err, texture) { | ||
945 | fiTo.node.getComponent(cc.Sprite).spriteFrame = new cc.SpriteFrame(texture, cc.rect(0, 64, 137, 64)); | ||
946 | }); | ||
947 | } | ||
921 | // if (0 == fiTo.node.getName().indexOf('OtherListCell')) { //显示收藏框框 | 948 | // if (0 == fiTo.node.getName().indexOf('OtherListCell')) { //显示收藏框框 |
922 | // fiTo.node.getChildByName("CollectionBg").opacity = 255; | 949 | // fiTo.node.getChildByName("CollectionBg").opacity = 255; |
923 | // fiTo.node.getComponent(ListCell).setUIWithFocus(); | 950 | // fiTo.node.getComponent(ListCell).setUIWithFocus(); | ... | ... |
assets/Script/listCell/DiaryListCell.js
0 → 100644
1 | var Common = require('Common'); | ||
2 | var FocusInfo = require('FocusInfo'); | ||
3 | var ListCell = require('ListCell'); | ||
4 | var Network = require('Network'); | ||
5 | |||
6 | cc.Class({ | ||
7 | extends: ListCell, | ||
8 | |||
9 | properties: { | ||
10 | id: 0, | ||
11 | pic: cc.Sprite, | ||
12 | activeName1: cc.Label, | ||
13 | activeName2: cc.Label, | ||
14 | normalName: cc.Label, | ||
15 | textPlayTimes: cc.Label, //观看次数 | ||
16 | textScore: cc.Label, //分数 | ||
17 | deleteButtonImg: cc.Sprite, //删除图标 | ||
18 | }, | ||
19 | |||
20 | statics: { | ||
21 | PFB_NAME: 'prefab/pfbDiaryListCell', | ||
22 | CELL_NAME: 'DiaryListCell', | ||
23 | }, | ||
24 | |||
25 | init: function (iCellIndex, bIsFocusEnable, compSceneCanvas) { | ||
26 | //准备焦点坐标 | ||
27 | let fiCategoryBlock = this.node.addComponent(FocusInfo); | ||
28 | fiCategoryBlock.init( | ||
29 | null, false, null, null, 1.15 | ||
30 | ); | ||
31 | compSceneCanvas.addNodeToFocusTarget(0, this.node.name, this.node); | ||
32 | }, | ||
33 | |||
34 | render(oData, iRecordIndex) { | ||
35 | this.id = oData.id; | ||
36 | this.activeName1.string = oData.name; | ||
37 | this.activeName2.string = oData.name; | ||
38 | this.normalName.string = oData.name; | ||
39 | this.activeName1._updateRenderData(true); | ||
40 | this.activeName2._updateRenderData(true); | ||
41 | this.normalName._updateRenderData(true); | ||
42 | if (oData.score) { | ||
43 | this.textScore.string = parseInt(oData.score * 10) / 10 + "分"; | ||
44 | } | ||
45 | if (oData.play_times) { | ||
46 | let value = parseInt(oData.play_times); | ||
47 | if (value > 10000) { | ||
48 | this.textPlayTimes.string = parseInt(value / 10000) + "万+"; | ||
49 | } else { | ||
50 | this.textPlayTimes.string = value; | ||
51 | } | ||
52 | } | ||
53 | // this.deleteButtonImg.spriteFrame.setRect(cc.rect(0, 0, 122, 122)); | ||
54 | if (oData.image[0]) { | ||
55 | var self = this; | ||
56 | Network.loadImageInNativeRuntime( | ||
57 | Common.TOPDRAW_IMAGE_SERVER_EDU_RIGHT + oData.image[0].fileUrl, | ||
58 | function (texture) { | ||
59 | self.pic.spriteFrame = new cc.SpriteFrame(texture); | ||
60 | }, null, this | ||
61 | ); | ||
62 | } | ||
63 | }, | ||
64 | |||
65 | enableFocusInfo: function () { | ||
66 | this.node.getComponent(FocusInfo).setEnable(true); | ||
67 | }, | ||
68 | |||
69 | disableFocusInfo: function () { | ||
70 | this.node.getComponent(FocusInfo).setEnable(false); | ||
71 | }, | ||
72 | |||
73 | setUIWithFocus: function () { | ||
74 | let nodeCellName = this.node.getChildByName('Name'); | ||
75 | cc.find("NormalName", nodeCellName).opacity = 255; | ||
76 | cc.find("ActiveName/ActiveNameBg", nodeCellName).opacity = 255; | ||
77 | //超出滚动 | ||
78 | let nodeScreenTitleText = cc.find('ActiveName/NameContainer/NameText', nodeCellName); | ||
79 | |||
80 | let fOriginalX = nodeScreenTitleText.x; | ||
81 | let fOriginalY = nodeScreenTitleText.y; | ||
82 | |||
83 | let nodeScreenTitleText1 = nodeScreenTitleText.getChildByName('NameText1'); | ||
84 | let nodeScreenTitleText2 = nodeScreenTitleText.getChildByName('NameText2'); | ||
85 | nodeScreenTitleText2.x = nodeScreenTitleText1.x + nodeScreenTitleText1.width + 10;//TODO:补丁,解决滚动重叠 | ||
86 | if (nodeScreenTitleText1.width > nodeScreenTitleText.width) { | ||
87 | cc.find("ActiveName/NameContainer", nodeCellName).opacity = 255; | ||
88 | cc.find("NormalName", nodeCellName).opacity = 0; | ||
89 | let fEndPositionDelta = (nodeScreenTitleText1.width + 30); | ||
90 | //下方时长和字有关系,才能速度一样 | ||
91 | var ftaScreenTitleMoveToTarget = cc.moveTo(10 * (nodeScreenTitleText1.width / nodeScreenTitleText.width), fOriginalX - fEndPositionDelta, fOriginalY); | ||
92 | var ftaScreenTitleMoveToBack = cc.moveTo(0, fOriginalX, fOriginalY); | ||
93 | var sequenceMediaTitle = cc.sequence(ftaScreenTitleMoveToTarget, ftaScreenTitleMoveToBack); | ||
94 | var repeatScreenTitle = cc.repeat(sequenceMediaTitle, 10); | ||
95 | repeatScreenTitle.setTag(Common.OVERLENGTH_MOVING); | ||
96 | nodeScreenTitleText.runAction(repeatScreenTitle); | ||
97 | nodeScreenTitleText2.active = true; | ||
98 | } | ||
99 | }, | ||
100 | setUIWithoutFocus: function () { | ||
101 | let nodeCellName = this.node.getChildByName('Name'); | ||
102 | cc.find("NormalName", nodeCellName).opacity = 255; | ||
103 | cc.find("ActiveName/ActiveNameBg", nodeCellName).opacity = 0; | ||
104 | //如有滚动停止滚动 | ||
105 | let nodeScreenTitleText = cc.find('ActiveName/NameContainer/NameText', nodeCellName); | ||
106 | if (null != nodeScreenTitleText.getActionByTag(Common.OVERLENGTH_MOVING)) { | ||
107 | nodeScreenTitleText.stopActionByTag(Common.OVERLENGTH_MOVING); | ||
108 | nodeScreenTitleText.getChildByName('NameText2').active = false; | ||
109 | cc.find("ActiveName/NameContainer", nodeCellName).opacity = 0; | ||
110 | } | ||
111 | nodeScreenTitleText.x = 0; | ||
112 | }, | ||
113 | |||
114 | }); |
assets/Script/listCell/DiaryListCell.js.meta
0 → 100644
This diff is collapsed.
Click to expand it.
-
Please register or sign in to post a comment