咸鱼的反击
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
xianyudefanji/assets/Scripts/ZaoCanDian/ZaoCanDianYeWuitemNode.ts

60 lines
1.9 KiB

// Learn TypeScript:
// - https://docs.cocos.com/creator/2.4/manual/en/scripting/typescript.html
// Learn Attribute:
// - https://docs.cocos.com/creator/2.4/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
// - https://docs.cocos.com/creator/2.4/manual/en/scripting/life-cycle-callbacks.html
import Common5 from "../../Platform/th/Common5";
import ZaoCanManager from "../Manager/ZaoCanManager";
const { ccclass, property } = cc._decorator;
@ccclass
export default class ZaoCanDianYeWuitemNode extends cc.Component {
@property(cc.Label)
nameLabel: cc.Label = null;
@property(cc.Sprite)
headImg: cc.Sprite = null;
@property(cc.Label)
jiachengPercent: cc.Label = null;
@property(cc.Label)
levelLabel: cc.Label = null;
// LIFE-CYCLE CALLBACKS:
config = null
// onLoad () {}
start() {
}
setViewDate(config, gameType) {
this.config = config
this.refreshView()
}
refreshView() {
let str = Common5.getNumberChangeHanzi(this.config.addPercent * 100)
this.jiachengPercent.string = str + '%'
this.nameLabel.string = this.config.name
let name = this.config.name
// Common5.addUrlSprite_custom('tanweiTexture/icon/' + this.config.name, this.headImg)
let lockState = ZaoCanManager.isUnLockByName(name)
if (lockState) {
this.nameLabel.node.active = true
this.jiachengPercent.node.parent.active = true
this.levelLabel.node.active = false
Common5.getSpriteFrameFromBundle("ZaoCanDian", 'res/' + '炸球', this.headImg)
} else {
this.nameLabel.node.active = false
this.jiachengPercent.node.parent.active = false
this.levelLabel.node.active = true
this.levelLabel.string = `摊位${ZaoCanManager.getZaoCanNeedLevelByName(name)}级解锁`
}
}
// update (dt) {}
}