咸鱼的反击
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.
 
 
 

123 lines
4.2 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 MiShuManager from "../Manager/MiShuManager";
import ShipuManager from "../Manager/ShipuManager";
import TanWeiManager from "../Manager/TanWeiManager";
import ZaoCanManager from "../Manager/ZaoCanManager";
const { ccclass, property } = cc._decorator;
@ccclass
export default class jiachengItem 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
gameType = 'mishu' //tanwei
// onLoad () {}
start() {
}
setViewDate(config, gameType) {
this.config = config
this.gameType = gameType
this.refreshView()
}
refreshView() {
let str = Common5.getNumberChangeHanzi(this.config.addPercent * 100)
this.jiachengPercent.string = str + '%'
if (this.config.name == '习婉工') {
this.nameLabel.string = '席婉工'
} else {
this.nameLabel.string = this.config.name
}
if (this.gameType == 'mishu') {
let isChangeColor = MiShuManager.getMishuClickInCome(this.config.mishuId)
if (isChangeColor) {
//亮色
//#D76363
this.nameLabel.node.color = new cc.Color().fromHEX("#D76363")
this.headImg.node.color = new cc.Color().fromHEX("#ffffff")
this.jiachengPercent.node.color = new cc.Color().fromHEX("#D76363")
} else {
//huise #1F1F1F
this.nameLabel.node.color = new cc.Color().fromHEX("#1F1F1F")
this.headImg.node.color = new cc.Color().fromHEX("#646464")
this.jiachengPercent.node.color = new cc.Color().fromHEX("#1F1F1F")
}
if (this.config.name == '茜滢') {
Common5.addUrlSprite_custom("mishuHead/茜滢2", this.headImg)
} else {
Common5.addUrlSprite_custom('mishuHead/' + this.config.name, this.headImg)
}
} else if (this.gameType == 'tanwei') {
let isChangeColor = TanWeiManager.getShipuClickInCome(this.config.id)
if (isChangeColor) {
//亮色
//#D76363
this.nameLabel.node.color = new cc.Color().fromHEX("#D76363")
this.headImg.node.color = new cc.Color().fromHEX("#ffffff")
this.jiachengPercent.node.color = new cc.Color().fromHEX("#D76363")
} else {
//huise #1F1F1F
this.nameLabel.node.color = new cc.Color().fromHEX("#1F1F1F")
this.headImg.node.color = new cc.Color().fromHEX("#646464")
this.jiachengPercent.node.color = new cc.Color().fromHEX("#1F1F1F")
}
Common5.addUrlSprite_custom('tanweiTexture/icon/' + this.config.name, this.headImg)
} else if (this.gameType == '早餐加成') {
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("PeopleLevelUp", 'texture/1/' + '炸球', 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) {}
}