| 123456789101112131415161718192021222324252627282930313233343536373839 |
- /** 农场解锁Item */
- const { ccclass, property } = cc._decorator;
- @ccclass
- export default class FarmLevelUnlockItem extends cc.Component {
- @property({ type: cc.Label, displayName: '状态' })
- lbl_State: cc.Label = null;
- @property({ type: cc.Label, displayName: '建筑名称' })
- lbl_buildName: cc.Label = null;
- @property({ type: cc.Sprite, displayName: '建筑图片' })
- sp_build: cc.Sprite = null;
- itemData = null;
- /**
- * list_data
- * @param data item数据
- */
- public async setItemData(bData) {
- this.itemData = bData;
- if (this.itemData.state == 0) {
- this.lbl_State.string = '未解锁';
- this.lbl_State.node.color = cc.Color.GRAY;
- this.sp_build.node.color = cc.Color.BLACK;
- }
- else {
- this.lbl_State.string = '已解锁';
- this.lbl_State.node.color = cc.Color.GREEN;
- this.sp_build.node.color = cc.Color.WHITE;
- }
- this.lbl_buildName.string = this.itemData.buildName;
- this.sp_build.spriteFrame = await mk.loader.load(this.itemData.buildUrl, cc.SpriteFrame);
- }
- }
|