Common.js
8.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
cc.Class({
extends: cc.Component,
properties: {
},
// use this for initialization
onLoad: function () {
},
statics: {
VERSION: "3.1.06",
SCREEN_WIDTH: 1280.0,
SCREEN_HEIGHT: 720.0,
MOVE_DIRECTION_UP: 0,
MOVE_DIRECTION_RIGHT: 1,
MOVE_DIRECTION_DOWN: 2,
MOVE_DIRECTION_LEFT: 3,
FOCUS_FLY_DURATION: 0.2,
FOCUS_BREATH_DURATION: 0.8,
//Action Tag
FEATURE_NODE_TRANSFER: 1,
FOCUS_CELL_TRANSFER: 1,
FOCUS_CONTAINER_TRANSFER: 1,
FOCUS_CONTAINER_BREATH: 2,
FOCUS_CONTAINER_JOGGLE: 3,
OVERLENGTH_MOVING: 4,
SCROLL_BY_FOCUS_CHANGE: 5,
API_SORT_ASC: 'asc',
API_SORT_DESC: 'desc',
FEMALE: 0,
MALE: 1,
BAND: 2,
ANDROID_KEY: {
back: 6,
up: 1003,
right: 1001,
down: 1004,
left: 1000,
enter: 1005
},
OFFICIAL_PLATFORM_IP: 'http://139.196.192.33/',
TEST_PLATFORM_IP: 'http://139.196.192.242:8081/',
TOPDRAW_API_SERVER: 'http://demo.cloud.api.findfun.topdraw.cn:38081/findfun/',
TOPDRAW_IMAGE_SERVER: 'http://demo.cloud.api.findfun.topdraw.cn:38081/findfun/',
TOPDRAW_LOG_SERVER: 'http://139.196.37.202/sparrow.resource/',
// BI_BASE_PATH : 'http://139.196.192.242:81/1.gif',
BI_BASE_PATH: 'http://melody.hi.a170.ottcn.com:80/1.gif',
BI_BASE_PATH_NEW: 'http://melody.hi.a170.ottcn.com:80/2.gif',
TV_LINK_ACTION_CLICK: 100,
TV_LINK_ACTION_HOVER: 101,
API_TOKEN: 'dd4b1968eb5b417e834c2687e23d2471', //c744677d2c4e47e5987c8573325d2c56
// TEST_API_TOKEN:'9b16e7b8ecc64a1d9df89bd394d6a06b',
TEST_API_TOKEN: 'dd4b1968eb5b417e834c2687e23d2471',
TEST_PLAY_URL: "http://39.130.192.215:6060/000000003200/866b5508be484775905dcfcdc9f18e3f/index.m3u8",
USER_ID: '',
AUTH_STATUS: 0, //鉴权默认不成功 fix jerry
AUTH_PRODUCT: "",
AUTHORIZATIONNUM: "",
DEBUG_MODE: 0,//0非调试模式,1调试模式
//PLAY_LIST_ITEM_COUNT_LIMIT : 100,
PLAY_LIST_ITEM_COUNT_LIMIT: 100000,//本来上限是100首,因为需求的改来改去,我先把这里改成100000,糊一下上限的问题
ADD_2_PLAY_LIST_CEIL_PROMPT_DURATION: 5,
BACK_WITH_DETAIN: true,
//TEST_API_TOKEN:'6b071a064fb047bbbd47c5b3326f34d5', B2C 的
_bIsHotUpdate: false,
PRODUCT_LIST: null,
VALID_PLAY_TIME_DURATION: 5 * 60,
MEDIA_INVALID_PROMPT: '该地区暂未上线本歌曲,马上为您播放下一首哦!',
g_strCurrentSceneName: "",
g_iPlayerPlayedTime: 0,
g_strPlayerPlayedId: null,
g_oSpriteFrame: {},
g_oSpriteFrameURL: {},
g_oTextureInUsage: {},
g_oRomoteURLTexture: {},
g_aDebugKey: ["up", "up", "up", "up", "right", "right", "right", "down", "down", "left"],
g_iDebugIndex: 0,
loadRes: function (strResourceURL,/*iResourceIndex,*/onSuccess, onError, oScope) {
cc.loader.loadRes(strResourceURL,
function (error, loadedResource) {
cc.g_oUsedPrefabPaths[strResourceURL] = strResourceURL;
if (error) {
if (null != oScope) {
onError.call(oScope, error);
} else {
onError(error);
}
} else {
if (null != oScope) {
onSuccess.call(oScope, loadedResource/*,iResourceIndex*/);
} else {
onSuccess(loadedResource/*,iResourceIndex*/);
}
}
}
);
},
setTimeout: function (onTimeComplete, iDuration, oScope, argements) {
},
getAbsolutePositionX: function (node) {
},
getAbsolutePositionY: function (node) {
},
promiseAjax: function () {
},
getNodePath: function (node) {
let strPath = "";
if (node) {
while (node.parent && node.parent.parent) {//不算TopCanvas
strPath = "/" + node.name + strPath;
node = node.parent;
}
}
return strPath.substring(1);
},
getX: function (tempNode) {
let fCenterX = 0;
while (tempNode.parent && tempNode.parent.parent) {//不算TopCanvas
fCenterX += tempNode._fX || tempNode.x;
tempNode = tempNode.parent;
}
return fCenterX;
},
getY: function (tempNode) {
let fCenterY = 0;
while (tempNode.parent.parent) {//不算TopCanvas
//cc.log(tempNode.name+" Y: "+tempNode.y)
fCenterY += tempNode._fY || tempNode.y;
tempNode = tempNode.parent;
}
return fCenterY;
},
/**
* 用于合并对象 By Eva
* @param target
* @param firstSource
* @returns {any}
*/
assign: function (target, firstSource) {
if (target === undefined || target === null)
throw new TypeError("Cannot convert first argument to object");
var to = Object(target);
for (var i = 1; i < arguments.length; i++) {
var nextSource = arguments[i];
if (nextSource === undefined || nextSource === null) continue;
var keysArray = Object.keys(Object(nextSource));
for (var nextIndex = 0, len = keysArray.length; nextIndex < len; nextIndex++) {
var nextKey = keysArray[nextIndex];
var desc = Object.getOwnPropertyDescriptor(nextSource, nextKey);
if (desc !== undefined && desc.enumerable) to[nextKey] = nextSource[nextKey];
}
}
return to;
},
renderSpriteByLocalImage: (localImgPath, sprite) => {
cc.loader.loadRes(localImgPath, cc.SpriteFrame, (err, spriteFrame) => {
if (err) {
cc.error(err.message || err);
return;
}
cc.log('Result should be a sprite frame: ' + (spriteFrame instanceof cc.SpriteFrame));
sprite.spriteFrame = spriteFrame;
});
},
/**
*
* @param fnSuccess 成功操作
* @param iDelayDuration 延迟时间
* @param fnTimeout 超时操作
* @param oScope 作用域
* @param strTag 操作标签,防止重复操作
* @returns {Function}
*/
timeoutify: function (fnSuccess, iDelayDuration, fnTimeout, oScope, strTag) {
oScope.scheduleOnce(function () {
!oScope["Request" + strTag + "Loaded"] && fnTimeout && fnTimeout.call(oScope);
oScope["Request" + strTag + "Timout"] = true;
}, iDelayDuration);
return function () {
//未超时
if (!oScope["Request" + strTag + "Timout"]) {
oScope.unschedule(oScope.timeout);
fnSuccess.apply(oScope, arguments);
}
}
},
uuid: function (len, radix) {
var chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split("");
var uuid = [], i;
radix = radix || chars.length;
if (len) {
for (i = 0; i < len; i++) uuid[i] = chars[0 | (eval('Math.random()') * radix)];
} else {
var r;
uuid[8] = uuid[13] = uuid[18] = uuid[23] = "-";
uuid[14] = "4";
for (i = 0; i < 36; i++) {
if (!uuid[i]) {
r = 0 | (eval('Math.random()') * 16);
uuid[i] = chars[i == 19 ? (r & 0x3) | 0x8 : r];
}
}
}
return uuid.join("");
}
}
});