123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293 |
- cc.Class({
- extends: cc.Component,
- properties: {
- imageRare: {
- default: null,
- type: cc.Sprite,
- serializable: true,
- },
- imageItem: {
- default: null,
- type: cc.Sprite,
- serializable: true,
- },
- imageSelect: {
- default: null,
- type: cc.Sprite,
- serializable: true,
- },
- textPrice: {
- default: null,
- type: cc.Label,
- serializable: true,
- },
- textType: {
- default: null,
- type: cc.Label,
- serializable: true,
- },
- textNum: {
- default: null,
- type: cc.Label,
- serializable: true,
- },
- },
- setIndex(index) {
- this.index = index;
- },
- getIndex(index) {
- return this.index;
- },
- setData(data) {
- this.data = data;
- },
- getData() {
- return this.data;
- },
- setCb(cb) {
- this.onClickCb = cb;
- },
- setScale(s) {
- this.node.scale = s;
- },
- setTypeName(name) {
- this.textType.string = name;
- },
- setTypeNameScale(s) {
- this.textType.node.scale = s;
- },
- setPrice(price) {
- this.textPrice.string = price;
- },
- setSelectNum(num) {
- this.imageSelect.node.active = num > 0;
- this.textNum.node.active = num > 0;
- if (num > 0) {
- this.textNum.string = "X" + num;
- }
- },
- onClickCell() {
- if (this.onClickCb) {
- this.onClickCb(this.index, this.data)
- }
- },
- });
|