GameCategoryListCell.js
1.81 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
//明星列表ListCell
var Common = require('Common');
var FocusInfo = require('FocusInfo');
var ListCell = require('ListCell');
var Network = require('Network');
cc.Class({
extends: ListCell,
properties: {
id: 0,
bg: cc.Sprite, //背景
starName: cc.Label, //名称
pic: cc.Sprite, //动漫图片
},
statics: {
PFB_NAME: 'prefab/pfbGameCategoryListCell',
CELL_NAME: 'StarListCell',
},
init: function (iCellIndex, bIsFocusEnable, compSceneCanvas) {
//准备焦点坐标
let fiCategoryBlock = this.node.addComponent(FocusInfo);
fiCategoryBlock.init(
null, false, null, null, 1.0
);
compSceneCanvas.addNodeToFocusTarget(0, this.node.name, this.node);
},
render(oData, iRecordIndex) {
this.id = oData.id;
this.starName.string = oData.title;
// // this.bg.spriteFrame.setRect(cc.rect(0, 0, 214, 214));
var self = this;
cc.loader.loadRes(oData.image[0].fileUrl, cc.Texture2D, function (err, texture) {
self.pic.spriteFrame = new cc.SpriteFrame(texture);
});
// if (oData.image[0]) {
// var self = this;
// Network.loadImageInNativeRuntime(
// Common.TOPDRAW_IMAGE_SERVER + oData.image[0].fileUrl,
// function (texture) {
// self.pic.spriteFrame = new cc.SpriteFrame(texture);
// }, null, this
// );
// }
// //准备焦点坐标
// this.node.getComponent(FocusInfo).setTVLink(oData.tvlink);
},
enableFocusInfo: function () {
this.node.getComponent(FocusInfo).setEnable(true);
},
disableFocusInfo: function () {
this.node.getComponent(FocusInfo).setEnable(false);
},
});