// 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"; 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; // 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) } } // update (dt) {} }