Commit bb7b0fc9 bb7b0fc960ff0c3bd2afb99e2cbd21480baf563c by 金学艇

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

2.修复首页高分排行榜选中效果展示
3.修复首页和分类页的翻页功能
4.修复首页焦点显示和隐藏错乱的问题
0 parents
Showing 319 changed files with 2553 additions and 0 deletions
[
{
"__type__": "cc.SceneAsset",
"_name": "",
"_objFlags": 0,
"_native": "",
"scene": {
"__id__": 1
}
},
{
"__type__": "cc.Scene",
"_objFlags": 0,
"_parent": null,
"_children": [
{
"__id__": 2
},
{
"__id__": 7
}
],
"_active": true,
"_components": [],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 0,
"height": 0
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float32Array",
"array": [
0,
0,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_is3DNode": true,
"_groupIndex": 0,
"groupIndex": 0,
"autoReleaseAssets": false,
"_id": "534a7ff1-b31e-45c5-968b-c8245ff12b6d"
},
{
"__type__": "cc.Node",
"_name": "Canvas",
"_objFlags": 0,
"_parent": {
"__id__": 1
},
"_children": [
{
"__id__": 3
}
],
"_active": true,
"_components": [
{
"__id__": 5
},
{
"__id__": 6
}
],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 1280,
"height": 720
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float32Array",
"array": [
640,
360,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "f4Iimnh+lIh4RhpGab/gGR"
},
{
"__type__": "cc.Node",
"_name": "Main Camera",
"_objFlags": 0,
"_parent": {
"__id__": 2
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 4
}
],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 0,
"height": 0
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float32Array",
"array": [
0,
0,
416.5582275390625,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "10WUQRPNFCs4qkE2/2rly6"
},
{
"__type__": "cc.Camera",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 3
},
"_enabled": true,
"_cullingMask": 4294967295,
"_clearFlags": 7,
"_backgroundColor": {
"__type__": "cc.Color",
"r": 0,
"g": 0,
"b": 0,
"a": 255
},
"_depth": -1,
"_zoomRatio": 1,
"_targetTexture": null,
"_fov": 60,
"_orthoSize": 10,
"_nearClip": 1,
"_farClip": 4096,
"_ortho": true,
"_rect": {
"__type__": "cc.Rect",
"x": 0,
"y": 0,
"width": 1,
"height": 1
},
"_renderStages": 1,
"_id": "92C/6VZexC8JWe/orQREQg"
},
{
"__type__": "cc.Canvas",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 2
},
"_enabled": true,
"_designResolution": {
"__type__": "cc.Size",
"width": 1280,
"height": 720
},
"_fitWidth": false,
"_fitHeight": true,
"_id": "a8MzCrdoZOZYqjzgHbUan+"
},
{
"__type__": "e8db1NJMMxF7IBsJ0cUPQXd",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 2
},
"_enabled": true,
"_cLog": null,
"_cApplication": null,
"_cFocus": null,
"_aFocusTargets": [],
"_fiCurrentFocus": null,
"_iSceneStatus": 0,
"_fFocusScaleFactor": 1.06,
"_bIsFocusInit": false,
"_oSceneContext": null,
"_oNextSceneParameter": null,
"_compPlayer": null,
"_aTouchContext": [],
"_defaultBackScene": null,
"_oFocusScaleFactorInfo": null,
"_id": "91dQYvnpBPdaAKZIVcvWvT"
},
{
"__type__": "cc.Node",
"_name": "PlayerContainer",
"_objFlags": 0,
"_parent": {
"__id__": 1
},
"_children": [],
"_active": true,
"_components": [],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 0,
"height": 0
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float32Array",
"array": [
640,
360,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "e4YGtpvMlI1ITlWZq9AqbS"
}
]
\ No newline at end of file
This diff could not be displayed because it is too large.
module.exports = cc.Class({
extends: cc.Component,
properties: {
info: cc.Label,
fileProgress: cc.ProgressBar,
fileLabel: cc.Label,
close: cc.Node,
updateBtn: cc.Node
},
onLoad () {
this.close.on(cc.Node.EventType.TOUCH_END, function () {
this.node.parent.active = false;
}, this);
}
});
\ No newline at end of file
cc.Class({
extends: cc.Component,
properties: {
// foo: {
// default: null, // The default value will be used only when the component attaching
// to a node for the first time
// url: cc.Texture2D, // optional, default is typeof default
// serializable: true, // optional, default is true
// visible: true, // optional, default is true
// displayName: 'Foo', // optional
// readonly: false, // optional, default is false
// },
// ...
},
// use this for initialization
onLoad: function () {
},
statics: {
//MAIN_NAVIGATOR_PROMOTION:'MainNavigator',
//写死推荐位名称
MAIN_NAVIGATOR_PROMOTION: 'MainNavigator3_0',//音乐大厅推荐位
MAIN_LEFT_NAVIGATOR_PROMOTION: "MainNavigator3_1",//首页左侧导航推荐位
MAIN_RIGHT_NAVIGATOR_PROMOTION: "rightNavigator3_1",//首页右侧瀑布流推荐位
MAIN_TOP_NAVIGATOR_PROMOTION: "MainServiceFeature3_1",//首页顶部推荐位
COLLECTION_LIST_PROMOTION: "UserCollectionNavigator3_1",//我的收藏左侧推荐位
FREE_LIST_PROMOTION: "FreeSongListNavigator3_1",//限时免费左侧推荐位
HISTORY_LIST_PROMOTION: "RecentPlayedListNavigator",//最近播放左侧推荐位
SUBJECT_LIST_PROMOTION: "SubjectListNavigator3_1",//专题列表左侧推荐位
TAG_LIST_PROMOTION: "TheNewestNavigator3_1",//最近更新左侧推荐位
RANK_LIST_PROMOTION: "SearchSongList3_1",//排行榜推荐位
SEARCH_NAVIGATOR_LIST_PROMOTION: "HotSearchNavigator3_1",//搜索应用导航推荐位
SUBINDEX_CONFIG_PROMOTION: "MainSubIndexConfig",//副首页各应用推荐位配置推荐位
//SUBSCRIBE_PROMOTION : "orderDetail",//订购推荐位
SUBSCRIBE_PROMOTION1: "3_2orderMode42",//订购推荐位导航
SUBSCRIBE_PROMOTION2: "3_2orderButton43",//订购推荐位按钮
SUBSCRIBE_PROMOTION3: "3_2orderDescript44",//订购推荐位描述
MAIN_2_DETAINMENT_PROMOTION: "Index2Dtnmnt",//进入应用引导推荐位
MINE_INDEX_PROMOTION: "MainMyInfoFeature3_1",//我的首页推荐位
SHOP_ADVISEMENT_PROMOTION: "MainMallFeature3_0",//商城广告推荐位
SCREEN_HEIGHT: 720.0,
//应用id
DOLPHINS_APPID: 'td71b187fedb257ac0',
KTV_APPID: 'td5d69e9b2187b4b04',
CHILDREN_APPID: 'td817a49dbf06018d4',
RADIO_APPID: 'td5b39abe465dd7475',
VARIETY_RADIO_APPID: 'tdf35c7fa7d04e9420',
VARIETY_VIDEO_APPID: 'td4fdce8945bdab9e7',
VARIETY_VOCAL_APPID: 'td06824d0c4376f3e2',
PERSONAL_SHOW_APPID: 'td80b6647556d41cfe',
SQUARE_DANCE_APPID: 'td4a75b565ad67da7a',
VOCAL_CONCERT_APPID: 'td77e42711d65e47fd',
MV_APPID: 'td7402250ed93cc768',
//==============根据平台需求需要调整值 开始
DAILY_RECOMMEND_CATEGORY_ID: 985, //每日推荐 1196 category_a9c34518-1c7a-48f9-a689-df10876c96a4 "category_bc4359d9-377e-4fae-9b49-0cc7ccc7d6c5" 鹏博士187
//KTV_ALL_SONGS_CATEGORY:29,//当贝id
KTV_ALL_SONGS_CATEGORY: 38,
VARIETY_VOCAL_ALL_SONGS_CATEGORY: 65,
//背景皮肤
//SCENE_SKIN_CATEGORY_ID : "1252",当贝
SCENE_SKIN_CATEGORY_ID: "1199",
SCENE_RADIO_SKIN_CATEGORY_ID: "1195",
//默认推荐分类id //当贝
// APP_RECOMMEND_CATEGORY_ID : {
// 'td5d69e9b2187b4b04' : 1100,
// 'td77e42711d65e47fd' : 1257,
// 'td7402250ed93cc768' : 1258,
// 'td4a75b565ad67da7a' : 1259,
// 'td817a49dbf06018d4' : 1260,
// },
APP_RECOMMEND_CATEGORY_ID: {
'td5d69e9b2187b4b04': 980,//1100,
'td77e42711d65e47fd': 1121,//1257,
'td7402250ed93cc768': 1122,//1258,
'td4a75b565ad67da7a': 1123,//1259,
'td817a49dbf06018d4': 1124,//1260,
},
//纯k热门分类id
KTV_HOT_CATEGORY_ROOT_ID: 39,
//综艺现场分类id
MV_HOT_CATEGORY_ROOT_ID: 7,
// DETAIN_SUBJECT_ID : 53,//当贝挽留专题id
DETAIN_SUBJECT_ID: 13,
//==============根据平台需求需要调整值 结束
FEMALE: 0,
MALE: 1,
BAND: 2,
VOCAL_CONCERT_FILTER: '全部,欧美,港台,大陆', //此功能暂时关闭
ADD_2_PLAY_LIST_CEIL_PROMPT: ["不要太贪心", "先听完已点歌曲再点哦!"],
NO_MEDIA_TIP: "未检测到节目,即将返回到上一页",
NO_MEDIA_INFO_TIP: "节目未上线,即将返回到上一页",
COMING_SOON: "敬请期待!",
QUIT_COMMON_TIP: "退订成功!",
QUIT_COMMON_TIP2: "订购关系已过期或者已退订!",
QUIT_COMMON_TIP3: "退订异常!",
ORDER_SUCCESS: '订购成功!',
ORDER_EXCEPTION: '网络异常,请重试',
ORDER_ENTER: '请稍后...',
NEWTV_APPID: '4bf34d0e9acf4aa',
CONTENT_ID: '2019121018210000000001',
//这个值应该动态获取,每次进入应用或每次发起包月订购(按次不支持退订)时记录下来,否则退订会返回“订购关系不存在”
QUIT_PRODUCT_CODE: '8802000245', //退订productCode
}
// called every frame, uncomment this function to activate update callback
// update: function (dt) {
// },
});
cc.Class({
extends: cc.Component,
properties: {
// foo: {
// default: null, // The default value will be used only when the component attaching
// to a node for the first time
// url: cc.Texture2D, // optional, default is typeof default
// serializable: true, // optional, default is true
// visible: true, // optional, default is true
// displayName: 'Foo', // optional
// readonly: false, // optional, default is false
// },
// ...
},
// 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
},
BUSINESS_PARAMETER: {
// {:,
},
OFFICIAL_PLATFORM_IP: 'http://139.196.192.33/',
TEST_PLATFORM_IP: 'http://139.196.192.242:8081/',
// TOPDRAW_API_SERVER : 'http://139.196.192.242:8081/hyperion.chimera/',
// TOPDRAW_IMAGE_SERVER : 'http://139.196.192.242:8081/hyperion.resource/',
// TOPDRAW_API_SERVER : 'http://39.130.160.199:8081/hyperion.chimera/',
// TOPDRAW_IMAGE_SERVER : 'http://39.130.160.199:8081/hyperion.resource/',
// 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://39.130.160.23:81/1.gif',
//2019.8.16修改新服务器
TOPDRAW_API_SERVER: 'http://112.47.3.216:8080/1/jinxueting/',
TOPDRAW_IMAGE_SERVER: 'http://112.47.3.216:8080/1/jinxueting/',
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) {
/*
window.setTimeout(onTimeComplete,iDuration,);
cc.loader.loadRes(strResourceURL,
function(error,loadedResource){
if (error){
if(null!=oScope){
onError.call(oScope,error);
}else{
onError(error);
}
}else{
if(null!=oScope){
onSuccess.call(oScope,loadedResource);
}else{
onSuccess(loadedResource);
}
}
}
);
*/
},
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("");
}
}
});
var Common = require('Common');
cc.Class({
extends: cc.Component,
properties: {
// TODO: to be a real Component?
//_fLeft:0,
//_fTop:0,
//_fWidth:0,
//_fHeight:0,
//_oFocusNode:null,//deprecated
_strTVLink: '',
_bEnable: false,
_fScaleFactor: 1.06,
_bIgnoreZIndex: false,
_iFlyDelayTime: 0,
_iFocusWeight: 100,
},
//ctor: function (fLeft,fTop,fWidth,fHeight,oFocusNode,strTVLink,bEnable,fnOnFocus,fnOnBlur) {
ctor: function () {
//this._fLeft=arguments[0];
//this._fTop=arguments[1];
//this._fWidth=arguments[2];
//this._fHeight=arguments[3];
//this._oFocusNode=arguments[4];
this._strTVLink = arguments[0];
this._bEnable = arguments[1];
this._fnOnFocus = arguments[2];
this._fnOnBlur = arguments[3];
//this._fLeft=fLeft;
//this._fTop=fTop;
//this._fWidth=fWidth;
//this._fHeight=fHeight;
//this._oFocusNode=oFocusNode;
},
init: function (/*fLeft,fTop,fWidth,fHeight,oFocusNode,*/strTVLink, bEnable, fnOnFocus, fnOnBlur, fScaleFactor) {
//this._fLeft=arguments[0];
//this._fTop=arguments[1];
//this._fWidth=arguments[2];
//this._fHeight=arguments[3];
//this._oFocusNode=arguments[4];
this._strTVLink = strTVLink;
this._bEnable = bEnable;
this._fnOnFocus = fnOnFocus;
this._fnOnBlur = fnOnBlur;
this._fScaleFactor = fScaleFactor;
//this._fLeft=fLeft;
//this._fTop=fTop;
this._fWidth = 0;
this._fHeight = 0;
//this._oFocusNode=oFocusNode;
this._oProbeInfo = {};
},
// use this for initialization
onLoad: function () {
//气泡式向上传递 通常收不到
//this.node.on('foucs', this._fnOnFocus || function(){},this);
//this.node.on('blur', this._fnOnBlur || function(){},this);
},
setFlyDelayTime: function (iDuration) {
this._iFlyDelayTime = iDuration;
},
getFlyDelayTime: function () {
return this._iFlyDelayTime;
},
setFocusWeight: function (iWeight) {
this._iFocusWeight = iWeight;
},
getFocusWeight: function () {
return this._iFocusWeight;
},
getLeft: function () {
//return this._fLeft;
return Common.SCREEN_WIDTH / 2 + (this.getX() - this.node.width / 2);
},
getTop: function () {
//return this._fTop;
return Common.SCREEN_HEIGHT / 2 - (this.getY() + this.node.height / 2);
},
getX: function () {
return Common.getX(this.node);
},
getY: function () {
return Common.getY(this.node);
},
getWidth: function () {
//return this._fWidth;
return this._fWidth || this.node.width; //有时候设计上元素会交叉,所以找焦点的时候只能设置虚拟尺寸
},
setFakeWidth: function (fWidth) {
this._fWidth = fWidth;
},
getHeight: function () {
return this._fHeight || this.node.height;
},
setFakeHeight: function (fHeight) {
this._fHeight = fHeight;
},
//getFocusNode:function(){
// return this._oFocusNode;
//},
//setFocusNode:function(oFocusNode){
// this._oFocusNode=oFocusNode;
//},
getTVLink: function () {
return this._strTVLink;
},
setTVLink: function (strTVLink) {
this._strTVLink = strTVLink;
},
getEnable: function () {
return this._bEnable;
},
setEnable: function (bEnable) {
this._bEnable = bEnable;
// cc.log("改变节点Enable属性:" + this.node.name+" : "+bEnable);
},
onFocus: function (fiFrom) {
if (this._fnOnFocus) {
this._fnOnFocus(fiFrom);
}
},
onBlur: function (fiTo) {
if (this._fnOnBlur) {
this._fnOnBlur(fiTo);
}
},
getScaleFactor: function () {
return this._fScaleFactor;
},
setScaleFactor: function (fScaleFactor) {
this._fScaleFactor = fScaleFactor;
},
ignoreZIndex: function (bool) {
this._bIgnoreZIndex = bool;
},
setFocusProbeInfo: function (oInfo) {
this._oProbeInfo = oInfo;
},
getFocusProbeInfo: function () {
return this._oProbeInfo;
},
onEnable: function () { //修改节点的active属性为true时会执行挂载组件的onEnable方法
//注意:子节点有ListView要慎用!会使所有未初始化数据的子节点也改变焦点状态
// cc.log("执行FocusInfo中onEnable方法");
// if (0 != this.node.name.indexOf('RoleInstallListCell') && 0 != this.node.name.indexOf('AchievementListCell')) {
this._bEnable = true;
// }
},
onDisable: function () { //修改节点的active属性为false时会执行挂载组件的onDisable方法
// cc.log("执行FocusInfo中onDisable方法" + this.node.name);
// if (0 != this.node.name.indexOf('CategoryListCell')) {
this._bEnable = false;
// cc.log("隐藏的名称:" + this.node.name);
// }
},
});
var Common = require('Common');
cc.Class({
extends: cc.Component,
properties: {
// TODO: to be a real Component?
//_fLeft:0,
//_fTop:0,
//_fWidth:0,
//_fHeight:0,
//_oFocusNode:null,//deprecated
_strTVLink:'',
_bEnable:false
},
//ctor: function (fLeft,fTop,fWidth,fHeight,oFocusNode) {
ctor: function () {
//this._fLeft=arguments[0];
//this._fTop=arguments[1];
//this._fWidth=arguments[2];
//this._fHeight=arguments[3];
//this._oFocusNode=arguments[4];
this._strTVLink=arguments[0];
this._bEnable=arguments[1];
//this._fLeft=fLeft;
//this._fTop=fTop;
//this._fWidth=fWidth;
//this._fHeight=fHeight;
//this._oFocusNode=oFocusNode;
},
init: function (/*fLeft,fTop,fWidth,fHeight,oFocusNode,*/strTVLink,bEnable) {
//this._fLeft=arguments[0];
//this._fTop=arguments[1];
//this._fWidth=arguments[2];
//this._fHeight=arguments[3];
//this._oFocusNode=arguments[4];
this._strTVLink=strTVLink;
this._bEnable=bEnable;
//this._fLeft=fLeft;
//this._fTop=fTop;
//this._fWidth=fWidth;
//this._fHeight=fHeight;
//this._oFocusNode=oFocusNode;
},
// use this for initialization
onLoad: function () {
},
// called every frame, uncomment this function to activate update callback
// update: function (dt) {
// },
getLeft:function(){
//return this._fLeft;
return Common.SCREEN_WIDTH/2+(this.getX()-this.node.width/2);
},
//setLeft:function(fLeft){
// this._fLeft=fLeft;
//},
getTop:function(){
//return this._fTop;
return Common.SCREEN_HEIGHT/2-(this.getY()+this.node.height/2);
},
getX:function(){
let tempNode=this.node;
let fCenterX=0;
while (tempNode.parent.parent){//不算TopCanvas
//cc.log(tempNode.name+" X: "+tempNode.x)
fCenterX+=tempNode.x;
tempNode=tempNode.parent;
}
return fCenterX;
},
getY:function(){
let tempNode=this.node;
let fCenterY=0;
while (tempNode.parent.parent){//不算TopCanvas
//cc.log(tempNode.name+" Y: "+tempNode.y)
fCenterY+=tempNode.y;
tempNode=tempNode.parent;
}
return fCenterY;
},
//setTop:function(fTop){
// this._fTop=fTop;
//},
getWidth:function(){
//return this._fWidth;
return this.node.width;
},
//setWidth:function(fWidth){
// this._fWidth=fWidth;
//},
getHeight:function(){
//return this._fHeight;
return this.node.height;
},
//setHeight:function(fHeight){
// this._fHeight=fHeight;
//},
//getFocusNode:function(){
// return this._oFocusNode;
//},
//setFocusNode:function(oFocusNode){
// this._oFocusNode=oFocusNode;
//},
getTVLink:function(){
return this._strTVLink;
},
setTVLink:function(strTVLink){
this._strTVLink=strTVLink;
},
getEnable:function(){
return this._bEnable;
},
setEnable:function(bEnable){
this._bEnable=bEnable;
}
});
var Common=require('Common');
var Network=require('Network');
var TVFocus=require('TVFocus');
var FocusInfo=require('FocusInfo');
var Application=require('Application');
var Log=require('Log');
cc.Class({
extends: cc.Component,
properties: {
// foo: {
// default: null, // The default value will be used only when the component attaching
// to a node for the first time
// url: cc.Texture2D, // optional, default is typeof default
// serializable: true, // optional, default is true
// visible: true, // optional, default is true
// displayName: 'Foo', // optional
// readonly: false, // optional, default is false
// },
// ...
_iCellIndex:-1, //这个用于记录某个Cell PFB的索引
},
// use this for initialization
onLoad: function () {
},
render:function(){
},
// called every frame, uncomment this function to activate update callback
// update: function (dt) {
// },
});
This diff could not be displayed because it is too large.
var Network = require('Network');
var Common = require('Common');
cc.Class({
extends: cc.Component,
properties: {
// foo: {
// default: null, // The default value will be used only when the component attaching
// to a node for the first time
// url: cc.Texture2D, // optional, default is typeof default
// serializable: true, // optional, default is true
// visible: true, // optional, default is true
// displayName: 'Foo', // optional
// readonly: false, // optional, default is false
// },
// ...
_iLogCount:0,
_oScene:null,
},
init: function (oScene) {
try {
this._oScene=oScene;
} catch (error) {
if (cc.sys.isNative){
jsb.reflection.callStaticMethod("org/cocos2dx/javascript/AppActivity", "logInSceneI", "(Ljava/lang/String;)V","init Error in Log==>"+error);
}
}
},
// use this for initialization
onLoad: function () {
try {
//设置本身节点的宽高透明
this.node.x=0;
this.node.y=0;
//this.node.width=Common.SCREEN_WIDTH-20;
//this.node.height=Common.SCREEN_HEIGHT;
this.node.width=Common.SCREEN_HEIGHT;
this.node.height=Common.SCREEN_WIDTH;
let nodeLogMask=new cc.Node('LogMask');
nodeLogMask.x=0;
nodeLogMask.y=0;
this.node.addChild(nodeLogMask,10);
//设置为全屏遮罩
let strLoadImagePath = 'Texture/splash_black';
Common.renderSpriteByLocalImage(strLoadImagePath,nodeLogMask.addComponent(cc.Sprite));
//因为纹理2*2所以这里写死了
//nodeLogMask.setScale(Common.SCREEN_WIDTH/2,Common.SCREEN_HEIGHT/2);
nodeLogMask.setScale(Common.SCREEN_HEIGHT/2,Common.SCREEN_WIDTH/2);
//nodeLogMask.opacity=100;
nodeLogMask.opacity = 100;
nodeLogMask.zIndex = 400;
let nodeLogList=new cc.Node('LogList');
let layoutLog = nodeLogList.addComponent(cc.Layout);
layoutLog.type = cc.Layout.Type.VERTICAL;
layoutLog.resizeMode = cc.Layout.ResizeMode.CONTAINER;
layoutLog.spacingY = 0;
//nodeLogList.x = 20 - Common.SCREEN_WIDTH/2;
//nodeLogList.y = Common.SCREEN_HEIGHT/2 - 20;
nodeLogList.x = -Common.SCREEN_WIDTH/2+290;
nodeLogList.y = Common.SCREEN_HEIGHT/2+270;
nodeLogList.setAnchorPoint(0,1);
this.node.addChild(nodeLogList,10);
nodeLogList.zIndex = 402;
//this.node.color=new cc.Color(0, 0, 0); //黑色
//this.node.cascadeOpacity=false;
//this.node.parent=this._oScene.node;
//this.node.getComponent(cc.Sprite).spriteFrame = new cc.SpriteFrame(Texture2D.);
//parentNode.cascadeOpacity=false;
} catch (error) {
if (cc.sys.isNative){
jsb.reflection.callStaticMethod("org/cocos2dx/javascript/AppActivity", "logInSceneI", "(Ljava/lang/String;)V","onLoad Error in Log==>"+error);
}
}
},
//statics: {
serverD:function(strInfo){
},
screenD:function(strInfo){
try {
this.flushLogToScreen(strInfo,'Debug');
} catch (error) {
if (cc.sys.isNative){
jsb.reflection.callStaticMethod("org/cocos2dx/javascript/AppActivity", "logInSceneI", "(Ljava/lang/String;)V","screenD Error in Log==>"+error);
}
}
},
serverI:function(strInfo){
},
screenI:function(strInfo){
try {
if(strInfo){
this.flushLogToScreen(strInfo,'Info');
cc.log("Info:"+strInfo);
if (cc.sys.isNative){
jsb.reflection.callStaticMethod("org/cocos2dx/javascript/AppActivity", "logInSceneI", "(Ljava/lang/String;)V",strInfo);
}
}
} catch (error) {
if (cc.sys.isNative){
jsb.reflection.callStaticMethod("org/cocos2dx/javascript/AppActivity", "logInSceneI", "(Ljava/lang/String;)V","screenI Error in Log==>"+error);
}
}
},
serverW:function(strInfo){
},
screenW:function(strInfo){
try {
if(strInfo){
this.flushLogToScreen(strInfo,'Warning');
cc.log("Warning:"+strInfo);
if (cc.sys.isNative){
jsb.reflection.callStaticMethod("org/cocos2dx/javascript/AppActivity", "logInSceneW", "(Ljava/lang/String;)V",strInfo);
}
}
} catch (error) {
if (cc.sys.isNative){
jsb.reflection.callStaticMethod("org/cocos2dx/javascript/AppActivity", "logInSceneI", "(Ljava/lang/String;)V","screenW Error in Log==>"+error);
}
}
},
serverE:function(strInfo){
},
screenE:function(strInfo){
try {
if(strInfo){
this.flushLogToScreen(strInfo,'Error');
cc.log("strInfo:"+strInfo);
if (cc.sys.isNative){
jsb.reflection.callStaticMethod("org/cocos2dx/javascript/AppActivity", "logInSceneE", "(Ljava/lang/String;)V",strInfo);
}
}
} catch (error) {
if (cc.sys.isNative){
jsb.reflection.callStaticMethod("org/cocos2dx/javascript/AppActivity", "logInSceneI", "(Ljava/lang/String;)V","screenE Error in Log==>"+error);
}
}
},
flushLogToScreen:function(strInfo, strLevel){
try {
if(!Common.DEBUG_MODE){//todo:是否还有把日志显示在屏幕上的必要,目前是觉得没有的
return;
}
this._iLogCount++;
let nodeLogList = this.node.getChildByName("LogList");
//this._iLogCount = this._iLogCount%100;
let nodeInfo=new cc.Node('log_info_'+this._iLogCount);
let lblInfo=nodeInfo.addComponent(cc.Label);
lblInfo.string="("+this._iLogCount+"):"+strLevel+':'+strInfo;//+(nodeInfo.width/2-Common.SCREEN_WIDTH/2);
lblInfo.fontSize=10;
lblInfo.lineHeight=10;
//nodeInfo.parent=this.node;
nodeInfo.parent=nodeLogList;
switch(strLevel){
case 'Debug':
nodeInfo.color=new cc.color(51,255,255,255);
break;
case 'Info':
nodeInfo.color=new cc.color(51,255,51,255);
break;
case 'Warning':
nodeInfo.color=new cc.color(255,255,51,255);
break;
case 'Error':
nodeInfo.color=new cc.color(255,51,51,255);
break;
default:
nodeInfo.color=new cc.color(255,255,255,255);
}
//nodeInfo.color=new cc.color(255,255,255,255);
//nodeInfo.height=20;
//nodeInfo.y = -(this._iLogCount-1)*20;
nodeInfo.y = -(this._iLogCount-1)*10;
nodeInfo.height=10;
nodeInfo.setAnchorPoint(0,1);
nodeInfo.zIndex = 401;
//if(nodeLogList.height > Common.SCREEN_HEIGHT -20){
if(nodeLogList.height > Common.SCREEN_WIDTH){
nodeLogList.children[0].destroy();
}
} catch (error) {
if (cc.sys.isNative){
jsb.reflection.callStaticMethod("org/cocos2dx/javascript/AppActivity", "logInSceneI", "(Ljava/lang/String;)V","flushLogToScreen Error in Log==>"+error);
}
}
},
clearLogOnScreen : function () {
try {
let nodeLogList = this.node.getChildByName("LogList");
nodeLogList.destroy();
this._iLogCount = 0;
nodeLogList=new cc.Node('LogList');
nodeLogList.x = 20 - Common.SCREEN_WIDTH/2;
nodeLogList.y = Common.SCREEN_HEIGHT/2 - 20;
nodeLogList.setAnchorPoint(0,1);
this.node.addChild(nodeLogList,10);
nodeLogList.zIndex = 402;
} catch (error) {
if (cc.sys.isNative){
jsb.reflection.callStaticMethod("org/cocos2dx/javascript/AppActivity", "logInSceneI", "(Ljava/lang/String;)V","clearLogOnScreen Error in Log==>"+error);
}
}
},
flushLogToServer:function(){
}
//TODO:需要加一个清除(所有条目全删除)和删除日志(一条一条删除)的函数
//}
// called every frame, uncomment this function to activate update callback
// update: function (dt) {
// },
});
cc.Class({
extends: cc.Component,
properties: {
// foo: {
// default: null, // The default value will be used only when the component attaching
// to a node for the first time
// url: cc.Texture2D, // optional, default is typeof default
// serializable: true, // optional, default is true
// visible: true, // optional, default is true
// displayName: 'Foo', // optional
// readonly: false, // optional, default is false
// },
// ...
_fStep:1,
_bHasRelation:true,
_oNode:null, //deprecated
_iDirection:0,
_fTargetPosition:0,
},
//ctor: function (fStep,bHasRelation,iDirection) {
ctor: function () {
this._fStep=arguments[0];
this._bHasRelation=arguments[1];
//this._oNode=arguments[2];
this._iDirection=arguments[2];
//this._fStep=fStep;
//this._bHasRelation=bHasRelation;
//this._oNode=oNode;
//this._iDirection=iDirection;
},
init: function (fStep,bHasRelation,iDirection) {
this._fStep=fStep;
this._bHasRelation=bHasRelation;
//this._oNode=oNode;
this._iDirection=iDirection;
},
getStep:function(){
return this._fStep;
},
setStep:function(fStep){
this._fStep=fStep;
},
getHasRelation:function(){
return this._bHasRelation;
},
setHasRelation:function(bHasRelation){
this._bHasRelation=bHasRelation;
},
/*
getNode:function(){
return this._oNode;
},
setNode:function(oNode){
this._oNode=oNode;
},*/
getDirection:function(){
return this._iDirection;
},
setDirection:function(iDirection){
this._iDirection=iDirection;
},
getTargetNode:function(){
return this._oTargetNode;
},
setTargetNode:function(oTargetNode){
this._oTargetNode=oTargetNode;
},
//明确目标位置 比设置Step更为有效
getTargetPosition:function(){
return this._fTargetPosition;
},
setTargetPosition:function(fTargetPosition){
this._fTargetPosition=fTargetPosition;
}
// called every frame, uncomment this function to activate update callback
// update: function (dt) {
// },
});
var Common = require('Common');
var Network = require('Network');
var TVFocus = require('TVFocus');
var CCTVFocus = require('CCTVFocus');
var FocusInfo = require('FocusInfo');
var TVCanvas = require('TVCanvas');
var TVScrollParameter = require('TVScrollParameter');
var ListView = require('ListView');
var BusinessParameter = require('BusinessParameter');
var ListCell = require('ListCell');
cc.Class({
extends: TVCanvas,
properties: {
},
onLoad: function () {
this._super();
this._oSceneContext._packageName = "";
this._oSceneContext._className = "";
this._oSceneContext._downloadUrl = "";
let aSceneContext = this._cApplication.getSceneContext();
let aSceneParameter = this._cApplication.getSceneParameter();
if (aSceneParameter.length) {
this._oSceneContext._packageName = aSceneParameter[aSceneParameter.length - 1].packageName;
this._oSceneContext._className = aSceneParameter[aSceneParameter.length - 1].className;
this._oSceneContext._downloadUrl = aSceneParameter[aSceneParameter.length - 1].downloadUrl;
} else if (aSceneParameter) {
this._oSceneContext._packageName = aSceneParameter.packageName;
this._oSceneContext._className = aSceneParameter.className;
this._oSceneContext._downloadUrl = aSceneParameter.downloadUrl;
}
cc.log("gameLoading包名:" + this._oSceneContext._downloadUrl);
if (this._oSceneContext._downloadUrl && this._oSceneContext._downloadUrl != "undefined") { //如果有下载地址就启动奥比游戏
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");
} else {
jsb.reflection.callStaticMethod("com/topdraw/melody/TopdrawSDKWrapper", "startGame", "(Ljava/lang/String;Ljava/lang/String;)V", this._oSceneContext._packageName, "updateProgress");
}
},
updateProgress: function (strProgress) {
this._cLog.screenI("gameLoading下载进度:" + strProgress);
cc.find("ProgressLabel", this.node).getComponent(cc.Label).string = strProgress + "%";
let progressBarWidth = cc.find("ProgressBar", this.node).width - 7;//
let nodeBar = cc.find("ProgressBar/bar", this.node);
nodeBar.width = strProgress / 100 * progressBarWidth;
// this._downloadUrl && this._downloadUrl != "undefined" &&
if (strProgress == "100") {
this._bIsFocusInit = true;
this.backAScene();
}
},
// hideLoadingIcon: function () {
// cc.log("隐藏LoadingIcon...");
// cc.find("Loading/LoadingIcon", this.node).getComponent(cc.Animation).pause();
// cc.find("Loading/LoadingIcon", this.node).opacity = 0;
// this.cheduleOn
// },
});
//分类-动漫
var Common = require('Common');
var FocusInfo = require('FocusInfo');
var ListCell = require('ListCell');
var Network = require('Network');
cc.Class({
extends: ListCell,
properties: {
id: 0,
pic: cc.Sprite,
activeName1: cc.Label,
activeName2: cc.Label,
normalName: cc.Label,
Name: cc.Label,
textScore: cc.Label, //分数
},
statics: {
PFB_NAME: 'Prefab/pfbCategoryListCell',
CELL_NAME: 'CategoryListCell',
},
init: function (iCellIndex, bIsFocusEnable, compSceneCanvas) {
//准备焦点坐标
let fiCategoryBlock = this.node.addComponent(FocusInfo);
fiCategoryBlock.init(
null, true, null, null, 1.1
);
compSceneCanvas.addNodeToFocusTarget(0, this.node.name, this.node);
},
render(oData, iRecordIndex) {
// this.id = oData.id;
// cc.log("categoryList-->name: "+JSON.stringify(oData));
this.activeName1.string = oData.name;
this.activeName2.string = oData.name;
this.normalName.string = oData.name;
this.Name.string = oData.name;
// this.activeName1._updateRenderData(true);
// this.activeName2._updateRenderData(true);
// this.normalName._updateRenderData(true);
if (oData.score) {
this.textScore.string = parseInt(oData.score * 10) / 10;
}
if (oData.play_times) {
let value = parseInt(oData.play_times);
if (value > 10000) {
this.textPlayTimes.string = parseInt(value / 10000) + "万+";
} else {
this.textPlayTimes.string = value;
}
}
if (oData.image[0]) {
var self = this;
// Network.loadImageInNativeRuntime(
// Common.TOPDRAW_IMAGE_SERVER + oData.image[0].fileUrl,null,
// function (texture) {
// self.pic.spriteFrame = new cc.SpriteFrame(texture);
// }, null, this
// );
cc.log("categoryList..."+oData.image[0].fileUrl);
cc.loader.loadRes(oData.image[0].fileUrl, cc.Texture2D, function (err, texture) {
self.pic.spriteFrame = new cc.SpriteFrame(texture);
});
}
// cc.log("category list cell location: "+oData.image[0].fileUrl);
this.node.getComponent(FocusInfo).setTVLink(oData.tvlink);
},
enableFocusInfo: function () {
this.node.getComponent(FocusInfo).setEnable(true);
},
disableFocusInfo: function () {
this.node.getComponent(FocusInfo).setEnable(false);
},
setUIWithFocus: function () {
let nodeCellName = this.node.getChildByName('Name');
cc.find("NormalName", nodeCellName).opacity = 255;
//超出滚动
let nodeScreenTitleText = cc.find('ActiveName/NameContainer/NameText', nodeCellName);
let fOriginalX = nodeScreenTitleText.x;
let fOriginalY = nodeScreenTitleText.y;
let nodeScreenTitleText1 = nodeScreenTitleText.getChildByName('NameText1');
let nodeScreenTitleText2 = nodeScreenTitleText.getChildByName('NameText2');
nodeScreenTitleText2.x = nodeScreenTitleText1.x + nodeScreenTitleText1.width + 10;//TODO:补丁,解决滚动重叠
if (nodeScreenTitleText1.width > nodeScreenTitleText.width) {
cc.find("ActiveName/NameContainer", nodeCellName).opacity = 255;
cc.find("NormalName", nodeCellName).opacity = 0;
let fEndPositionDelta = (nodeScreenTitleText1.width + 30);
//下方时长和字有关系,才能速度一样
var ftaScreenTitleMoveToTarget = cc.moveTo(10 * (nodeScreenTitleText1.width / nodeScreenTitleText.width), fOriginalX - fEndPositionDelta, fOriginalY);
var ftaScreenTitleMoveToBack = cc.moveTo(0, fOriginalX, fOriginalY);
var sequenceMediaTitle = cc.sequence(ftaScreenTitleMoveToTarget, ftaScreenTitleMoveToBack);
var repeatScreenTitle = cc.repeat(sequenceMediaTitle, 10);
repeatScreenTitle.setTag(Common.OVERLENGTH_MOVING);
nodeScreenTitleText.runAction(repeatScreenTitle);
nodeScreenTitleText2.active = true;
}
},
setUIWithoutFocus: function () {
let nodeCellName = this.node.getChildByName('Name');
cc.find("NormalName", nodeCellName).opacity = 255;
//如有滚动停止滚动
let nodeScreenTitleText = cc.find('ActiveName/NameContainer/NameText', nodeCellName);
if (null != nodeScreenTitleText.getActionByTag(Common.OVERLENGTH_MOVING)) {
nodeScreenTitleText.stopActionByTag(Common.OVERLENGTH_MOVING);
nodeScreenTitleText.getChildByName('NameText2').active = false;
cc.find("ActiveName/NameContainer", nodeCellName).opacity = 0;
}
nodeScreenTitleText.x = 0;
},
});
//推荐页
var Common = require('Common');
var Network = require('Network');
cc.Class({
extends: cc.Component,
properties: {
id: 0,
pic: cc.Sprite,
activeName1: cc.Label,
activeName2: cc.Label,
normalName: cc.Label,
},
// data: {id,iconSF,itemName,itemPrice}
init: function (data, funCallback, strCellName, i, iCurrentIndex) {
// cc.log("pfbRecommend->init: "+data.tvlink);
// this.id = data.id;
this.node.width = data.width;
this.node.height = data.height;
this.node.getChildByName('Pic').width = data.width;
this.node.getChildByName('Pic').height = data.height;
if (data.imageURL) {
var self = this;
cc.loader.loadRes(data.imageURL, cc.Texture2D, function (err, texture) {
if (strCellName == "topNavi") {
self.pic.spriteFrame = new cc.SpriteFrame(texture, cc.rect(0, 0, data.width, data.height));
if (i == iCurrentIndex) {
self.pic.spriteFrame = new cc.SpriteFrame(texture, cc.rect(0, data.height, data.width, data.height));
}
} else {
self.pic.spriteFrame = new cc.SpriteFrame(texture, cc.rect(0, 0, data.width, data.height));
}
// if (null != funCallback && typeof funCallback == 'function') {
// funCallback.call();
// }
});
// Network.loadImageInNativeRuntime(
// Common.TOPDRAW_IMAGE_SERVER_EDU + data.imageURL,
// function (texture) {
// self.pic.spriteFrame = new cc.SpriteFrame(texture,cc.rect(0,0,self.node.width,self.node.height));
// if (null != funCallback && typeof funCallback == 'function') {
// funCallback.call();
// }
// }, null, this
// );
}
if (strCellName == "topNavi" && i>0) {
this.node.getComponent(cc.Widget).top = data.top - data.height / 2;
} else {
this.node.getComponent(cc.Widget).top = data.top;
}
this.node.getComponent(cc.Widget).left = data.left;
if (data.title_visible == 1) { //前三个不需要显示文字
cc.find('Name', this.node).active = true;
cc.find('Name', this.node).width = data.width - 10;
cc.find('Name/TextBg', this.node).width = data.width;
cc.find('Name/NormalName', this.node).width = data.width - 10;
cc.find('Name/ActiveName', this.node).width = data.width - 10;
cc.find('Name/ActiveName/NameContainer', this.node).width = data.width - 10;
cc.find('Name/ActiveName/NameContainer/NameText', this.node).width = data.width - 10;
this.normalName.node.width = data.width - 10;
this.activeName1.string = data.title;
this.activeName2.string = data.title;
this.normalName.string = data.title;
this.activeName1._updateRenderData(true);
this.activeName2._updateRenderData(true);
this.normalName._updateRenderData(true);
//调整文字位置
let nodeCellName = this.node.getChildByName('Name');
let nodeScreenTitleText = cc.find('ActiveName/NameContainer/NameText', nodeCellName);
let nodeScreenTitleText1 = nodeScreenTitleText.getChildByName('NameText1');
if (nodeScreenTitleText1.width > nodeScreenTitleText.width) {
this.normalName.overflow = cc.Label.Overflow.CLAMP;
this.normalName.enableWrapText = false;
this.normalName.horizontalAlign = cc.Label.HorizontalAlign.LEFT;
}
}
},
setUIWithFocus: function () {
let nodeCellName = this.node.getChildByName('Name');
cc.find("NormalName", nodeCellName).opacity = 255;
//超出滚动
let nodeScreenTitleText = cc.find('ActiveName/NameContainer/NameText', nodeCellName);
let fOriginalX = nodeScreenTitleText.x;
let fOriginalY = nodeScreenTitleText.y;
let nodeScreenTitleText1 = nodeScreenTitleText.getChildByName('NameText1');
let nodeScreenTitleText2 = nodeScreenTitleText.getChildByName('NameText2');
nodeScreenTitleText2.x = nodeScreenTitleText1.x + nodeScreenTitleText1.width + 10;//TODO:补丁,解决滚动重叠
cc.log(nodeScreenTitleText1.width + "------------" + nodeScreenTitleText.width);
if (nodeScreenTitleText1.width > nodeScreenTitleText.width) {
cc.find("ActiveName/NameContainer", nodeCellName).opacity = 255;
cc.find("NormalName", nodeCellName).opacity = 0;
let fEndPositionDelta = (nodeScreenTitleText1.width + 30);
//下方时长和字有关系,才能速度一样
var ftaScreenTitleMoveToTarget = cc.moveTo(10 * (nodeScreenTitleText1.width / nodeScreenTitleText.width), fOriginalX - fEndPositionDelta, fOriginalY);
var ftaScreenTitleMoveToBack = cc.moveTo(0, fOriginalX, fOriginalY);
var sequenceMediaTitle = cc.sequence(ftaScreenTitleMoveToTarget, ftaScreenTitleMoveToBack);
var repeatScreenTitle = cc.repeat(sequenceMediaTitle, 10);
repeatScreenTitle.setTag(Common.OVERLENGTH_MOVING);
nodeScreenTitleText.runAction(repeatScreenTitle);
nodeScreenTitleText2.active = true;
}
},
setUIWithoutFocus: function () {
let nodeCellName = this.node.getChildByName('Name');
cc.find("NormalName", nodeCellName).opacity = 255;
//如有滚动停止滚动
let nodeScreenTitleText = cc.find('ActiveName/NameContainer/NameText', nodeCellName);
if (null != nodeScreenTitleText.getActionByTag(Common.OVERLENGTH_MOVING)) {
nodeScreenTitleText.stopActionByTag(Common.OVERLENGTH_MOVING);
nodeScreenTitleText.getChildByName('NameText2').active = false;
cc.find("ActiveName/NameContainer", nodeCellName).opacity = 0;
}
nodeScreenTitleText.x = 0;
},
});
//分类-动漫
var Common = require('Common');
var FocusInfo = require('FocusInfo');
var ListCell = require('ListCell');
var Network = require('Network');
cc.Class({
extends: ListCell,
properties: {
id: 0,
pic: cc.Sprite,
activeName1: cc.Label,
activeName2: cc.Label,
normalName: cc.Label,
Name: cc.Label,
},
statics: {
PFB_NAME: '',
CELL_NAME: '',
},
init: function (iCellIndex, bIsFocusEnable, compSceneCanvas) {
},
render(oData, iRecordIndex) {
this.activeName1.string = oData.name;
this.activeName2.string = oData.name;
this.normalName.string = oData.name;
this.Name.string = oData.name;
this.node.getChildByName("Normal").active = true;
// this.activeName1._updateRenderData(true);
// this.activeName2._updateRenderData(true);
// this.normalName._updateRenderData(true);
},
enableFocusInfo: function () {
this.node.getComponent(FocusInfo).setEnable(true);
},
disableFocusInfo: function () {
this.node.getComponent(FocusInfo).setEnable(false);
},
setUIWithFocus: function () {
let nodeCellName = this.node.getChildByName('Name');
cc.find("NormalName", nodeCellName).opacity = 255;
//超出滚动
let nodeScreenTitleText = cc.find('ActiveName/NameContainer/NameText', nodeCellName);
let fOriginalX = nodeScreenTitleText.x;
let fOriginalY = nodeScreenTitleText.y;
let nodeScreenTitleText1 = nodeScreenTitleText.getChildByName('NameText1');
let nodeScreenTitleText2 = nodeScreenTitleText.getChildByName('NameText2');
nodeScreenTitleText2.x = nodeScreenTitleText1.x + nodeScreenTitleText1.width + 10;//TODO:补丁,解决滚动重叠
if (nodeScreenTitleText1.width > nodeScreenTitleText.width) {
cc.find("ActiveName/NameContainer", nodeCellName).opacity = 255;
cc.find("NormalName", nodeCellName).opacity = 0;
let fEndPositionDelta = (nodeScreenTitleText1.width + 30);
//下方时长和字有关系,才能速度一样
var ftaScreenTitleMoveToTarget = cc.moveTo(10 * (nodeScreenTitleText1.width / nodeScreenTitleText.width), fOriginalX - fEndPositionDelta, fOriginalY);
var ftaScreenTitleMoveToBack = cc.moveTo(0, fOriginalX, fOriginalY);
var sequenceMediaTitle = cc.sequence(ftaScreenTitleMoveToTarget, ftaScreenTitleMoveToBack);
var repeatScreenTitle = cc.repeat(sequenceMediaTitle, 10);
repeatScreenTitle.setTag(Common.OVERLENGTH_MOVING);
nodeScreenTitleText.runAction(repeatScreenTitle);
nodeScreenTitleText2.active = true;
}
},
setUIWithoutFocus: function () {
let nodeCellName = this.node.getChildByName('Name');
cc.find("NormalName", nodeCellName).opacity = 255;
//如有滚动停止滚动
let nodeScreenTitleText = cc.find('ActiveName/NameContainer/NameText', nodeCellName);
if (null != nodeScreenTitleText.getActionByTag(Common.OVERLENGTH_MOVING)) {
nodeScreenTitleText.stopActionByTag(Common.OVERLENGTH_MOVING);
nodeScreenTitleText.getChildByName('NameText2').active = false;
cc.find("ActiveName/NameContainer", nodeCellName).opacity = 0;
}
nodeScreenTitleText.x = 0;
},
});
//推荐页
var Common = require('Common');
var Network = require('Network');
cc.Class({
extends: cc.Component,
properties: {
id: 0,
title: cc.Label,
selectTitle: cc.Label,
activeName1: cc.Label,
activeName2: cc.Label,
normalName: cc.Label,
afterTitle: cc.Label,
afterName: cc.Label,
},
// data: {id,iconSF,itemName,itemPrice}
init: function (data, funCallback, i) {
// cc.find('Select/Name', this.node).active = true;
// cc.find('Select/Name', this.node).width = data.width - 10;
// cc.find('Select/Name/TextBg', this.node).width = data.width;
// cc.find('Select/Name/NormalName', this.node).width = data.width - 10;
// cc.find('Select/Name/ActiveName', this.node).width = data.width - 10;
// cc.find('Select/Name/ActiveName/NameContainer', this.node).width = data.width - 10;
// cc.find('Select/Name/ActiveName/NameContainer/NameText', this.node).width = data.width - 10;
// this.normalName.node.width = data.width - 10;
let aTitle = ["魔法沙拉2", "奔跑吧小兔子", "勇敢的啫喱", "记忆翻牌"];
let aName = ["和爸妈一起做一盘沙拉", "和小兔子一起出门吧", "和Q弹的彩色啫喱锻炼身体", "上完网课,锻炼下记忆力"];
this.title.string = aTitle[i];
this.selectTitle.string=aTitle[i];
this.activeName1.string = data.title || aName[i];
this.activeName2.string = data.title || aName[i];
this.normalName.string = data.title || aName[i];
this.afterTitle.string = aTitle[i];
this.afterName.string = aName[i];
// this.activeName1._updateRenderData(true);
// this.activeName2._updateRenderData(true);
// this.normalName._updateRenderData(true);
//调整文字位置
let nodeCellName = cc.find("Select/Name", this.node);
let nodeScreenTitleText = cc.find('ActiveName/NameContainer/NameText', nodeCellName);
let nodeScreenTitleText1 = nodeScreenTitleText.getChildByName('NameText1');
if (nodeScreenTitleText1.width > nodeScreenTitleText.width) {
this.normalName.overflow = cc.Label.Overflow.CLAMP;
this.normalName.enableWrapText = false;
this.normalName.horizontalAlign = cc.Label.HorizontalAlign.LEFT;
}
},
setUIWithFocus: function () {
let nodeCellName = cc.find("Select/Name", this.node);
cc.find("NormalName", nodeCellName).opacity = 255;
//超出滚动
let nodeScreenTitleText = cc.find('ActiveName/NameContainer/NameText', nodeCellName);
let fOriginalX = nodeScreenTitleText.x;
let fOriginalY = nodeScreenTitleText.y;
let nodeScreenTitleText1 = nodeScreenTitleText.getChildByName('NameText1');
let nodeScreenTitleText2 = nodeScreenTitleText.getChildByName('NameText2');
nodeScreenTitleText2.x = nodeScreenTitleText1.x + nodeScreenTitleText1.width + 10;//TODO:补丁,解决滚动重叠
cc.log(nodeScreenTitleText1.width + "------------" + nodeScreenTitleText.width);
if (nodeScreenTitleText1.width > nodeScreenTitleText.width) {
cc.find("ActiveName/NameContainer", nodeCellName).opacity = 255;
cc.find("NormalName", nodeCellName).opacity = 0;
let fEndPositionDelta = (nodeScreenTitleText1.width + 30);
//下方时长和字有关系,才能速度一样
var ftaScreenTitleMoveToTarget = cc.moveTo(10 * (nodeScreenTitleText1.width / nodeScreenTitleText.width), fOriginalX - fEndPositionDelta, fOriginalY);
var ftaScreenTitleMoveToBack = cc.moveTo(0, fOriginalX, fOriginalY);
var sequenceMediaTitle = cc.sequence(ftaScreenTitleMoveToTarget, ftaScreenTitleMoveToBack);
var repeatScreenTitle = cc.repeat(sequenceMediaTitle, 10);
repeatScreenTitle.setTag(Common.OVERLENGTH_MOVING);
nodeScreenTitleText.runAction(repeatScreenTitle);
nodeScreenTitleText2.active = true;
}
},
setUIWithoutFocus: function () {
let nodeCellName = cc.find("Select/Name", this.node);
cc.find("NormalName", nodeCellName).opacity = 255;
//如有滚动停止滚动
let nodeScreenTitleText = cc.find('ActiveName/NameContainer/NameText', nodeCellName);
if (null != nodeScreenTitleText.getActionByTag(Common.OVERLENGTH_MOVING)) {
nodeScreenTitleText.stopActionByTag(Common.OVERLENGTH_MOVING);
nodeScreenTitleText.getChildByName('NameText2').active = false;
cc.find("ActiveName/NameContainer", nodeCellName).opacity = 0;
}
nodeScreenTitleText.x = 0;
},
});
var Network = require('Network');
var Application = require('Application');
var Common = require('Common');
var BusinessParameter = require('BusinessParameter');
var TVCanvas = require('TVCanvas');
var Log = require('Log');
var CCMediaPlayer = require('CCMediaPlayer');
cc.Class({
extends: TVCanvas,
properties: {
},
onLoad: function () {
if(cc.sys.isNative){
jsb.reflection.callStaticMethod("org/cocos2dx/javascript/AppActivity", "removeLaunchImage", "()V");
}
//播放器使用
let nodeVideoPlayer = new cc.Node('VideoPlayer');
let nodeBg = new cc.Node('Bg');
nodeBg.parent = nodeVideoPlayer;
nodeVideoPlayer.parent = cc.find("PlayerContainer");
//nodeVideoPlayer.addComponent(cc.IjkPlayer);
//nodeVideoPlayer.addComponent(cc.VitamioPlayer);
// nodeVideoPlayer.addComponent(cc.VideoPlayer);
//替换集成的播放器 fix jerry
nodeVideoPlayer.addComponent(CCMediaPlayer);
// let strLoadImagePath = "Texture/splash_black";
// Common.renderSpriteByLocalImage(strLoadImagePath, nodeBg.addComponent(cc.Sprite));
nodeVideoPlayer.parent.zIndex = cc.macro.MIN_ZINDEX;
cc.game.addPersistRootNode(nodeVideoPlayer.parent);
cc.director.loadScene("sceneMain");
},
});
const player = "com/topdraw/component/CocosMediaPlayer";
const CALLBACK_FUNCS = {
INFO: null,
PREPARED: null,
SEEKCOMPLETE: null,
COMPLETION: null,
ERROR: null,
BUFFERSTART: null,
BUFFERSTOP: null,
TIMEOUT: null,
};
//根据春哥封装的视频接口,整合出来的视频播放组件
cc.Class({
extends: cc.Component,
properties: {
url: '',
},
onLoad() {
this._playing = false;
this.init("Android"); //初始化工作,Android, NewTV, Vitamio, IJK
this.setArea(0, 720 - 720, 1280, 720); //默认全屏
},
init: function (type) {
if (cc.sys.isNative) {
jsb.reflection.callStaticMethod(player, "jsInit", "(Ljava/lang/String;)V", type);
}
},
setArea: function (x, y, w, h) {
if (cc.sys.isNative) {
jsb.reflection.callStaticMethod(player, "jsSetArea", "(IIII)V", x, y, w, h);
}
},
setPlayURL: function (url) {
this._playing = false;
this.url = url; //fix jerry
jsb.reflection.callStaticMethod(player, "jsSetPlayURL", "(Ljava/lang/String;)V", url);
},
setInfo: function (info) {
jsb.reflection.callStaticMethod(player, "jsSetInfo", "(Ljava/lang/String;)V", info);
},
prepare: function () {
jsb.reflection.callStaticMethod(player, "jsPrepare", "()V");
},
prepareAsync: function () {
jsb.reflection.callStaticMethod(player, "jsPrepareAsync", "()V");
},
start: function (time) {
this._playing = true;
jsb.reflection.callStaticMethod(player, "jsStart", "(I)V", time);
},
pause: function () {
this._playing = false;
jsb.reflection.callStaticMethod(player, "jsPause", "()V");
},
seekTo: function (time) {
jsb.reflection.callStaticMethod(player, "jsSeekTo", "(I)V", time);
},
setVolume: function (volume) {
jsb.reflection.callStaticMethod(player, "jsSetVolume", "(I)V", volume);
},
setVolume: function (leftVolume, rightVolume) {
jsb.reflection.callStaticMethod(player, "jsSetVolume", "(FF)V", leftVolume, rightVolume);
},
stop: function () {
jsb.reflection.callStaticMethod(player, "jsStop", "()V");
},
reset: function () {
jsb.reflection.callStaticMethod(player, "jsReset", "()V");
},
release: function () {
CALLBACK_FUNCS.INFO = null;
CALLBACK_FUNCS.PREPARED = null;
CALLBACK_FUNCS.SEEKCOMPLETE = null;
CALLBACK_FUNCS.COMPLETION = null;
CALLBACK_FUNCS.ERROR = null;
CALLBACK_FUNCS.BUFFERSTART = null;
CALLBACK_FUNCS.BUFFERSTOP = null;
CALLBACK_FUNCS.TIMEOUT = null;
jsb.reflection.callStaticMethod(player, "jsRelease", "()V");
},
getCurrentPosition: function () {
return jsb.reflection.callStaticMethod(player, "jsGetCurrentPosition", "()I");
},
getDuration: function () {
return jsb.reflection.callStaticMethod(player, "jsGetDuration", "()I");
},
getVolume: function () {
return jsb.reflection.callStaticMethod(player, "jsGetVolume", "()I");
},
isPlaying: function () {
// return jsb.reflection.callStaticMethod(player, "jsIsPlaying", "()Z");
return this._playing;
},
setOnInfoListener: function (func) {
CALLBACK_FUNCS.INFO = func;
},
setOnPreparedListener: function (func) {
CALLBACK_FUNCS.PREPARED = func;
},
setOnSeekCompleteListener: function (func) {
CALLBACK_FUNCS.SEEKCOMPLETE = func;
},
setOnCompletionListener: function (func) {
CALLBACK_FUNCS.COMPLETION = func;
},
setOnErrorListener: function (func) {
CALLBACK_FUNCS.ERROR = func;
},
onInfo: function () {
try {
if (null != CALLBACK_FUNCS.INFO) {
CALLBACK_FUNCS.INFO.apply(this, arguments);
}
} catch (e) {
}
},
onPrepared: function () {
try {
// this._cLog.screenI("CCMediaPlayer onPrepared...");
if (null != CALLBACK_FUNCS.PREPARED) {
CALLBACK_FUNCS.PREPARED.apply(this, arguments);
}
} catch (e) {
}
},
onSeekComplete: function () {
try {
if (null != CALLBACK_FUNCS.SEEKCOMPLETE) {
CALLBACK_FUNCS.SEEKCOMPLETE.apply(this, arguments);
}
} catch (e) {
}
},
onCompletion: function () {
try {
if (null != CALLBACK_FUNCS.COMPLETION) {
CALLBACK_FUNCS.COMPLETION.apply(this, arguments);
}
} catch (e) {
}
},
onError: function () {
try {
if (null != CALLBACK_FUNCS.ERROR) {
CALLBACK_FUNCS.ERROR.apply(this, arguments);
}
} catch (e) {
}
},
onBufferStart: function () {
try {
if (null != CALLBACK_FUNCS.BUFFERSTART) {
CALLBACK_FUNCS.BUFFERSTART.apply(this, arguments);
}
} catch (e) {
}
},
onBufferStop: function () {
try {
if (null != CALLBACK_FUNCS.BUFFERSTOP) {
CALLBACK_FUNCS.BUFFERSTOP.apply(this, arguments);
}
} catch (e) {
}
},
onTimeOut: function () {
try {
if (null != CALLBACK_FUNCS.TIMEOUT) {
CALLBACK_FUNCS.TIMEOUT.apply(this, arguments);
}
} catch (e) {
}
},
onDestroy() {
this.release();
},
});
//监听,放在class中,android回调找不到
window.MediaPlayer = {
onInfo: function () {
try {
if (null != CALLBACK_FUNCS.INFO) {
CALLBACK_FUNCS.INFO.apply(this, arguments);
}
} catch (e) {
}
},
onPrepared: function () {
try {
if (null != CALLBACK_FUNCS.PREPARED) {
CALLBACK_FUNCS.PREPARED.apply(this, arguments);
}
} catch (e) {
}
},
onSeekComplete: function () {
try {
if (null != CALLBACK_FUNCS.SEEKCOMPLETE) {
CALLBACK_FUNCS.SEEKCOMPLETE.apply(this, arguments);
}
} catch (e) {
}
},
onCompletion: function () {
try {
if (null != CALLBACK_FUNCS.COMPLETION) {
CALLBACK_FUNCS.COMPLETION.apply(this, arguments);
}
} catch (e) {
}
},
onError: function () {
try {
if (null != CALLBACK_FUNCS.ERROR) {
CALLBACK_FUNCS.ERROR.apply(this, arguments);
}
} catch (e) {
}
},
onBufferStart: function () {
try {
if (null != CALLBACK_FUNCS.BUFFERSTART) {
CALLBACK_FUNCS.BUFFERSTART.apply(this, arguments);
}
} catch (e) {
}
},
onBufferStop: function () {
try {
if (null != CALLBACK_FUNCS.BUFFERSTOP) {
CALLBACK_FUNCS.BUFFERSTOP.apply(this, arguments);
}
} catch (e) {
}
},
onTimeOut: function () {
try {
if (null != CALLBACK_FUNCS.TIMEOUT) {
CALLBACK_FUNCS.TIMEOUT.apply(this, arguments);
}
} catch (e) {
}
},
}
//重写轮播指示器
cc.Class({
extends: cc.PageViewIndicator,
properties: {
},
_changedState: function () {
var indicators = this._indicators;
if (indicators.length === 0) return;
var idx = this._pageView._curPageIdx;
if (idx >= indicators.length) return;
for (var i = 0; i < indicators.length; ++i) {
var node = indicators[i];
node.opacity = 255 / 2;
node.color = new cc.color(0, 0, 0);
}
indicators[idx].opacity = 255;
indicators[idx].color = new cc.color(255, 255, 255);
},
});
//用于做动态添加文字滚动效果
var Common = require('Common');
cc.Class({
extends: cc.Component,
properties: {
},
init: function (strText, aStrLabel) {
this._aStrLabel = aStrLabel;
this._iCurrent = 0;
let nodeTitleText = this.node.getChildByName("TitleText");
let nodeTitleText1;
let nodeTitleText2;
this.labelTitleText1;
this.labelTitleText2;
if (!nodeTitleText) {
nodeTitleText = new cc.Node("TitleText");
nodeTitleText1 = new cc.Node("TitleText1");
nodeTitleText2 = new cc.Node("TitleText2");
this.labelTitleText1 = nodeTitleText1.addComponent(cc.Label);
this.labelTitleText2 = nodeTitleText2.addComponent(cc.Label);
nodeTitleText.addChild(nodeTitleText1);
nodeTitleText.addChild(nodeTitleText2);
nodeTitleText.parent = this.node;
this.labelTitleText1.fontSize = 22;
this.labelTitleText2.fontSize = 22;
this.labelTitleText1.lineHeight = 24;
this.labelTitleText2.lineHeight = 24;
nodeTitleText1.anchorX = 0;
nodeTitleText2.anchorX = 0;
let layoutTitleText = nodeTitleText.addComponent(cc.Layout);
layoutTitleText.type = cc.Layout.Type.HORIZONTAL;
layoutTitleText.resizeMode = cc.Layout.ResizeMode.CONTAINER;
layoutTitleText.spacingX = 60;
this.node.addComponent(cc.Mask);
} else {
nodeTitleText1 = nodeTitleText.getChildByName("TitleText1");
nodeTitleText2 = nodeTitleText.getChildByName("TitleText2");
this.labelTitleText1 = nodeTitleText1.getComponent(cc.Label);
this.labelTitleText2 = nodeTitleText2.getComponent(cc.Label);
}
nodeTitleText.anchorX = 0;
this.node.anchorX = 0;
this.labelTitleText1.string = strText;
this.labelTitleText2.string = strText;
if (aStrLabel.length > 0 && aStrLabel[0]) {
this.labelTitleText1.string = aStrLabel[0];
this.labelTitleText2.string = aStrLabel[0];
this._iCurrent++;
}
this.labelTitleText1._forceUpdateRenderData(true);
this.labelTitleText2._forceUpdateRenderData(true);
this.node.x = -this.node.width / 2;
nodeTitleText2.opacity = 0;
nodeTitleText.x = 0;
nodeTitleText.y = -1;
nodeTitleText.x = 0;
this.node.opacity = 255;
},
setUIWithFocus: function () {
var self = this;
//转起来 这部分以后要尽量放到Cell里去
let nodeTitleMask = this.node;
let nodeTitleContainer = nodeTitleMask.getChildByName('TitleText');
let nodeTitleText1 = nodeTitleContainer.getChildByName("TitleText1");
let nodeTitleText2 = nodeTitleContainer.getChildByName("TitleText2");
let fOriginalX = nodeTitleContainer.x;
let fOriginalY = nodeTitleContainer.y;
if (nodeTitleText1.width > nodeTitleMask.width) { //字超出长度才滚动
nodeTitleText2.opacity = 255;
let fEndPositionDelta = nodeTitleText1.width / 2 + nodeTitleText2.width / 2 + 50;
//下方时长和字有关系,才能速度一样h
var ftaTitleMoveToTarget = cc.moveTo(10, fOriginalX - fEndPositionDelta, fOriginalY);
var ftaTitleMoveToBack = cc.moveTo(0, fOriginalX, fOriginalY);
var sequenceTitle = cc.sequence(ftaTitleMoveToTarget, ftaTitleMoveToBack);
var finished = cc.callFunc(function () {
if (self._aStrLabel.length > 0) {
self.labelTitleText1.string = self._aStrLabel[this._iCurrent % self._aStrLabel.length];
self.labelTitleText2.string = self._aStrLabel[this._iCurrent % self._aStrLabel.length];
this._iCurrent++;
self.labelTitleText1._forceUpdateRenderData(true);
self.labelTitleText2._forceUpdateRenderData(true);
self.setUIWithFocus();
}
}, this, null);
var repeatTitle = cc.repeat(cc.sequence(sequenceTitle, finished), 10);
repeatTitle.setTag(Common.OVERLENGTH_MOVING);
nodeTitleContainer.stopAction(nodeTitleContainer.getActionByTag(Common.OVERLENGTH_MOVING));
nodeTitleContainer.runAction(repeatTitle);
}
},
setUIWithoutFocus: function () {
let nodeTitleMask = this.node;
let nodeTitleContainer = nodeTitleMask.getChildByName('TitleText');
nodeTitleContainer.stopAction(nodeTitleContainer.getActionByTag(Common.OVERLENGTH_MOVING));
let nodeTitleText2 = nodeTitleContainer.getChildByName("TitleText2");
nodeTitleText2.opacity = 0;
nodeTitleContainer.x = 0;
},
prohibit: function () {
this.setUIWithoutFocus();
this.node.opacity = 0;
},
});
/**
* 设置按钮状态
* 0 未聚焦
* 1 聚焦
* 2 未聚焦 + 附加(例如:已收藏)
* 3 聚焦 + 附加(例如:已收藏)
*/
cc.Class({
extends: cc.Component,
properties: {
renderTexture : {
default : null,
type : cc.Texture2D
},
renderRects : {
default : [],
type : [cc.Rect]
},
_iRenderRectIndex : 0,
},
onLoad:function() {
this.setRenderRect(0);//默认加载先取第一张
},
setRenderTexture : function (texture) {
this.renderTexture = texture;
},
setRenderRect : function (index) {
this._iRenderRectIndex = index;
let rectRender = this.renderRects[index];
if(this.node.getComponent(cc.Sprite)&&rectRender){
this.node.getComponent(cc.Sprite).spriteFrame = new cc.SpriteFrame(this.renderTexture,rectRender.clone());//原先的写法,有点啰嗦
this.node.width = rectRender.width;
this.node.height = rectRender.height;
}
},
getRenderRectIndex : function () {
return this._iRenderRectIndex;
},
});
{
"__type__": "cc.AnimationClip",
"_name": "TsLoading",
"_objFlags": 0,
"_native": "",
"_duration": 4,
"sample": 2,
"speed": 1,
"wrapMode": 2,
"curveData": {
"props": {
"x": []
},
"comps": {
"cc.Sprite": {
"spriteFrame": [
{
"frame": 0,
"value": {
"__uuid__": "49835417-a9ef-4d86-940c-686cf28d2f28"
}
},
{
"frame": 0.5,
"value": {
"__uuid__": "48e18812-8fa6-4ace-91d7-a54e5a4f17e3"
}
},
{
"frame": 1,
"value": {
"__uuid__": "479e470b-fdc6-48c7-b0ab-e57cd15391fa"
}
},
{
"frame": 1.5,
"value": {
"__uuid__": "7505611b-ceb1-4faf-93c0-bd4190463597"
}
},
{
"frame": 2,
"value": {
"__uuid__": "ecbe4010-4a2c-445e-b8a9-9e372a05d9d0"
}
},
{
"frame": 2.5,
"value": {
"__uuid__": "58f7e7c2-c3de-4028-a0c9-5517ad8b7d3e"
}
},
{
"frame": 3,
"value": {
"__uuid__": "9b8f687c-493e-4e2e-92c2-298aeccafc07"
}
},
{
"frame": 3.5,
"value": {
"__uuid__": "07c69c69-c773-4ffb-9402-5ecc021bf105"
}
}
]
}
}
},
"events": [
{
"frame": 0,
"func": "",
"params": []
},
{
"frame": 0,
"func": "",
"params": []
}
]
}
\ No newline at end of file
{
"__type__": "cc.AnimationClip",
"_name": "prifileRotation",
"_objFlags": 0,
"_native": "",
"_duration": 2.5,
"sample": 60,
"speed": 0.1,
"wrapMode": 2,
"curveData": {
"props": {
"angle": [
{
"frame": 0,
"value": 0
},
{
"frame": 0.8333333333333334,
"value": -120
},
{
"frame": 1.6666666666666667,
"value": -240
},
{
"frame": 2.5,
"value": -360
}
]
}
},
"events": []
}
\ No newline at end of file
No preview for this file type