Commit bb7b0fc9 bb7b0fc960ff0c3bd2afb99e2cbd21480baf563c by 金学艇

1.修复首页ScrollView滚动焦点框错乱

2.修复首页高分排行榜选中效果展示
3.修复首页和分类页的翻页功能
4.修复首页焦点显示和隐藏错乱的问题
0 parents
Showing 319 changed files with 2553 additions and 0 deletions
1 [
2 {
3 "__type__": "cc.SceneAsset",
4 "_name": "",
5 "_objFlags": 0,
6 "_native": "",
7 "scene": {
8 "__id__": 1
9 }
10 },
11 {
12 "__type__": "cc.Scene",
13 "_objFlags": 0,
14 "_parent": null,
15 "_children": [
16 {
17 "__id__": 2
18 },
19 {
20 "__id__": 7
21 }
22 ],
23 "_active": true,
24 "_components": [],
25 "_prefab": null,
26 "_opacity": 255,
27 "_color": {
28 "__type__": "cc.Color",
29 "r": 255,
30 "g": 255,
31 "b": 255,
32 "a": 255
33 },
34 "_contentSize": {
35 "__type__": "cc.Size",
36 "width": 0,
37 "height": 0
38 },
39 "_anchorPoint": {
40 "__type__": "cc.Vec2",
41 "x": 0,
42 "y": 0
43 },
44 "_trs": {
45 "__type__": "TypedArray",
46 "ctor": "Float32Array",
47 "array": [
48 0,
49 0,
50 0,
51 0,
52 0,
53 0,
54 1,
55 1,
56 1,
57 1
58 ]
59 },
60 "_is3DNode": true,
61 "_groupIndex": 0,
62 "groupIndex": 0,
63 "autoReleaseAssets": false,
64 "_id": "534a7ff1-b31e-45c5-968b-c8245ff12b6d"
65 },
66 {
67 "__type__": "cc.Node",
68 "_name": "Canvas",
69 "_objFlags": 0,
70 "_parent": {
71 "__id__": 1
72 },
73 "_children": [
74 {
75 "__id__": 3
76 }
77 ],
78 "_active": true,
79 "_components": [
80 {
81 "__id__": 5
82 },
83 {
84 "__id__": 6
85 }
86 ],
87 "_prefab": null,
88 "_opacity": 255,
89 "_color": {
90 "__type__": "cc.Color",
91 "r": 255,
92 "g": 255,
93 "b": 255,
94 "a": 255
95 },
96 "_contentSize": {
97 "__type__": "cc.Size",
98 "width": 1280,
99 "height": 720
100 },
101 "_anchorPoint": {
102 "__type__": "cc.Vec2",
103 "x": 0.5,
104 "y": 0.5
105 },
106 "_trs": {
107 "__type__": "TypedArray",
108 "ctor": "Float32Array",
109 "array": [
110 640,
111 360,
112 0,
113 0,
114 0,
115 0,
116 1,
117 1,
118 1,
119 1
120 ]
121 },
122 "_eulerAngles": {
123 "__type__": "cc.Vec3",
124 "x": 0,
125 "y": 0,
126 "z": 0
127 },
128 "_skewX": 0,
129 "_skewY": 0,
130 "_is3DNode": false,
131 "_groupIndex": 0,
132 "groupIndex": 0,
133 "_id": "f4Iimnh+lIh4RhpGab/gGR"
134 },
135 {
136 "__type__": "cc.Node",
137 "_name": "Main Camera",
138 "_objFlags": 0,
139 "_parent": {
140 "__id__": 2
141 },
142 "_children": [],
143 "_active": true,
144 "_components": [
145 {
146 "__id__": 4
147 }
148 ],
149 "_prefab": null,
150 "_opacity": 255,
151 "_color": {
152 "__type__": "cc.Color",
153 "r": 255,
154 "g": 255,
155 "b": 255,
156 "a": 255
157 },
158 "_contentSize": {
159 "__type__": "cc.Size",
160 "width": 0,
161 "height": 0
162 },
163 "_anchorPoint": {
164 "__type__": "cc.Vec2",
165 "x": 0.5,
166 "y": 0.5
167 },
168 "_trs": {
169 "__type__": "TypedArray",
170 "ctor": "Float32Array",
171 "array": [
172 0,
173 0,
174 416.5582275390625,
175 0,
176 0,
177 0,
178 1,
179 1,
180 1,
181 1
182 ]
183 },
184 "_eulerAngles": {
185 "__type__": "cc.Vec3",
186 "x": 0,
187 "y": 0,
188 "z": 0
189 },
190 "_skewX": 0,
191 "_skewY": 0,
192 "_is3DNode": false,
193 "_groupIndex": 0,
194 "groupIndex": 0,
195 "_id": "10WUQRPNFCs4qkE2/2rly6"
196 },
197 {
198 "__type__": "cc.Camera",
199 "_name": "",
200 "_objFlags": 0,
201 "node": {
202 "__id__": 3
203 },
204 "_enabled": true,
205 "_cullingMask": 4294967295,
206 "_clearFlags": 7,
207 "_backgroundColor": {
208 "__type__": "cc.Color",
209 "r": 0,
210 "g": 0,
211 "b": 0,
212 "a": 255
213 },
214 "_depth": -1,
215 "_zoomRatio": 1,
216 "_targetTexture": null,
217 "_fov": 60,
218 "_orthoSize": 10,
219 "_nearClip": 1,
220 "_farClip": 4096,
221 "_ortho": true,
222 "_rect": {
223 "__type__": "cc.Rect",
224 "x": 0,
225 "y": 0,
226 "width": 1,
227 "height": 1
228 },
229 "_renderStages": 1,
230 "_id": "92C/6VZexC8JWe/orQREQg"
231 },
232 {
233 "__type__": "cc.Canvas",
234 "_name": "",
235 "_objFlags": 0,
236 "node": {
237 "__id__": 2
238 },
239 "_enabled": true,
240 "_designResolution": {
241 "__type__": "cc.Size",
242 "width": 1280,
243 "height": 720
244 },
245 "_fitWidth": false,
246 "_fitHeight": true,
247 "_id": "a8MzCrdoZOZYqjzgHbUan+"
248 },
249 {
250 "__type__": "e8db1NJMMxF7IBsJ0cUPQXd",
251 "_name": "",
252 "_objFlags": 0,
253 "node": {
254 "__id__": 2
255 },
256 "_enabled": true,
257 "_cLog": null,
258 "_cApplication": null,
259 "_cFocus": null,
260 "_aFocusTargets": [],
261 "_fiCurrentFocus": null,
262 "_iSceneStatus": 0,
263 "_fFocusScaleFactor": 1.06,
264 "_bIsFocusInit": false,
265 "_oSceneContext": null,
266 "_oNextSceneParameter": null,
267 "_compPlayer": null,
268 "_aTouchContext": [],
269 "_defaultBackScene": null,
270 "_oFocusScaleFactorInfo": null,
271 "_id": "91dQYvnpBPdaAKZIVcvWvT"
272 },
273 {
274 "__type__": "cc.Node",
275 "_name": "PlayerContainer",
276 "_objFlags": 0,
277 "_parent": {
278 "__id__": 1
279 },
280 "_children": [],
281 "_active": true,
282 "_components": [],
283 "_prefab": null,
284 "_opacity": 255,
285 "_color": {
286 "__type__": "cc.Color",
287 "r": 255,
288 "g": 255,
289 "b": 255,
290 "a": 255
291 },
292 "_contentSize": {
293 "__type__": "cc.Size",
294 "width": 0,
295 "height": 0
296 },
297 "_anchorPoint": {
298 "__type__": "cc.Vec2",
299 "x": 0.5,
300 "y": 0.5
301 },
302 "_trs": {
303 "__type__": "TypedArray",
304 "ctor": "Float32Array",
305 "array": [
306 640,
307 360,
308 0,
309 0,
310 0,
311 0,
312 1,
313 1,
314 1,
315 1
316 ]
317 },
318 "_eulerAngles": {
319 "__type__": "cc.Vec3",
320 "x": 0,
321 "y": 0,
322 "z": 0
323 },
324 "_skewX": 0,
325 "_skewY": 0,
326 "_is3DNode": false,
327 "_groupIndex": 0,
328 "groupIndex": 0,
329 "_id": "e4YGtpvMlI1ITlWZq9AqbS"
330 }
331 ]
...\ No newline at end of file ...\ No newline at end of file
This diff could not be displayed because it is too large.
1 module.exports = cc.Class({
2 extends: cc.Component,
3
4 properties: {
5 info: cc.Label,
6 fileProgress: cc.ProgressBar,
7 fileLabel: cc.Label,
8 close: cc.Node,
9 updateBtn: cc.Node
10 },
11
12 onLoad () {
13 this.close.on(cc.Node.EventType.TOUCH_END, function () {
14 this.node.parent.active = false;
15 }, this);
16 }
17 });
...\ No newline at end of file ...\ No newline at end of file
1 cc.Class({
2 extends: cc.Component,
3
4 properties: {
5 // foo: {
6 // default: null, // The default value will be used only when the component attaching
7 // to a node for the first time
8 // url: cc.Texture2D, // optional, default is typeof default
9 // serializable: true, // optional, default is true
10 // visible: true, // optional, default is true
11 // displayName: 'Foo', // optional
12 // readonly: false, // optional, default is false
13 // },
14 // ...
15 },
16
17 // use this for initialization
18 onLoad: function () {
19
20 },
21
22 statics: {
23 //MAIN_NAVIGATOR_PROMOTION:'MainNavigator',
24 //写死推荐位名称
25 MAIN_NAVIGATOR_PROMOTION: 'MainNavigator3_0',//音乐大厅推荐位
26 MAIN_LEFT_NAVIGATOR_PROMOTION: "MainNavigator3_1",//首页左侧导航推荐位
27 MAIN_RIGHT_NAVIGATOR_PROMOTION: "rightNavigator3_1",//首页右侧瀑布流推荐位
28 MAIN_TOP_NAVIGATOR_PROMOTION: "MainServiceFeature3_1",//首页顶部推荐位
29 COLLECTION_LIST_PROMOTION: "UserCollectionNavigator3_1",//我的收藏左侧推荐位
30 FREE_LIST_PROMOTION: "FreeSongListNavigator3_1",//限时免费左侧推荐位
31 HISTORY_LIST_PROMOTION: "RecentPlayedListNavigator",//最近播放左侧推荐位
32 SUBJECT_LIST_PROMOTION: "SubjectListNavigator3_1",//专题列表左侧推荐位
33 TAG_LIST_PROMOTION: "TheNewestNavigator3_1",//最近更新左侧推荐位
34 RANK_LIST_PROMOTION: "SearchSongList3_1",//排行榜推荐位
35 SEARCH_NAVIGATOR_LIST_PROMOTION: "HotSearchNavigator3_1",//搜索应用导航推荐位
36 SUBINDEX_CONFIG_PROMOTION: "MainSubIndexConfig",//副首页各应用推荐位配置推荐位
37 //SUBSCRIBE_PROMOTION : "orderDetail",//订购推荐位
38 SUBSCRIBE_PROMOTION1: "3_2orderMode42",//订购推荐位导航
39 SUBSCRIBE_PROMOTION2: "3_2orderButton43",//订购推荐位按钮
40 SUBSCRIBE_PROMOTION3: "3_2orderDescript44",//订购推荐位描述
41 MAIN_2_DETAINMENT_PROMOTION: "Index2Dtnmnt",//进入应用引导推荐位
42 MINE_INDEX_PROMOTION: "MainMyInfoFeature3_1",//我的首页推荐位
43 SHOP_ADVISEMENT_PROMOTION: "MainMallFeature3_0",//商城广告推荐位
44
45 SCREEN_HEIGHT: 720.0,
46
47 //应用id
48 DOLPHINS_APPID: 'td71b187fedb257ac0',
49 KTV_APPID: 'td5d69e9b2187b4b04',
50 CHILDREN_APPID: 'td817a49dbf06018d4',
51 RADIO_APPID: 'td5b39abe465dd7475',
52 VARIETY_RADIO_APPID: 'tdf35c7fa7d04e9420',
53 VARIETY_VIDEO_APPID: 'td4fdce8945bdab9e7',
54 VARIETY_VOCAL_APPID: 'td06824d0c4376f3e2',
55 PERSONAL_SHOW_APPID: 'td80b6647556d41cfe',
56 SQUARE_DANCE_APPID: 'td4a75b565ad67da7a',
57 VOCAL_CONCERT_APPID: 'td77e42711d65e47fd',
58 MV_APPID: 'td7402250ed93cc768',
59
60 //==============根据平台需求需要调整值 开始
61 DAILY_RECOMMEND_CATEGORY_ID: 985, //每日推荐 1196 category_a9c34518-1c7a-48f9-a689-df10876c96a4 "category_bc4359d9-377e-4fae-9b49-0cc7ccc7d6c5" 鹏博士187
62 //KTV_ALL_SONGS_CATEGORY:29,//当贝id
63 KTV_ALL_SONGS_CATEGORY: 38,
64 VARIETY_VOCAL_ALL_SONGS_CATEGORY: 65,
65 //背景皮肤
66 //SCENE_SKIN_CATEGORY_ID : "1252",当贝
67 SCENE_SKIN_CATEGORY_ID: "1199",
68 SCENE_RADIO_SKIN_CATEGORY_ID: "1195",
69 //默认推荐分类id //当贝
70 // APP_RECOMMEND_CATEGORY_ID : {
71 // 'td5d69e9b2187b4b04' : 1100,
72 // 'td77e42711d65e47fd' : 1257,
73 // 'td7402250ed93cc768' : 1258,
74 // 'td4a75b565ad67da7a' : 1259,
75 // 'td817a49dbf06018d4' : 1260,
76 // },
77 APP_RECOMMEND_CATEGORY_ID: {
78 'td5d69e9b2187b4b04': 980,//1100,
79 'td77e42711d65e47fd': 1121,//1257,
80 'td7402250ed93cc768': 1122,//1258,
81 'td4a75b565ad67da7a': 1123,//1259,
82 'td817a49dbf06018d4': 1124,//1260,
83 },
84
85 //纯k热门分类id
86 KTV_HOT_CATEGORY_ROOT_ID: 39,
87 //综艺现场分类id
88 MV_HOT_CATEGORY_ROOT_ID: 7,
89 // DETAIN_SUBJECT_ID : 53,//当贝挽留专题id
90 DETAIN_SUBJECT_ID: 13,
91 //==============根据平台需求需要调整值 结束
92
93 FEMALE: 0,
94 MALE: 1,
95 BAND: 2,
96
97 VOCAL_CONCERT_FILTER: '全部,欧美,港台,大陆', //此功能暂时关闭
98 ADD_2_PLAY_LIST_CEIL_PROMPT: ["不要太贪心", "先听完已点歌曲再点哦!"],
99 NO_MEDIA_TIP: "未检测到节目,即将返回到上一页",
100 NO_MEDIA_INFO_TIP: "节目未上线,即将返回到上一页",
101 COMING_SOON: "敬请期待!",
102 QUIT_COMMON_TIP: "退订成功!",
103 QUIT_COMMON_TIP2: "订购关系已过期或者已退订!",
104 QUIT_COMMON_TIP3: "退订异常!",
105 ORDER_SUCCESS: '订购成功!',
106 ORDER_EXCEPTION: '网络异常,请重试',
107 ORDER_ENTER: '请稍后...',
108
109 NEWTV_APPID: '4bf34d0e9acf4aa',
110 CONTENT_ID: '2019121018210000000001',
111
112 //这个值应该动态获取,每次进入应用或每次发起包月订购(按次不支持退订)时记录下来,否则退订会返回“订购关系不存在”
113 QUIT_PRODUCT_CODE: '8802000245', //退订productCode
114
115 }
116 // called every frame, uncomment this function to activate update callback
117 // update: function (dt) {
118
119 // },
120 });
1 cc.Class({
2 extends: cc.Component,
3
4 properties: {
5 // foo: {
6 // default: null, // The default value will be used only when the component attaching
7 // to a node for the first time
8 // url: cc.Texture2D, // optional, default is typeof default
9 // serializable: true, // optional, default is true
10 // visible: true, // optional, default is true
11 // displayName: 'Foo', // optional
12 // readonly: false, // optional, default is false
13 // },
14 // ...
15 },
16 // use this for initialization
17 onLoad: function () {
18
19 },
20 statics: {
21
22 VERSION: "3.1.06",
23
24 SCREEN_WIDTH: 1280.0,
25 SCREEN_HEIGHT: 720.0,
26
27 MOVE_DIRECTION_UP: 0,
28 MOVE_DIRECTION_RIGHT: 1,
29 MOVE_DIRECTION_DOWN: 2,
30 MOVE_DIRECTION_LEFT: 3,
31
32
33 FOCUS_FLY_DURATION: 0.2,
34 FOCUS_BREATH_DURATION: 0.8,
35
36 //Action Tag
37 FEATURE_NODE_TRANSFER: 1,
38 FOCUS_CELL_TRANSFER: 1,
39 FOCUS_CONTAINER_TRANSFER: 1,
40 FOCUS_CONTAINER_BREATH: 2,
41 FOCUS_CONTAINER_JOGGLE: 3,
42
43
44
45
46 OVERLENGTH_MOVING: 4,
47
48 SCROLL_BY_FOCUS_CHANGE: 5,
49
50
51 API_SORT_ASC: 'asc',
52 API_SORT_DESC: 'desc',
53
54 FEMALE: 0,
55 MALE: 1,
56 BAND: 2,
57
58 ANDROID_KEY: {
59 back: 6,
60 up: 1003,
61 right: 1001,
62 down: 1004,
63 left: 1000,
64 enter: 1005
65 },
66
67
68 BUSINESS_PARAMETER: {
69 // {:,
70
71 },
72
73
74 OFFICIAL_PLATFORM_IP: 'http://139.196.192.33/',
75 TEST_PLATFORM_IP: 'http://139.196.192.242:8081/',
76
77 // TOPDRAW_API_SERVER : 'http://139.196.192.242:8081/hyperion.chimera/',
78 // TOPDRAW_IMAGE_SERVER : 'http://139.196.192.242:8081/hyperion.resource/',
79 // TOPDRAW_API_SERVER : 'http://39.130.160.199:8081/hyperion.chimera/',
80 // TOPDRAW_IMAGE_SERVER : 'http://39.130.160.199:8081/hyperion.resource/',
81
82 // TOPDRAW_LOG_SERVER:'http://139.196.37.202/sparrow.resource/',
83 // // BI_BASE_PATH : 'http://139.196.192.242:81/1.gif',
84 // BI_BASE_PATH : 'http://39.130.160.23:81/1.gif',
85
86
87
88 //2019.8.16修改新服务器
89 TOPDRAW_API_SERVER: 'http://112.47.3.216:8080/1/jinxueting/',
90 TOPDRAW_IMAGE_SERVER: 'http://112.47.3.216:8080/1/jinxueting/',
91
92 TOPDRAW_LOG_SERVER: 'http://139.196.37.202/sparrow.resource/',
93 // BI_BASE_PATH : 'http://139.196.192.242:81/1.gif',
94 BI_BASE_PATH: 'http://melody.hi.a170.ottcn.com:80/1.gif',
95 BI_BASE_PATH_NEW: 'http://melody.hi.a170.ottcn.com:80/2.gif',
96
97
98 TV_LINK_ACTION_CLICK: 100,
99 TV_LINK_ACTION_HOVER: 101,
100
101 API_TOKEN: 'dd4b1968eb5b417e834c2687e23d2471', //c744677d2c4e47e5987c8573325d2c56
102 // TEST_API_TOKEN:'9b16e7b8ecc64a1d9df89bd394d6a06b',
103 TEST_API_TOKEN: 'dd4b1968eb5b417e834c2687e23d2471',
104 TEST_PLAY_URL: "http://39.130.192.215:6060/000000003200/866b5508be484775905dcfcdc9f18e3f/index.m3u8",
105 USER_ID: '',
106 AUTH_STATUS: 0, //鉴权默认不成功 fix jerry
107 AUTH_PRODUCT: "",
108 AUTHORIZATIONNUM: "",
109 DEBUG_MODE: 0,//0非调试模式,1调试模式
110 //PLAY_LIST_ITEM_COUNT_LIMIT : 100,
111 PLAY_LIST_ITEM_COUNT_LIMIT: 100000,//本来上限是100首,因为需求的改来改去,我先把这里改成100000,糊一下上限的问题
112 ADD_2_PLAY_LIST_CEIL_PROMPT_DURATION: 5,
113 BACK_WITH_DETAIN: true,
114 //TEST_API_TOKEN:'6b071a064fb047bbbd47c5b3326f34d5', B2C 的
115
116
117 _bIsHotUpdate: false,
118 PRODUCT_LIST: null,
119 VALID_PLAY_TIME_DURATION: 5 * 60,
120 MEDIA_INVALID_PROMPT: '该地区暂未上线本歌曲,马上为您播放下一首哦!',
121 g_strCurrentSceneName: "",
122 g_iPlayerPlayedTime: 0,
123 g_strPlayerPlayedId: null,
124 g_oSpriteFrame: {},
125 g_oSpriteFrameURL: {},
126 g_oTextureInUsage: {},
127 g_oRomoteURLTexture: {},
128 g_aDebugKey: ["up", "up", "up", "up", "right", "right", "right", "down", "down", "left"],
129 g_iDebugIndex: 0,
130 loadRes: function (strResourceURL,/*iResourceIndex,*/onSuccess, onError, oScope) {
131 cc.loader.loadRes(strResourceURL,
132 function (error, loadedResource) {
133 cc.g_oUsedPrefabPaths[strResourceURL] = strResourceURL;
134 if (error) {
135 if (null != oScope) {
136 onError.call(oScope, error);
137 } else {
138 onError(error);
139 }
140 } else {
141 if (null != oScope) {
142 onSuccess.call(oScope, loadedResource/*,iResourceIndex*/);
143 } else {
144 onSuccess(loadedResource/*,iResourceIndex*/);
145 }
146 }
147 }
148 );
149
150 },
151 setTimeout: function (onTimeComplete, iDuration, oScope, argements) {
152
153 /*
154 window.setTimeout(onTimeComplete,iDuration,);
155
156
157 cc.loader.loadRes(strResourceURL,
158 function(error,loadedResource){
159 if (error){
160 if(null!=oScope){
161 onError.call(oScope,error);
162 }else{
163 onError(error);
164 }
165 }else{
166 if(null!=oScope){
167 onSuccess.call(oScope,loadedResource);
168 }else{
169 onSuccess(loadedResource);
170 }
171 }
172 }
173 );
174 */
175 },
176 getAbsolutePositionX: function (node) {
177
178 },
179 getAbsolutePositionY: function (node) {
180
181 },
182 promiseAjax: function () {
183
184 },
185
186 getNodePath: function (node) {
187 let strPath = "";
188 if (node) {
189 while (node.parent && node.parent.parent) {//不算TopCanvas
190 strPath = "/" + node.name + strPath;
191 node = node.parent;
192 }
193 }
194 return strPath.substring(1);
195 },
196 getX: function (tempNode) {
197 let fCenterX = 0;
198 while (tempNode.parent && tempNode.parent.parent) {//不算TopCanvas
199 fCenterX += tempNode._fX || tempNode.x;
200 tempNode = tempNode.parent;
201 }
202 return fCenterX;
203 },
204 getY: function (tempNode) {
205 let fCenterY = 0;
206 while (tempNode.parent.parent) {//不算TopCanvas
207 //cc.log(tempNode.name+" Y: "+tempNode.y)
208 fCenterY += tempNode._fY || tempNode.y;
209 tempNode = tempNode.parent;
210 }
211 return fCenterY;
212 },
213
214 /**
215 * 用于合并对象 By Eva
216 * @param target
217 * @param firstSource
218 * @returns {any}
219 */
220 assign: function (target, firstSource) {
221 if (target === undefined || target === null)
222 throw new TypeError("Cannot convert first argument to object");
223 var to = Object(target);
224 for (var i = 1; i < arguments.length; i++) {
225 var nextSource = arguments[i];
226 if (nextSource === undefined || nextSource === null) continue;
227 var keysArray = Object.keys(Object(nextSource));
228 for (var nextIndex = 0, len = keysArray.length; nextIndex < len; nextIndex++) {
229 var nextKey = keysArray[nextIndex];
230 var desc = Object.getOwnPropertyDescriptor(nextSource, nextKey);
231 if (desc !== undefined && desc.enumerable) to[nextKey] = nextSource[nextKey];
232 }
233 }
234 return to;
235 },
236
237 renderSpriteByLocalImage: (localImgPath, sprite) => {
238 cc.loader.loadRes(localImgPath, cc.SpriteFrame, (err, spriteFrame) => {
239 if (err) {
240 cc.error(err.message || err);
241 return;
242 }
243 cc.log('Result should be a sprite frame: ' + (spriteFrame instanceof cc.SpriteFrame));
244 sprite.spriteFrame = spriteFrame;
245 });
246 },
247 /**
248 *
249 * @param fnSuccess 成功操作
250 * @param iDelayDuration 延迟时间
251 * @param fnTimeout 超时操作
252 * @param oScope 作用域
253 * @param strTag 操作标签,防止重复操作
254 * @returns {Function}
255 */
256 timeoutify: function (fnSuccess, iDelayDuration, fnTimeout, oScope, strTag) {
257 oScope.scheduleOnce(function () {
258 !oScope["Request" + strTag + "Loaded"] && fnTimeout && fnTimeout.call(oScope);
259 oScope["Request" + strTag + "Timout"] = true;
260 }, iDelayDuration);
261 return function () {
262 //未超时
263 if (!oScope["Request" + strTag + "Timout"]) {
264 oScope.unschedule(oScope.timeout);
265 fnSuccess.apply(oScope, arguments);
266 }
267 }
268 },
269 uuid: function (len, radix) {
270 var chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split("");
271 var uuid = [], i;
272 radix = radix || chars.length;
273 if (len) {
274 for (i = 0; i < len; i++) uuid[i] = chars[0 | (eval('Math.random()') * radix)];
275 } else {
276 var r;
277 uuid[8] = uuid[13] = uuid[18] = uuid[23] = "-";
278 uuid[14] = "4";
279 for (i = 0; i < 36; i++) {
280 if (!uuid[i]) {
281 r = 0 | (eval('Math.random()') * 16);
282 uuid[i] = chars[i == 19 ? (r & 0x3) | 0x8 : r];
283 }
284 }
285 }
286 return uuid.join("");
287 }
288
289 }
290 });
1 var Common = require('Common');
2
3 cc.Class({
4 extends: cc.Component,
5
6 properties: {
7
8 // TODO: to be a real Component?
9 //_fLeft:0,
10 //_fTop:0,
11 //_fWidth:0,
12 //_fHeight:0,
13 //_oFocusNode:null,//deprecated
14 _strTVLink: '',
15 _bEnable: false,
16 _fScaleFactor: 1.06,
17 _bIgnoreZIndex: false,
18 _iFlyDelayTime: 0,
19 _iFocusWeight: 100,
20 },
21
22
23 //ctor: function (fLeft,fTop,fWidth,fHeight,oFocusNode,strTVLink,bEnable,fnOnFocus,fnOnBlur) {
24 ctor: function () {
25
26 //this._fLeft=arguments[0];
27 //this._fTop=arguments[1];
28 //this._fWidth=arguments[2];
29 //this._fHeight=arguments[3];
30 //this._oFocusNode=arguments[4];
31 this._strTVLink = arguments[0];
32 this._bEnable = arguments[1];
33 this._fnOnFocus = arguments[2];
34 this._fnOnBlur = arguments[3];
35 //this._fLeft=fLeft;
36 //this._fTop=fTop;
37 //this._fWidth=fWidth;
38 //this._fHeight=fHeight;
39 //this._oFocusNode=oFocusNode;
40
41 },
42
43 init: function (/*fLeft,fTop,fWidth,fHeight,oFocusNode,*/strTVLink, bEnable, fnOnFocus, fnOnBlur, fScaleFactor) {
44
45 //this._fLeft=arguments[0];
46 //this._fTop=arguments[1];
47 //this._fWidth=arguments[2];
48 //this._fHeight=arguments[3];
49 //this._oFocusNode=arguments[4];
50 this._strTVLink = strTVLink;
51 this._bEnable = bEnable;
52 this._fnOnFocus = fnOnFocus;
53 this._fnOnBlur = fnOnBlur;
54 this._fScaleFactor = fScaleFactor;
55 //this._fLeft=fLeft;
56 //this._fTop=fTop;
57 this._fWidth = 0;
58 this._fHeight = 0;
59 //this._oFocusNode=oFocusNode;
60 this._oProbeInfo = {};
61 },
62
63 // use this for initialization
64 onLoad: function () {
65 //气泡式向上传递 通常收不到
66 //this.node.on('foucs', this._fnOnFocus || function(){},this);
67 //this.node.on('blur', this._fnOnBlur || function(){},this);
68 },
69
70
71 setFlyDelayTime: function (iDuration) {
72 this._iFlyDelayTime = iDuration;
73 },
74 getFlyDelayTime: function () {
75 return this._iFlyDelayTime;
76 },
77 setFocusWeight: function (iWeight) {
78 this._iFocusWeight = iWeight;
79 },
80 getFocusWeight: function () {
81 return this._iFocusWeight;
82 },
83 getLeft: function () {
84 //return this._fLeft;
85 return Common.SCREEN_WIDTH / 2 + (this.getX() - this.node.width / 2);
86 },
87
88
89
90 getTop: function () {
91 //return this._fTop;
92 return Common.SCREEN_HEIGHT / 2 - (this.getY() + this.node.height / 2);
93 },
94
95 getX: function () {
96 return Common.getX(this.node);
97 },
98 getY: function () {
99 return Common.getY(this.node);
100 },
101 getWidth: function () {
102 //return this._fWidth;
103 return this._fWidth || this.node.width; //有时候设计上元素会交叉,所以找焦点的时候只能设置虚拟尺寸
104 },
105 setFakeWidth: function (fWidth) {
106 this._fWidth = fWidth;
107 },
108 getHeight: function () {
109 return this._fHeight || this.node.height;
110 },
111
112
113 setFakeHeight: function (fHeight) {
114 this._fHeight = fHeight;
115 },
116 //getFocusNode:function(){
117 // return this._oFocusNode;
118 //},
119 //setFocusNode:function(oFocusNode){
120 // this._oFocusNode=oFocusNode;
121 //},
122 getTVLink: function () {
123 return this._strTVLink;
124 },
125 setTVLink: function (strTVLink) {
126 this._strTVLink = strTVLink;
127 },
128 getEnable: function () {
129 return this._bEnable;
130 },
131 setEnable: function (bEnable) {
132 this._bEnable = bEnable;
133 // cc.log("改变节点Enable属性:" + this.node.name+" : "+bEnable);
134 },
135 onFocus: function (fiFrom) {
136 if (this._fnOnFocus) {
137 this._fnOnFocus(fiFrom);
138 }
139 },
140 onBlur: function (fiTo) {
141 if (this._fnOnBlur) {
142 this._fnOnBlur(fiTo);
143 }
144 },
145 getScaleFactor: function () {
146 return this._fScaleFactor;
147 },
148 setScaleFactor: function (fScaleFactor) {
149 this._fScaleFactor = fScaleFactor;
150 },
151 ignoreZIndex: function (bool) {
152 this._bIgnoreZIndex = bool;
153 },
154 setFocusProbeInfo: function (oInfo) {
155 this._oProbeInfo = oInfo;
156 },
157 getFocusProbeInfo: function () {
158 return this._oProbeInfo;
159 },
160
161 onEnable: function () { //修改节点的active属性为true时会执行挂载组件的onEnable方法
162 //注意:子节点有ListView要慎用!会使所有未初始化数据的子节点也改变焦点状态
163 // cc.log("执行FocusInfo中onEnable方法");
164 // if (0 != this.node.name.indexOf('RoleInstallListCell') && 0 != this.node.name.indexOf('AchievementListCell')) {
165 this._bEnable = true;
166 // }
167 },
168
169 onDisable: function () { //修改节点的active属性为false时会执行挂载组件的onDisable方法
170 // cc.log("执行FocusInfo中onDisable方法" + this.node.name);
171
172 // if (0 != this.node.name.indexOf('CategoryListCell')) {
173 this._bEnable = false;
174 // cc.log("隐藏的名称:" + this.node.name);
175 // }
176 },
177 });
1 var Common = require('Common');
2
3 cc.Class({
4 extends: cc.Component,
5
6 properties: {
7
8 // TODO: to be a real Component?
9 //_fLeft:0,
10 //_fTop:0,
11 //_fWidth:0,
12 //_fHeight:0,
13 //_oFocusNode:null,//deprecated
14 _strTVLink:'',
15 _bEnable:false
16 },
17
18
19 //ctor: function (fLeft,fTop,fWidth,fHeight,oFocusNode) {
20 ctor: function () {
21
22 //this._fLeft=arguments[0];
23 //this._fTop=arguments[1];
24 //this._fWidth=arguments[2];
25 //this._fHeight=arguments[3];
26 //this._oFocusNode=arguments[4];
27 this._strTVLink=arguments[0];
28 this._bEnable=arguments[1];
29 //this._fLeft=fLeft;
30 //this._fTop=fTop;
31 //this._fWidth=fWidth;
32 //this._fHeight=fHeight;
33 //this._oFocusNode=oFocusNode;
34
35 },
36
37 init: function (/*fLeft,fTop,fWidth,fHeight,oFocusNode,*/strTVLink,bEnable) {
38
39 //this._fLeft=arguments[0];
40 //this._fTop=arguments[1];
41 //this._fWidth=arguments[2];
42 //this._fHeight=arguments[3];
43 //this._oFocusNode=arguments[4];
44 this._strTVLink=strTVLink;
45 this._bEnable=bEnable;
46 //this._fLeft=fLeft;
47 //this._fTop=fTop;
48 //this._fWidth=fWidth;
49 //this._fHeight=fHeight;
50 //this._oFocusNode=oFocusNode;
51
52 },
53
54 // use this for initialization
55 onLoad: function () {
56
57 },
58
59 // called every frame, uncomment this function to activate update callback
60 // update: function (dt) {
61
62 // },
63
64
65
66 getLeft:function(){
67 //return this._fLeft;
68
69 return Common.SCREEN_WIDTH/2+(this.getX()-this.node.width/2);
70 },
71
72
73 //setLeft:function(fLeft){
74 // this._fLeft=fLeft;
75 //},
76
77 getTop:function(){
78 //return this._fTop;
79 return Common.SCREEN_HEIGHT/2-(this.getY()+this.node.height/2);
80 },
81
82 getX:function(){
83 let tempNode=this.node;
84 let fCenterX=0;
85 while (tempNode.parent.parent){//不算TopCanvas
86 //cc.log(tempNode.name+" X: "+tempNode.x)
87 fCenterX+=tempNode.x;
88 tempNode=tempNode.parent;
89 }
90 return fCenterX;
91 },
92 getY:function(){
93 let tempNode=this.node;
94 let fCenterY=0;
95 while (tempNode.parent.parent){//不算TopCanvas
96 //cc.log(tempNode.name+" Y: "+tempNode.y)
97 fCenterY+=tempNode.y;
98 tempNode=tempNode.parent;
99 }
100 return fCenterY;
101 },
102 //setTop:function(fTop){
103 // this._fTop=fTop;
104 //},
105 getWidth:function(){
106 //return this._fWidth;
107 return this.node.width;
108 },
109 //setWidth:function(fWidth){
110 // this._fWidth=fWidth;
111 //},
112 getHeight:function(){
113 //return this._fHeight;
114 return this.node.height;
115 },
116 //setHeight:function(fHeight){
117 // this._fHeight=fHeight;
118 //},
119 //getFocusNode:function(){
120 // return this._oFocusNode;
121 //},
122 //setFocusNode:function(oFocusNode){
123 // this._oFocusNode=oFocusNode;
124 //},
125 getTVLink:function(){
126 return this._strTVLink;
127 },
128 setTVLink:function(strTVLink){
129 this._strTVLink=strTVLink;
130 },
131 getEnable:function(){
132 return this._bEnable;
133 },
134 setEnable:function(bEnable){
135 this._bEnable=bEnable;
136 }
137
138 });
1 var Common=require('Common');
2 var Network=require('Network');
3 var TVFocus=require('TVFocus');
4 var FocusInfo=require('FocusInfo');
5 var Application=require('Application');
6 var Log=require('Log');
7
8 cc.Class({
9 extends: cc.Component,
10
11 properties: {
12 // foo: {
13 // default: null, // The default value will be used only when the component attaching
14 // to a node for the first time
15 // url: cc.Texture2D, // optional, default is typeof default
16 // serializable: true, // optional, default is true
17 // visible: true, // optional, default is true
18 // displayName: 'Foo', // optional
19 // readonly: false, // optional, default is false
20 // },
21 // ...
22 _iCellIndex:-1, //这个用于记录某个Cell PFB的索引
23
24 },
25
26 // use this for initialization
27 onLoad: function () {
28
29
30 },
31
32 render:function(){
33
34 },
35
36
37
38 // called every frame, uncomment this function to activate update callback
39 // update: function (dt) {
40
41 // },
42 });
This diff could not be displayed because it is too large.
1 var Network = require('Network');
2 var Common = require('Common');
3 cc.Class({
4 extends: cc.Component,
5
6 properties: {
7 // foo: {
8 // default: null, // The default value will be used only when the component attaching
9 // to a node for the first time
10 // url: cc.Texture2D, // optional, default is typeof default
11 // serializable: true, // optional, default is true
12 // visible: true, // optional, default is true
13 // displayName: 'Foo', // optional
14 // readonly: false, // optional, default is false
15 // },
16 // ...
17 _iLogCount:0,
18 _oScene:null,
19
20
21 },
22
23 init: function (oScene) {
24 try {
25 this._oScene=oScene;
26 } catch (error) {
27 if (cc.sys.isNative){
28 jsb.reflection.callStaticMethod("org/cocos2dx/javascript/AppActivity", "logInSceneI", "(Ljava/lang/String;)V","init Error in Log==>"+error);
29 }
30 }
31
32 },
33 // use this for initialization
34 onLoad: function () {
35 try {
36 //设置本身节点的宽高透明
37 this.node.x=0;
38 this.node.y=0;
39 //this.node.width=Common.SCREEN_WIDTH-20;
40 //this.node.height=Common.SCREEN_HEIGHT;
41
42
43 this.node.width=Common.SCREEN_HEIGHT;
44 this.node.height=Common.SCREEN_WIDTH;
45
46 let nodeLogMask=new cc.Node('LogMask');
47 nodeLogMask.x=0;
48 nodeLogMask.y=0;
49
50 this.node.addChild(nodeLogMask,10);
51
52 //设置为全屏遮罩
53 let strLoadImagePath = 'Texture/splash_black';
54 Common.renderSpriteByLocalImage(strLoadImagePath,nodeLogMask.addComponent(cc.Sprite));
55
56 //因为纹理2*2所以这里写死了
57 //nodeLogMask.setScale(Common.SCREEN_WIDTH/2,Common.SCREEN_HEIGHT/2);
58 nodeLogMask.setScale(Common.SCREEN_HEIGHT/2,Common.SCREEN_WIDTH/2);
59 //nodeLogMask.opacity=100;
60 nodeLogMask.opacity = 100;
61 nodeLogMask.zIndex = 400;
62
63 let nodeLogList=new cc.Node('LogList');
64 let layoutLog = nodeLogList.addComponent(cc.Layout);
65 layoutLog.type = cc.Layout.Type.VERTICAL;
66 layoutLog.resizeMode = cc.Layout.ResizeMode.CONTAINER;
67 layoutLog.spacingY = 0;
68 //nodeLogList.x = 20 - Common.SCREEN_WIDTH/2;
69 //nodeLogList.y = Common.SCREEN_HEIGHT/2 - 20;
70 nodeLogList.x = -Common.SCREEN_WIDTH/2+290;
71 nodeLogList.y = Common.SCREEN_HEIGHT/2+270;
72 nodeLogList.setAnchorPoint(0,1);
73 this.node.addChild(nodeLogList,10);
74 nodeLogList.zIndex = 402;
75
76 //this.node.color=new cc.Color(0, 0, 0); //黑色
77 //this.node.cascadeOpacity=false;
78
79 //this.node.parent=this._oScene.node;
80
81 //this.node.getComponent(cc.Sprite).spriteFrame = new cc.SpriteFrame(Texture2D.);
82
83 //parentNode.cascadeOpacity=false;
84 } catch (error) {
85 if (cc.sys.isNative){
86 jsb.reflection.callStaticMethod("org/cocos2dx/javascript/AppActivity", "logInSceneI", "(Ljava/lang/String;)V","onLoad Error in Log==>"+error);
87 }
88 }
89
90 },
91
92 //statics: {
93
94
95 serverD:function(strInfo){
96
97 },
98 screenD:function(strInfo){
99 try {
100 this.flushLogToScreen(strInfo,'Debug');
101 } catch (error) {
102 if (cc.sys.isNative){
103 jsb.reflection.callStaticMethod("org/cocos2dx/javascript/AppActivity", "logInSceneI", "(Ljava/lang/String;)V","screenD Error in Log==>"+error);
104 }
105 }
106
107 },
108 serverI:function(strInfo){
109
110 },
111 screenI:function(strInfo){
112 try {
113 if(strInfo){
114 this.flushLogToScreen(strInfo,'Info');
115 cc.log("Info:"+strInfo);
116 if (cc.sys.isNative){
117 jsb.reflection.callStaticMethod("org/cocos2dx/javascript/AppActivity", "logInSceneI", "(Ljava/lang/String;)V",strInfo);
118 }
119 }
120 } catch (error) {
121 if (cc.sys.isNative){
122 jsb.reflection.callStaticMethod("org/cocos2dx/javascript/AppActivity", "logInSceneI", "(Ljava/lang/String;)V","screenI Error in Log==>"+error);
123 }
124 }
125
126
127 },
128 serverW:function(strInfo){
129
130 },
131 screenW:function(strInfo){
132 try {
133 if(strInfo){
134 this.flushLogToScreen(strInfo,'Warning');
135 cc.log("Warning:"+strInfo);
136 if (cc.sys.isNative){
137 jsb.reflection.callStaticMethod("org/cocos2dx/javascript/AppActivity", "logInSceneW", "(Ljava/lang/String;)V",strInfo);
138 }
139 }
140 } catch (error) {
141 if (cc.sys.isNative){
142 jsb.reflection.callStaticMethod("org/cocos2dx/javascript/AppActivity", "logInSceneI", "(Ljava/lang/String;)V","screenW Error in Log==>"+error);
143 }
144 }
145
146
147 },
148 serverE:function(strInfo){
149
150 },
151 screenE:function(strInfo){
152 try {
153 if(strInfo){
154 this.flushLogToScreen(strInfo,'Error');
155 cc.log("strInfo:"+strInfo);
156 if (cc.sys.isNative){
157 jsb.reflection.callStaticMethod("org/cocos2dx/javascript/AppActivity", "logInSceneE", "(Ljava/lang/String;)V",strInfo);
158 }
159 }
160 } catch (error) {
161 if (cc.sys.isNative){
162 jsb.reflection.callStaticMethod("org/cocos2dx/javascript/AppActivity", "logInSceneI", "(Ljava/lang/String;)V","screenE Error in Log==>"+error);
163 }
164 }
165
166 },
167
168 flushLogToScreen:function(strInfo, strLevel){
169 try {
170 if(!Common.DEBUG_MODE){//todo:是否还有把日志显示在屏幕上的必要,目前是觉得没有的
171 return;
172 }
173 this._iLogCount++;
174 let nodeLogList = this.node.getChildByName("LogList");
175 //this._iLogCount = this._iLogCount%100;
176 let nodeInfo=new cc.Node('log_info_'+this._iLogCount);
177 let lblInfo=nodeInfo.addComponent(cc.Label);
178 lblInfo.string="("+this._iLogCount+"):"+strLevel+':'+strInfo;//+(nodeInfo.width/2-Common.SCREEN_WIDTH/2);
179 lblInfo.fontSize=10;
180 lblInfo.lineHeight=10;
181 //nodeInfo.parent=this.node;
182 nodeInfo.parent=nodeLogList;
183 switch(strLevel){
184 case 'Debug':
185 nodeInfo.color=new cc.color(51,255,255,255);
186 break;
187 case 'Info':
188 nodeInfo.color=new cc.color(51,255,51,255);
189 break;
190 case 'Warning':
191 nodeInfo.color=new cc.color(255,255,51,255);
192 break;
193 case 'Error':
194 nodeInfo.color=new cc.color(255,51,51,255);
195 break;
196 default:
197 nodeInfo.color=new cc.color(255,255,255,255);
198
199 }
200
201 //nodeInfo.color=new cc.color(255,255,255,255);
202 //nodeInfo.height=20;
203 //nodeInfo.y = -(this._iLogCount-1)*20;
204 nodeInfo.y = -(this._iLogCount-1)*10;
205 nodeInfo.height=10;
206 nodeInfo.setAnchorPoint(0,1);
207
208
209 nodeInfo.zIndex = 401;
210 //if(nodeLogList.height > Common.SCREEN_HEIGHT -20){
211 if(nodeLogList.height > Common.SCREEN_WIDTH){
212 nodeLogList.children[0].destroy();
213 }
214 } catch (error) {
215 if (cc.sys.isNative){
216 jsb.reflection.callStaticMethod("org/cocos2dx/javascript/AppActivity", "logInSceneI", "(Ljava/lang/String;)V","flushLogToScreen Error in Log==>"+error);
217 }
218 }
219
220 },
221 clearLogOnScreen : function () {
222 try {
223 let nodeLogList = this.node.getChildByName("LogList");
224 nodeLogList.destroy();
225 this._iLogCount = 0;
226 nodeLogList=new cc.Node('LogList');
227 nodeLogList.x = 20 - Common.SCREEN_WIDTH/2;
228 nodeLogList.y = Common.SCREEN_HEIGHT/2 - 20;
229 nodeLogList.setAnchorPoint(0,1);
230 this.node.addChild(nodeLogList,10);
231 nodeLogList.zIndex = 402;
232 } catch (error) {
233 if (cc.sys.isNative){
234 jsb.reflection.callStaticMethod("org/cocos2dx/javascript/AppActivity", "logInSceneI", "(Ljava/lang/String;)V","clearLogOnScreen Error in Log==>"+error);
235 }
236 }
237
238 },
239 flushLogToServer:function(){
240
241
242 }
243 //TODO:需要加一个清除(所有条目全删除)和删除日志(一条一条删除)的函数
244 //}
245 // called every frame, uncomment this function to activate update callback
246 // update: function (dt) {
247
248 // },
249 });
1 cc.Class({
2 extends: cc.Component,
3
4 properties: {
5 // foo: {
6 // default: null, // The default value will be used only when the component attaching
7 // to a node for the first time
8 // url: cc.Texture2D, // optional, default is typeof default
9 // serializable: true, // optional, default is true
10 // visible: true, // optional, default is true
11 // displayName: 'Foo', // optional
12 // readonly: false, // optional, default is false
13 // },
14 // ...
15
16
17 _fStep:1,
18 _bHasRelation:true,
19 _oNode:null, //deprecated
20 _iDirection:0,
21 _fTargetPosition:0,
22 },
23
24 //ctor: function (fStep,bHasRelation,iDirection) {
25 ctor: function () {
26 this._fStep=arguments[0];
27 this._bHasRelation=arguments[1];
28 //this._oNode=arguments[2];
29 this._iDirection=arguments[2];
30
31 //this._fStep=fStep;
32 //this._bHasRelation=bHasRelation;
33 //this._oNode=oNode;
34 //this._iDirection=iDirection;
35
36 },
37 init: function (fStep,bHasRelation,iDirection) {
38 this._fStep=fStep;
39 this._bHasRelation=bHasRelation;
40 //this._oNode=oNode;
41 this._iDirection=iDirection;
42
43 },
44
45 getStep:function(){
46 return this._fStep;
47 },
48 setStep:function(fStep){
49 this._fStep=fStep;
50 },
51
52 getHasRelation:function(){
53 return this._bHasRelation;
54 },
55 setHasRelation:function(bHasRelation){
56 this._bHasRelation=bHasRelation;
57 },
58 /*
59 getNode:function(){
60 return this._oNode;
61 },
62
63 setNode:function(oNode){
64 this._oNode=oNode;
65 },*/
66 getDirection:function(){
67 return this._iDirection;
68 },
69 setDirection:function(iDirection){
70 this._iDirection=iDirection;
71 },
72 getTargetNode:function(){
73 return this._oTargetNode;
74 },
75 setTargetNode:function(oTargetNode){
76 this._oTargetNode=oTargetNode;
77 },
78
79
80 //明确目标位置 比设置Step更为有效
81 getTargetPosition:function(){
82 return this._fTargetPosition;
83 },
84 setTargetPosition:function(fTargetPosition){
85 this._fTargetPosition=fTargetPosition;
86 }
87
88 // called every frame, uncomment this function to activate update callback
89 // update: function (dt) {
90
91 // },
92
93 });
1 var Common = require('Common');
2 var Network = require('Network');
3 var TVFocus = require('TVFocus');
4 var CCTVFocus = require('CCTVFocus');
5 var FocusInfo = require('FocusInfo');
6 var TVCanvas = require('TVCanvas');
7 var TVScrollParameter = require('TVScrollParameter');
8 var ListView = require('ListView');
9 var BusinessParameter = require('BusinessParameter');
10 var ListCell = require('ListCell');
11
12 cc.Class({
13 extends: TVCanvas,
14
15 properties: {
16
17 },
18
19 onLoad: function () {
20 this._super();
21
22 this._oSceneContext._packageName = "";
23 this._oSceneContext._className = "";
24 this._oSceneContext._downloadUrl = "";
25
26 let aSceneContext = this._cApplication.getSceneContext();
27 let aSceneParameter = this._cApplication.getSceneParameter();
28 if (aSceneParameter.length) {
29 this._oSceneContext._packageName = aSceneParameter[aSceneParameter.length - 1].packageName;
30 this._oSceneContext._className = aSceneParameter[aSceneParameter.length - 1].className;
31 this._oSceneContext._downloadUrl = aSceneParameter[aSceneParameter.length - 1].downloadUrl;
32 } else if (aSceneParameter) {
33 this._oSceneContext._packageName = aSceneParameter.packageName;
34 this._oSceneContext._className = aSceneParameter.className;
35 this._oSceneContext._downloadUrl = aSceneParameter.downloadUrl;
36 }
37
38 cc.log("gameLoading包名:" + this._oSceneContext._downloadUrl);
39
40 if (this._oSceneContext._downloadUrl && this._oSceneContext._downloadUrl != "undefined") { //如果有下载地址就启动奥比游戏
41 jsb.reflection.callStaticMethod("com/topdraw/melody/TopdrawSDKWrapper", "startOBiGame", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V", this._oSceneContext._downloadUrl, this._oSceneContext._packageName, this._oSceneContext._className, "updateProgress");
42 } else {
43 jsb.reflection.callStaticMethod("com/topdraw/melody/TopdrawSDKWrapper", "startGame", "(Ljava/lang/String;Ljava/lang/String;)V", this._oSceneContext._packageName, "updateProgress");
44 }
45 },
46
47 updateProgress: function (strProgress) {
48 this._cLog.screenI("gameLoading下载进度:" + strProgress);
49 cc.find("ProgressLabel", this.node).getComponent(cc.Label).string = strProgress + "%";
50 let progressBarWidth = cc.find("ProgressBar", this.node).width - 7;//
51 let nodeBar = cc.find("ProgressBar/bar", this.node);
52 nodeBar.width = strProgress / 100 * progressBarWidth;
53
54 // this._downloadUrl && this._downloadUrl != "undefined" &&
55 if (strProgress == "100") {
56 this._bIsFocusInit = true;
57 this.backAScene();
58 }
59 },
60
61 // hideLoadingIcon: function () {
62 // cc.log("隐藏LoadingIcon...");
63 // cc.find("Loading/LoadingIcon", this.node).getComponent(cc.Animation).pause();
64 // cc.find("Loading/LoadingIcon", this.node).opacity = 0;
65 // this.cheduleOn
66 // },
67
68 });
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/pfbCategoryListCell',
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 }
69 // cc.log("category list cell location: "+oData.image[0].fileUrl);
70 this.node.getComponent(FocusInfo).setTVLink(oData.tvlink);
71 },
72
73 enableFocusInfo: function () {
74 this.node.getComponent(FocusInfo).setEnable(true);
75 },
76
77 disableFocusInfo: function () {
78 this.node.getComponent(FocusInfo).setEnable(false);
79 },
80
81 setUIWithFocus: function () {
82 let nodeCellName = this.node.getChildByName('Name');
83 cc.find("NormalName", nodeCellName).opacity = 255;
84 //超出滚动
85 let nodeScreenTitleText = cc.find('ActiveName/NameContainer/NameText', nodeCellName);
86
87 let fOriginalX = nodeScreenTitleText.x;
88 let fOriginalY = nodeScreenTitleText.y;
89
90 let nodeScreenTitleText1 = nodeScreenTitleText.getChildByName('NameText1');
91 let nodeScreenTitleText2 = nodeScreenTitleText.getChildByName('NameText2');
92 nodeScreenTitleText2.x = nodeScreenTitleText1.x + nodeScreenTitleText1.width + 10;//TODO:补丁,解决滚动重叠
93 if (nodeScreenTitleText1.width > nodeScreenTitleText.width) {
94 cc.find("ActiveName/NameContainer", nodeCellName).opacity = 255;
95 cc.find("NormalName", nodeCellName).opacity = 0;
96 let fEndPositionDelta = (nodeScreenTitleText1.width + 30);
97 //下方时长和字有关系,才能速度一样
98 var ftaScreenTitleMoveToTarget = cc.moveTo(10 * (nodeScreenTitleText1.width / nodeScreenTitleText.width), fOriginalX - fEndPositionDelta, fOriginalY);
99 var ftaScreenTitleMoveToBack = cc.moveTo(0, fOriginalX, fOriginalY);
100 var sequenceMediaTitle = cc.sequence(ftaScreenTitleMoveToTarget, ftaScreenTitleMoveToBack);
101 var repeatScreenTitle = cc.repeat(sequenceMediaTitle, 10);
102 repeatScreenTitle.setTag(Common.OVERLENGTH_MOVING);
103 nodeScreenTitleText.runAction(repeatScreenTitle);
104 nodeScreenTitleText2.active = true;
105 }
106 },
107 setUIWithoutFocus: function () {
108 let nodeCellName = this.node.getChildByName('Name');
109 cc.find("NormalName", nodeCellName).opacity = 255;
110 //如有滚动停止滚动
111 let nodeScreenTitleText = cc.find('ActiveName/NameContainer/NameText', nodeCellName);
112 if (null != nodeScreenTitleText.getActionByTag(Common.OVERLENGTH_MOVING)) {
113 nodeScreenTitleText.stopActionByTag(Common.OVERLENGTH_MOVING);
114 nodeScreenTitleText.getChildByName('NameText2').active = false;
115 cc.find("ActiveName/NameContainer", nodeCellName).opacity = 0;
116 }
117 nodeScreenTitleText.x = 0;
118 },
119
120 });
1 //推荐页
2 var Common = require('Common');
3 var Network = require('Network');
4
5 cc.Class({
6 extends: cc.Component,
7
8 properties: {
9 id: 0,
10 pic: cc.Sprite,
11 activeName1: cc.Label,
12 activeName2: cc.Label,
13 normalName: cc.Label,
14 },
15
16 // data: {id,iconSF,itemName,itemPrice}
17 init: function (data, funCallback, strCellName, i, iCurrentIndex) {
18 // cc.log("pfbRecommend->init: "+data.tvlink);
19 // this.id = data.id;
20 this.node.width = data.width;
21 this.node.height = data.height;
22 this.node.getChildByName('Pic').width = data.width;
23 this.node.getChildByName('Pic').height = data.height;
24 if (data.imageURL) {
25 var self = this;
26 cc.loader.loadRes(data.imageURL, cc.Texture2D, function (err, texture) {
27 if (strCellName == "topNavi") {
28 self.pic.spriteFrame = new cc.SpriteFrame(texture, cc.rect(0, 0, data.width, data.height));
29 if (i == iCurrentIndex) {
30 self.pic.spriteFrame = new cc.SpriteFrame(texture, cc.rect(0, data.height, data.width, data.height));
31 }
32 } else {
33 self.pic.spriteFrame = new cc.SpriteFrame(texture, cc.rect(0, 0, data.width, data.height));
34 }
35 // if (null != funCallback && typeof funCallback == 'function') {
36 // funCallback.call();
37 // }
38 });
39 // Network.loadImageInNativeRuntime(
40 // Common.TOPDRAW_IMAGE_SERVER_EDU + data.imageURL,
41 // function (texture) {
42 // self.pic.spriteFrame = new cc.SpriteFrame(texture,cc.rect(0,0,self.node.width,self.node.height));
43
44 // if (null != funCallback && typeof funCallback == 'function') {
45 // funCallback.call();
46 // }
47 // }, null, this
48 // );
49
50
51 }
52
53 if (strCellName == "topNavi" && i>0) {
54 this.node.getComponent(cc.Widget).top = data.top - data.height / 2;
55 } else {
56 this.node.getComponent(cc.Widget).top = data.top;
57 }
58 this.node.getComponent(cc.Widget).left = data.left;
59
60
61 if (data.title_visible == 1) { //前三个不需要显示文字
62 cc.find('Name', this.node).active = true;
63 cc.find('Name', this.node).width = data.width - 10;
64 cc.find('Name/TextBg', this.node).width = data.width;
65 cc.find('Name/NormalName', this.node).width = data.width - 10;
66 cc.find('Name/ActiveName', this.node).width = data.width - 10;
67 cc.find('Name/ActiveName/NameContainer', this.node).width = data.width - 10;
68 cc.find('Name/ActiveName/NameContainer/NameText', this.node).width = data.width - 10;
69 this.normalName.node.width = data.width - 10;
70 this.activeName1.string = data.title;
71 this.activeName2.string = data.title;
72 this.normalName.string = data.title;
73 this.activeName1._updateRenderData(true);
74 this.activeName2._updateRenderData(true);
75 this.normalName._updateRenderData(true);
76
77 //调整文字位置
78 let nodeCellName = this.node.getChildByName('Name');
79 let nodeScreenTitleText = cc.find('ActiveName/NameContainer/NameText', nodeCellName);
80 let nodeScreenTitleText1 = nodeScreenTitleText.getChildByName('NameText1');
81 if (nodeScreenTitleText1.width > nodeScreenTitleText.width) {
82 this.normalName.overflow = cc.Label.Overflow.CLAMP;
83 this.normalName.enableWrapText = false;
84 this.normalName.horizontalAlign = cc.Label.HorizontalAlign.LEFT;
85 }
86 }
87 },
88
89 setUIWithFocus: function () {
90 let nodeCellName = this.node.getChildByName('Name');
91 cc.find("NormalName", nodeCellName).opacity = 255;
92 //超出滚动
93 let nodeScreenTitleText = cc.find('ActiveName/NameContainer/NameText', nodeCellName);
94
95 let fOriginalX = nodeScreenTitleText.x;
96 let fOriginalY = nodeScreenTitleText.y;
97
98 let nodeScreenTitleText1 = nodeScreenTitleText.getChildByName('NameText1');
99 let nodeScreenTitleText2 = nodeScreenTitleText.getChildByName('NameText2');
100 nodeScreenTitleText2.x = nodeScreenTitleText1.x + nodeScreenTitleText1.width + 10;//TODO:补丁,解决滚动重叠
101 cc.log(nodeScreenTitleText1.width + "------------" + nodeScreenTitleText.width);
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
117 setUIWithoutFocus: function () {
118 let nodeCellName = this.node.getChildByName('Name');
119 cc.find("NormalName", nodeCellName).opacity = 255;
120 //如有滚动停止滚动
121 let nodeScreenTitleText = cc.find('ActiveName/NameContainer/NameText', nodeCellName);
122 if (null != nodeScreenTitleText.getActionByTag(Common.OVERLENGTH_MOVING)) {
123 nodeScreenTitleText.stopActionByTag(Common.OVERLENGTH_MOVING);
124 nodeScreenTitleText.getChildByName('NameText2').active = false;
125 cc.find("ActiveName/NameContainer", nodeCellName).opacity = 0;
126 }
127 nodeScreenTitleText.x = 0;
128 },
129 });
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 },
18
19 statics: {
20 PFB_NAME: '',
21 CELL_NAME: '',
22 },
23
24 init: function (iCellIndex, bIsFocusEnable, compSceneCanvas) {
25
26 },
27
28 render(oData, iRecordIndex) {
29 this.activeName1.string = oData.name;
30 this.activeName2.string = oData.name;
31 this.normalName.string = oData.name;
32 this.Name.string = oData.name;
33
34 this.node.getChildByName("Normal").active = true;
35
36 // this.activeName1._updateRenderData(true);
37 // this.activeName2._updateRenderData(true);
38 // this.normalName._updateRenderData(true);
39 },
40
41 enableFocusInfo: function () {
42 this.node.getComponent(FocusInfo).setEnable(true);
43 },
44
45 disableFocusInfo: function () {
46 this.node.getComponent(FocusInfo).setEnable(false);
47 },
48
49 setUIWithFocus: function () {
50 let nodeCellName = this.node.getChildByName('Name');
51 cc.find("NormalName", nodeCellName).opacity = 255;
52 //超出滚动
53 let nodeScreenTitleText = cc.find('ActiveName/NameContainer/NameText', nodeCellName);
54
55 let fOriginalX = nodeScreenTitleText.x;
56 let fOriginalY = nodeScreenTitleText.y;
57
58 let nodeScreenTitleText1 = nodeScreenTitleText.getChildByName('NameText1');
59 let nodeScreenTitleText2 = nodeScreenTitleText.getChildByName('NameText2');
60 nodeScreenTitleText2.x = nodeScreenTitleText1.x + nodeScreenTitleText1.width + 10;//TODO:补丁,解决滚动重叠
61 if (nodeScreenTitleText1.width > nodeScreenTitleText.width) {
62 cc.find("ActiveName/NameContainer", nodeCellName).opacity = 255;
63 cc.find("NormalName", nodeCellName).opacity = 0;
64 let fEndPositionDelta = (nodeScreenTitleText1.width + 30);
65 //下方时长和字有关系,才能速度一样
66 var ftaScreenTitleMoveToTarget = cc.moveTo(10 * (nodeScreenTitleText1.width / nodeScreenTitleText.width), fOriginalX - fEndPositionDelta, fOriginalY);
67 var ftaScreenTitleMoveToBack = cc.moveTo(0, fOriginalX, fOriginalY);
68 var sequenceMediaTitle = cc.sequence(ftaScreenTitleMoveToTarget, ftaScreenTitleMoveToBack);
69 var repeatScreenTitle = cc.repeat(sequenceMediaTitle, 10);
70 repeatScreenTitle.setTag(Common.OVERLENGTH_MOVING);
71 nodeScreenTitleText.runAction(repeatScreenTitle);
72 nodeScreenTitleText2.active = true;
73 }
74 },
75 setUIWithoutFocus: function () {
76 let nodeCellName = this.node.getChildByName('Name');
77 cc.find("NormalName", nodeCellName).opacity = 255;
78 //如有滚动停止滚动
79 let nodeScreenTitleText = cc.find('ActiveName/NameContainer/NameText', nodeCellName);
80 if (null != nodeScreenTitleText.getActionByTag(Common.OVERLENGTH_MOVING)) {
81 nodeScreenTitleText.stopActionByTag(Common.OVERLENGTH_MOVING);
82 nodeScreenTitleText.getChildByName('NameText2').active = false;
83 cc.find("ActiveName/NameContainer", nodeCellName).opacity = 0;
84 }
85 nodeScreenTitleText.x = 0;
86 },
87
88 });
1 //推荐页
2 var Common = require('Common');
3 var Network = require('Network');
4
5 cc.Class({
6 extends: cc.Component,
7
8 properties: {
9 id: 0,
10 title: cc.Label,
11 selectTitle: cc.Label,
12 activeName1: cc.Label,
13 activeName2: cc.Label,
14 normalName: cc.Label,
15 afterTitle: cc.Label,
16 afterName: cc.Label,
17 },
18
19 // data: {id,iconSF,itemName,itemPrice}
20 init: function (data, funCallback, i) {
21
22
23 // cc.find('Select/Name', this.node).active = true;
24 // cc.find('Select/Name', this.node).width = data.width - 10;
25 // cc.find('Select/Name/TextBg', this.node).width = data.width;
26 // cc.find('Select/Name/NormalName', this.node).width = data.width - 10;
27 // cc.find('Select/Name/ActiveName', this.node).width = data.width - 10;
28 // cc.find('Select/Name/ActiveName/NameContainer', this.node).width = data.width - 10;
29 // cc.find('Select/Name/ActiveName/NameContainer/NameText', this.node).width = data.width - 10;
30 // this.normalName.node.width = data.width - 10;
31 let aTitle = ["魔法沙拉2", "奔跑吧小兔子", "勇敢的啫喱", "记忆翻牌"];
32 let aName = ["和爸妈一起做一盘沙拉", "和小兔子一起出门吧", "和Q弹的彩色啫喱锻炼身体", "上完网课,锻炼下记忆力"];
33 this.title.string = aTitle[i];
34 this.selectTitle.string=aTitle[i];
35 this.activeName1.string = data.title || aName[i];
36 this.activeName2.string = data.title || aName[i];
37 this.normalName.string = data.title || aName[i];
38 this.afterTitle.string = aTitle[i];
39 this.afterName.string = aName[i];
40 // this.activeName1._updateRenderData(true);
41 // this.activeName2._updateRenderData(true);
42 // this.normalName._updateRenderData(true);
43
44 //调整文字位置
45 let nodeCellName = cc.find("Select/Name", this.node);
46 let nodeScreenTitleText = cc.find('ActiveName/NameContainer/NameText', nodeCellName);
47 let nodeScreenTitleText1 = nodeScreenTitleText.getChildByName('NameText1');
48 if (nodeScreenTitleText1.width > nodeScreenTitleText.width) {
49 this.normalName.overflow = cc.Label.Overflow.CLAMP;
50 this.normalName.enableWrapText = false;
51 this.normalName.horizontalAlign = cc.Label.HorizontalAlign.LEFT;
52 }
53 },
54
55 setUIWithFocus: function () {
56 let nodeCellName = cc.find("Select/Name", this.node);
57 cc.find("NormalName", nodeCellName).opacity = 255;
58 //超出滚动
59 let nodeScreenTitleText = cc.find('ActiveName/NameContainer/NameText', nodeCellName);
60
61 let fOriginalX = nodeScreenTitleText.x;
62 let fOriginalY = nodeScreenTitleText.y;
63
64 let nodeScreenTitleText1 = nodeScreenTitleText.getChildByName('NameText1');
65 let nodeScreenTitleText2 = nodeScreenTitleText.getChildByName('NameText2');
66 nodeScreenTitleText2.x = nodeScreenTitleText1.x + nodeScreenTitleText1.width + 10;//TODO:补丁,解决滚动重叠
67 cc.log(nodeScreenTitleText1.width + "------------" + nodeScreenTitleText.width);
68 if (nodeScreenTitleText1.width > nodeScreenTitleText.width) {
69 cc.find("ActiveName/NameContainer", nodeCellName).opacity = 255;
70 cc.find("NormalName", nodeCellName).opacity = 0;
71 let fEndPositionDelta = (nodeScreenTitleText1.width + 30);
72 //下方时长和字有关系,才能速度一样
73 var ftaScreenTitleMoveToTarget = cc.moveTo(10 * (nodeScreenTitleText1.width / nodeScreenTitleText.width), fOriginalX - fEndPositionDelta, fOriginalY);
74 var ftaScreenTitleMoveToBack = cc.moveTo(0, fOriginalX, fOriginalY);
75 var sequenceMediaTitle = cc.sequence(ftaScreenTitleMoveToTarget, ftaScreenTitleMoveToBack);
76 var repeatScreenTitle = cc.repeat(sequenceMediaTitle, 10);
77 repeatScreenTitle.setTag(Common.OVERLENGTH_MOVING);
78 nodeScreenTitleText.runAction(repeatScreenTitle);
79 nodeScreenTitleText2.active = true;
80 }
81 },
82
83 setUIWithoutFocus: function () {
84 let nodeCellName = cc.find("Select/Name", this.node);
85 cc.find("NormalName", nodeCellName).opacity = 255;
86 //如有滚动停止滚动
87 let nodeScreenTitleText = cc.find('ActiveName/NameContainer/NameText', nodeCellName);
88 if (null != nodeScreenTitleText.getActionByTag(Common.OVERLENGTH_MOVING)) {
89 nodeScreenTitleText.stopActionByTag(Common.OVERLENGTH_MOVING);
90 nodeScreenTitleText.getChildByName('NameText2').active = false;
91 cc.find("ActiveName/NameContainer", nodeCellName).opacity = 0;
92 }
93 nodeScreenTitleText.x = 0;
94 },
95 });
1 var Network = require('Network');
2 var Application = require('Application');
3 var Common = require('Common');
4 var BusinessParameter = require('BusinessParameter');
5 var TVCanvas = require('TVCanvas');
6 var Log = require('Log');
7 var CCMediaPlayer = require('CCMediaPlayer');
8
9 cc.Class({
10 extends: TVCanvas,
11
12 properties: {
13
14 },
15
16 onLoad: function () {
17 if(cc.sys.isNative){
18 jsb.reflection.callStaticMethod("org/cocos2dx/javascript/AppActivity", "removeLaunchImage", "()V");
19 }
20 //播放器使用
21 let nodeVideoPlayer = new cc.Node('VideoPlayer');
22 let nodeBg = new cc.Node('Bg');
23 nodeBg.parent = nodeVideoPlayer;
24 nodeVideoPlayer.parent = cc.find("PlayerContainer");
25 //nodeVideoPlayer.addComponent(cc.IjkPlayer);
26 //nodeVideoPlayer.addComponent(cc.VitamioPlayer);
27 // nodeVideoPlayer.addComponent(cc.VideoPlayer);
28 //替换集成的播放器 fix jerry
29 nodeVideoPlayer.addComponent(CCMediaPlayer);
30 // let strLoadImagePath = "Texture/splash_black";
31 // Common.renderSpriteByLocalImage(strLoadImagePath, nodeBg.addComponent(cc.Sprite));
32
33 nodeVideoPlayer.parent.zIndex = cc.macro.MIN_ZINDEX;
34 cc.game.addPersistRootNode(nodeVideoPlayer.parent);
35
36 cc.director.loadScene("sceneMain");
37 },
38 });
1 const player = "com/topdraw/component/CocosMediaPlayer";
2
3 const CALLBACK_FUNCS = {
4 INFO: null,
5 PREPARED: null,
6 SEEKCOMPLETE: null,
7 COMPLETION: null,
8 ERROR: null,
9 BUFFERSTART: null,
10 BUFFERSTOP: null,
11 TIMEOUT: null,
12 };
13 //根据春哥封装的视频接口,整合出来的视频播放组件
14 cc.Class({
15 extends: cc.Component,
16
17 properties: {
18 url: '',
19 },
20
21 onLoad() {
22 this._playing = false;
23 this.init("Android"); //初始化工作,Android, NewTV, Vitamio, IJK
24 this.setArea(0, 720 - 720, 1280, 720); //默认全屏
25 },
26
27 init: function (type) {
28 if (cc.sys.isNative) {
29 jsb.reflection.callStaticMethod(player, "jsInit", "(Ljava/lang/String;)V", type);
30 }
31 },
32 setArea: function (x, y, w, h) {
33 if (cc.sys.isNative) {
34 jsb.reflection.callStaticMethod(player, "jsSetArea", "(IIII)V", x, y, w, h);
35 }
36 },
37 setPlayURL: function (url) {
38 this._playing = false;
39 this.url = url; //fix jerry
40 jsb.reflection.callStaticMethod(player, "jsSetPlayURL", "(Ljava/lang/String;)V", url);
41 },
42 setInfo: function (info) {
43 jsb.reflection.callStaticMethod(player, "jsSetInfo", "(Ljava/lang/String;)V", info);
44 },
45 prepare: function () {
46 jsb.reflection.callStaticMethod(player, "jsPrepare", "()V");
47 },
48 prepareAsync: function () {
49 jsb.reflection.callStaticMethod(player, "jsPrepareAsync", "()V");
50 },
51 start: function (time) {
52 this._playing = true;
53 jsb.reflection.callStaticMethod(player, "jsStart", "(I)V", time);
54 },
55 pause: function () {
56 this._playing = false;
57 jsb.reflection.callStaticMethod(player, "jsPause", "()V");
58 },
59 seekTo: function (time) {
60 jsb.reflection.callStaticMethod(player, "jsSeekTo", "(I)V", time);
61 },
62 setVolume: function (volume) {
63 jsb.reflection.callStaticMethod(player, "jsSetVolume", "(I)V", volume);
64 },
65 setVolume: function (leftVolume, rightVolume) {
66 jsb.reflection.callStaticMethod(player, "jsSetVolume", "(FF)V", leftVolume, rightVolume);
67 },
68 stop: function () {
69 jsb.reflection.callStaticMethod(player, "jsStop", "()V");
70 },
71 reset: function () {
72 jsb.reflection.callStaticMethod(player, "jsReset", "()V");
73 },
74 release: function () {
75 CALLBACK_FUNCS.INFO = null;
76 CALLBACK_FUNCS.PREPARED = null;
77 CALLBACK_FUNCS.SEEKCOMPLETE = null;
78 CALLBACK_FUNCS.COMPLETION = null;
79 CALLBACK_FUNCS.ERROR = null;
80 CALLBACK_FUNCS.BUFFERSTART = null;
81 CALLBACK_FUNCS.BUFFERSTOP = null;
82 CALLBACK_FUNCS.TIMEOUT = null;
83 jsb.reflection.callStaticMethod(player, "jsRelease", "()V");
84 },
85 getCurrentPosition: function () {
86 return jsb.reflection.callStaticMethod(player, "jsGetCurrentPosition", "()I");
87 },
88 getDuration: function () {
89 return jsb.reflection.callStaticMethod(player, "jsGetDuration", "()I");
90 },
91 getVolume: function () {
92 return jsb.reflection.callStaticMethod(player, "jsGetVolume", "()I");
93 },
94 isPlaying: function () {
95 // return jsb.reflection.callStaticMethod(player, "jsIsPlaying", "()Z");
96 return this._playing;
97 },
98 setOnInfoListener: function (func) {
99 CALLBACK_FUNCS.INFO = func;
100 },
101 setOnPreparedListener: function (func) {
102 CALLBACK_FUNCS.PREPARED = func;
103 },
104 setOnSeekCompleteListener: function (func) {
105 CALLBACK_FUNCS.SEEKCOMPLETE = func;
106 },
107 setOnCompletionListener: function (func) {
108 CALLBACK_FUNCS.COMPLETION = func;
109 },
110 setOnErrorListener: function (func) {
111 CALLBACK_FUNCS.ERROR = func;
112 },
113 onInfo: function () {
114 try {
115 if (null != CALLBACK_FUNCS.INFO) {
116 CALLBACK_FUNCS.INFO.apply(this, arguments);
117 }
118 } catch (e) {
119
120 }
121 },
122 onPrepared: function () {
123 try {
124 // this._cLog.screenI("CCMediaPlayer onPrepared...");
125 if (null != CALLBACK_FUNCS.PREPARED) {
126 CALLBACK_FUNCS.PREPARED.apply(this, arguments);
127 }
128 } catch (e) {
129
130 }
131 },
132 onSeekComplete: function () {
133 try {
134 if (null != CALLBACK_FUNCS.SEEKCOMPLETE) {
135 CALLBACK_FUNCS.SEEKCOMPLETE.apply(this, arguments);
136 }
137 } catch (e) {
138
139 }
140 },
141 onCompletion: function () {
142 try {
143 if (null != CALLBACK_FUNCS.COMPLETION) {
144 CALLBACK_FUNCS.COMPLETION.apply(this, arguments);
145 }
146 } catch (e) {
147
148 }
149 },
150 onError: function () {
151 try {
152 if (null != CALLBACK_FUNCS.ERROR) {
153 CALLBACK_FUNCS.ERROR.apply(this, arguments);
154 }
155 } catch (e) {
156
157 }
158 },
159 onBufferStart: function () {
160 try {
161 if (null != CALLBACK_FUNCS.BUFFERSTART) {
162 CALLBACK_FUNCS.BUFFERSTART.apply(this, arguments);
163 }
164 } catch (e) {
165
166 }
167 },
168 onBufferStop: function () {
169 try {
170 if (null != CALLBACK_FUNCS.BUFFERSTOP) {
171 CALLBACK_FUNCS.BUFFERSTOP.apply(this, arguments);
172 }
173 } catch (e) {
174
175 }
176 },
177 onTimeOut: function () {
178 try {
179 if (null != CALLBACK_FUNCS.TIMEOUT) {
180 CALLBACK_FUNCS.TIMEOUT.apply(this, arguments);
181 }
182 } catch (e) {
183
184 }
185 },
186
187 onDestroy() {
188 this.release();
189 },
190
191 });
192 //监听,放在class中,android回调找不到
193 window.MediaPlayer = {
194 onInfo: function () {
195 try {
196 if (null != CALLBACK_FUNCS.INFO) {
197 CALLBACK_FUNCS.INFO.apply(this, arguments);
198 }
199 } catch (e) {
200
201 }
202 },
203 onPrepared: function () {
204 try {
205 if (null != CALLBACK_FUNCS.PREPARED) {
206 CALLBACK_FUNCS.PREPARED.apply(this, arguments);
207 }
208 } catch (e) {
209
210 }
211 },
212 onSeekComplete: function () {
213 try {
214 if (null != CALLBACK_FUNCS.SEEKCOMPLETE) {
215 CALLBACK_FUNCS.SEEKCOMPLETE.apply(this, arguments);
216 }
217 } catch (e) {
218
219 }
220 },
221 onCompletion: function () {
222 try {
223 if (null != CALLBACK_FUNCS.COMPLETION) {
224 CALLBACK_FUNCS.COMPLETION.apply(this, arguments);
225 }
226 } catch (e) {
227
228 }
229 },
230 onError: function () {
231 try {
232 if (null != CALLBACK_FUNCS.ERROR) {
233 CALLBACK_FUNCS.ERROR.apply(this, arguments);
234 }
235 } catch (e) {
236
237 }
238 },
239 onBufferStart: function () {
240 try {
241 if (null != CALLBACK_FUNCS.BUFFERSTART) {
242 CALLBACK_FUNCS.BUFFERSTART.apply(this, arguments);
243 }
244 } catch (e) {
245
246 }
247 },
248 onBufferStop: function () {
249 try {
250 if (null != CALLBACK_FUNCS.BUFFERSTOP) {
251 CALLBACK_FUNCS.BUFFERSTOP.apply(this, arguments);
252 }
253 } catch (e) {
254
255 }
256 },
257 onTimeOut: function () {
258 try {
259 if (null != CALLBACK_FUNCS.TIMEOUT) {
260 CALLBACK_FUNCS.TIMEOUT.apply(this, arguments);
261 }
262 } catch (e) {
263
264 }
265 },
266 }
1 //重写轮播指示器
2
3 cc.Class({
4 extends: cc.PageViewIndicator,
5
6 properties: {
7
8 },
9
10 _changedState: function () {
11 var indicators = this._indicators;
12 if (indicators.length === 0) return;
13 var idx = this._pageView._curPageIdx;
14 if (idx >= indicators.length) return;
15 for (var i = 0; i < indicators.length; ++i) {
16 var node = indicators[i];
17 node.opacity = 255 / 2;
18 node.color = new cc.color(0, 0, 0);
19 }
20 indicators[idx].opacity = 255;
21 indicators[idx].color = new cc.color(255, 255, 255);
22 },
23
24 });
1 //用于做动态添加文字滚动效果
2 var Common = require('Common');
3 cc.Class({
4 extends: cc.Component,
5
6 properties: {
7
8 },
9 init: function (strText, aStrLabel) {
10 this._aStrLabel = aStrLabel;
11 this._iCurrent = 0;
12 let nodeTitleText = this.node.getChildByName("TitleText");
13 let nodeTitleText1;
14 let nodeTitleText2;
15 this.labelTitleText1;
16 this.labelTitleText2;
17 if (!nodeTitleText) {
18 nodeTitleText = new cc.Node("TitleText");
19 nodeTitleText1 = new cc.Node("TitleText1");
20 nodeTitleText2 = new cc.Node("TitleText2");
21 this.labelTitleText1 = nodeTitleText1.addComponent(cc.Label);
22 this.labelTitleText2 = nodeTitleText2.addComponent(cc.Label);
23 nodeTitleText.addChild(nodeTitleText1);
24 nodeTitleText.addChild(nodeTitleText2);
25 nodeTitleText.parent = this.node;
26 this.labelTitleText1.fontSize = 22;
27 this.labelTitleText2.fontSize = 22;
28 this.labelTitleText1.lineHeight = 24;
29 this.labelTitleText2.lineHeight = 24;
30 nodeTitleText1.anchorX = 0;
31 nodeTitleText2.anchorX = 0;
32 let layoutTitleText = nodeTitleText.addComponent(cc.Layout);
33 layoutTitleText.type = cc.Layout.Type.HORIZONTAL;
34 layoutTitleText.resizeMode = cc.Layout.ResizeMode.CONTAINER;
35 layoutTitleText.spacingX = 60;
36 this.node.addComponent(cc.Mask);
37 } else {
38 nodeTitleText1 = nodeTitleText.getChildByName("TitleText1");
39 nodeTitleText2 = nodeTitleText.getChildByName("TitleText2");
40 this.labelTitleText1 = nodeTitleText1.getComponent(cc.Label);
41 this.labelTitleText2 = nodeTitleText2.getComponent(cc.Label);
42 }
43 nodeTitleText.anchorX = 0;
44 this.node.anchorX = 0;
45 this.labelTitleText1.string = strText;
46 this.labelTitleText2.string = strText;
47 if (aStrLabel.length > 0 && aStrLabel[0]) {
48 this.labelTitleText1.string = aStrLabel[0];
49 this.labelTitleText2.string = aStrLabel[0];
50 this._iCurrent++;
51 }
52 this.labelTitleText1._forceUpdateRenderData(true);
53 this.labelTitleText2._forceUpdateRenderData(true);
54 this.node.x = -this.node.width / 2;
55 nodeTitleText2.opacity = 0;
56 nodeTitleText.x = 0;
57 nodeTitleText.y = -1;
58 nodeTitleText.x = 0;
59 this.node.opacity = 255;
60 },
61 setUIWithFocus: function () {
62 var self = this;
63 //转起来 这部分以后要尽量放到Cell里去
64 let nodeTitleMask = this.node;
65 let nodeTitleContainer = nodeTitleMask.getChildByName('TitleText');
66 let nodeTitleText1 = nodeTitleContainer.getChildByName("TitleText1");
67 let nodeTitleText2 = nodeTitleContainer.getChildByName("TitleText2");
68
69 let fOriginalX = nodeTitleContainer.x;
70 let fOriginalY = nodeTitleContainer.y;
71 if (nodeTitleText1.width > nodeTitleMask.width) { //字超出长度才滚动
72 nodeTitleText2.opacity = 255;
73 let fEndPositionDelta = nodeTitleText1.width / 2 + nodeTitleText2.width / 2 + 50;
74
75 //下方时长和字有关系,才能速度一样h
76 var ftaTitleMoveToTarget = cc.moveTo(10, fOriginalX - fEndPositionDelta, fOriginalY);
77 var ftaTitleMoveToBack = cc.moveTo(0, fOriginalX, fOriginalY);
78
79 var sequenceTitle = cc.sequence(ftaTitleMoveToTarget, ftaTitleMoveToBack);
80 var finished = cc.callFunc(function () {
81 if (self._aStrLabel.length > 0) {
82 self.labelTitleText1.string = self._aStrLabel[this._iCurrent % self._aStrLabel.length];
83 self.labelTitleText2.string = self._aStrLabel[this._iCurrent % self._aStrLabel.length];
84 this._iCurrent++;
85 self.labelTitleText1._forceUpdateRenderData(true);
86 self.labelTitleText2._forceUpdateRenderData(true);
87 self.setUIWithFocus();
88 }
89 }, this, null);
90
91 var repeatTitle = cc.repeat(cc.sequence(sequenceTitle, finished), 10);
92 repeatTitle.setTag(Common.OVERLENGTH_MOVING);
93
94 nodeTitleContainer.stopAction(nodeTitleContainer.getActionByTag(Common.OVERLENGTH_MOVING));
95 nodeTitleContainer.runAction(repeatTitle);
96 }
97
98 },
99 setUIWithoutFocus: function () {
100 let nodeTitleMask = this.node;
101 let nodeTitleContainer = nodeTitleMask.getChildByName('TitleText');
102
103 nodeTitleContainer.stopAction(nodeTitleContainer.getActionByTag(Common.OVERLENGTH_MOVING));
104 let nodeTitleText2 = nodeTitleContainer.getChildByName("TitleText2");
105 nodeTitleText2.opacity = 0;
106 nodeTitleContainer.x = 0;
107 },
108 prohibit: function () {
109 this.setUIWithoutFocus();
110 this.node.opacity = 0;
111 },
112
113 });
1 /**
2 * 设置按钮状态
3 * 0 未聚焦
4 * 1 聚焦
5 * 2 未聚焦 + 附加(例如:已收藏)
6 * 3 聚焦 + 附加(例如:已收藏)
7 */
8 cc.Class({
9 extends: cc.Component,
10
11 properties: {
12 renderTexture : {
13 default : null,
14 type : cc.Texture2D
15 },
16 renderRects : {
17 default : [],
18 type : [cc.Rect]
19 },
20 _iRenderRectIndex : 0,
21 },
22
23 onLoad:function() {
24 this.setRenderRect(0);//默认加载先取第一张
25 },
26 setRenderTexture : function (texture) {
27 this.renderTexture = texture;
28 },
29 setRenderRect : function (index) {
30 this._iRenderRectIndex = index;
31 let rectRender = this.renderRects[index];
32 if(this.node.getComponent(cc.Sprite)&&rectRender){
33 this.node.getComponent(cc.Sprite).spriteFrame = new cc.SpriteFrame(this.renderTexture,rectRender.clone());//原先的写法,有点啰嗦
34 this.node.width = rectRender.width;
35 this.node.height = rectRender.height;
36 }
37 },
38 getRenderRectIndex : function () {
39 return this._iRenderRectIndex;
40 },
41 });
1 {
2 "__type__": "cc.AnimationClip",
3 "_name": "TsLoading",
4 "_objFlags": 0,
5 "_native": "",
6 "_duration": 4,
7 "sample": 2,
8 "speed": 1,
9 "wrapMode": 2,
10 "curveData": {
11 "props": {
12 "x": []
13 },
14 "comps": {
15 "cc.Sprite": {
16 "spriteFrame": [
17 {
18 "frame": 0,
19 "value": {
20 "__uuid__": "49835417-a9ef-4d86-940c-686cf28d2f28"
21 }
22 },
23 {
24 "frame": 0.5,
25 "value": {
26 "__uuid__": "48e18812-8fa6-4ace-91d7-a54e5a4f17e3"
27 }
28 },
29 {
30 "frame": 1,
31 "value": {
32 "__uuid__": "479e470b-fdc6-48c7-b0ab-e57cd15391fa"
33 }
34 },
35 {
36 "frame": 1.5,
37 "value": {
38 "__uuid__": "7505611b-ceb1-4faf-93c0-bd4190463597"
39 }
40 },
41 {
42 "frame": 2,
43 "value": {
44 "__uuid__": "ecbe4010-4a2c-445e-b8a9-9e372a05d9d0"
45 }
46 },
47 {
48 "frame": 2.5,
49 "value": {
50 "__uuid__": "58f7e7c2-c3de-4028-a0c9-5517ad8b7d3e"
51 }
52 },
53 {
54 "frame": 3,
55 "value": {
56 "__uuid__": "9b8f687c-493e-4e2e-92c2-298aeccafc07"
57 }
58 },
59 {
60 "frame": 3.5,
61 "value": {
62 "__uuid__": "07c69c69-c773-4ffb-9402-5ecc021bf105"
63 }
64 }
65 ]
66 }
67 }
68 },
69 "events": [
70 {
71 "frame": 0,
72 "func": "",
73 "params": []
74 },
75 {
76 "frame": 0,
77 "func": "",
78 "params": []
79 }
80 ]
81 }
...\ No newline at end of file ...\ No newline at end of file
1 {
2 "__type__": "cc.AnimationClip",
3 "_name": "prifileRotation",
4 "_objFlags": 0,
5 "_native": "",
6 "_duration": 2.5,
7 "sample": 60,
8 "speed": 0.1,
9 "wrapMode": 2,
10 "curveData": {
11 "props": {
12 "angle": [
13 {
14 "frame": 0,
15 "value": 0
16 },
17 {
18 "frame": 0.8333333333333334,
19 "value": -120
20 },
21 {
22 "frame": 1.6666666666666667,
23 "value": -240
24 },
25 {
26 "frame": 2.5,
27 "value": -360
28 }
29 ]
30 }
31 },
32 "events": []
33 }
...\ No newline at end of file ...\ No newline at end of file
No preview for this file type