import Common5 from "../../../Platform/th/Common5"; const { ccclass, property } = cc._decorator; @ccclass export default class ChaoCaiResult extends cc.Component { @property(cc.Label) caiMingStr: cc.Label = null @property(cc.Label) moneyStr: cc.Label = null @property(cc.Node) guangXiao: cc.Node = null @property(cc.Node) iconSpFrame: cc.Node = null @property(cc.Sprite) pingFenIcon: cc.Sprite = null @property([cc.SpriteFrame]) pingFenSpFrameTab: cc.SpriteFrame[] = [] finishCallFunc = null restartCallFunc = null initView(config,resultIndex,finishCallFunc,restartCallFunc){ Common5.playEffectCustom('CommonRes','sound/获得奖励') console.log('config==',config,resultIndex) this.finishCallFunc = finishCallFunc this.restartCallFunc = restartCallFunc this.moneyStr.string = `预估获得投资:${Common5.getNumberChangeHanzi(config.touZiMoney[resultIndex],'1')}` this.caiMingStr.string = config.caiMing this.pingFenIcon.spriteFrame = this.pingFenSpFrameTab[resultIndex] if(resultIndex == 0){ this.guangXiao.active = false Common5.getSpriteFrameFromBundle("ChaoCai", "texture/菜肴/" + config.caiMing + '暗', this.iconSpFrame.getComponent(cc.Sprite)); }else if(resultIndex == 1){ this.guangXiao.active = false Common5.getSpriteFrameFromBundle("ChaoCai", "texture/菜肴/" + config.caiMing + '亮', this.iconSpFrame.getComponent(cc.Sprite)); }else{ this.guangXiao.active = true Common5.getSpriteFrameFromBundle("ChaoCai", "texture/菜肴/" + config.caiMing + '亮', this.iconSpFrame.getComponent(cc.Sprite)); } } onBtnClickFinish(){ this.node.removeFromParent() this.finishCallFunc() } onBtnClickChongLai(){ this.node.removeFromParent() this.restartCallFunc() } }