import User from "../../../FrameWork/User/User"; import Common5 from "../../../Platform/th/Common5"; import GameEnterClick from "../../MainScene/GameEnterClick"; import ZhongCanTingManager from "../ZhongCanTing/ZhongCanTingManager"; const { ccclass, property } = cc._decorator; @ccclass export default class TiShengShouYi extends cc.Component { @property(cc.Node) shaMoNode: cc.Node = null @property(cc.Node) qiENode: cc.Node = null @property(cc.Node) zhongCanTingTiLiNode: cc.Node = null @property(cc.Node) zhongCanTingNaoLiNode: cc.Node = null curTypeId:number = 0 initView(typeId){ this.curTypeId = typeId //沙漠 if(this.curTypeId == 0){ this.setShaMoNodeInfo() //企鹅 }else if(this.curTypeId == 1){ this.setQiENodeInfo() //中餐厅体力 }else if(this.curTypeId == 2){ this.setZhongCanTingTiLiNodeInfo() //中餐厅脑力 }else if(this.curTypeId == 3){ this.setZhongCanTingNaoLiNodeInfo() } } setShaMoNodeInfo(){ this.shaMoNode.active = true let curTiLi = User.getProper_TiLi() let curShouYi = ZhongCanTingManager.getPerSecondShouYi() let tiShengTiLi = 74 let tiShengShouYi = ZhongCanTingManager.getPerSecondShouYi(tiShengTiLi-curTiLi) this.shaMoNode.getChildByName('curTiLi').getComponent(cc.Label).string = `当前体力:${curTiLi}` this.shaMoNode.getChildByName('curShouYi').getComponent(cc.Label).string = `当前收益:${Common5.getNumberChangeHanzi(curShouYi, '1', 1)}/秒` this.shaMoNode.getChildByName('layoutTiLi').getChildByName('tiShengTiLi').getComponent(cc.Label).string = `最大提升至:${tiShengTiLi}` this.shaMoNode.getChildByName('layoutShouYi').getChildByName('tiShengShouYi').getComponent(cc.Label).string = `提升至:${Common5.getNumberChangeHanzi(tiShengShouYi, '1', 1)}/秒` } setQiENodeInfo(){ this.qiENode.active = true let curNaoLi = User.getProper_NaoLi() let curShouYi = ZhongCanTingManager.getPerSecondShouYi() let tiShengNaoLi = 70 let tiShengShouYi = ZhongCanTingManager.getPerSecondShouYi(0,tiShengNaoLi-curNaoLi) this.qiENode.getChildByName('curNaoLi').getComponent(cc.Label).string = `当前脑力:${curNaoLi}` this.qiENode.getChildByName('curShouYi').getComponent(cc.Label).string = `当前收益:${Common5.getNumberChangeHanzi(curShouYi, '1', 1)}/秒` this.qiENode.getChildByName('layoutNaoLi').getChildByName('tiShengNaoLi').getComponent(cc.Label).string = `最大提升至:${tiShengNaoLi}` this.qiENode.getChildByName('layoutShouYi').getChildByName('tiShengShouYi').getComponent(cc.Label).string = `提升至:${Common5.getNumberChangeHanzi(tiShengShouYi, '1', 1)}/秒` } setZhongCanTingTiLiNodeInfo(){ this.zhongCanTingTiLiNode.active = true let curTiLi = User.getProper_TiLi() let curShouYi = ZhongCanTingManager.getPerSecondShouYi() let tiShengTiLi = 74 let tiShengShouYi = ZhongCanTingManager.getPerSecondShouYi(tiShengTiLi-curTiLi) this.zhongCanTingTiLiNode.getChildByName('curTiLi').getComponent(cc.Label).string = `当前体力:${curTiLi}` this.zhongCanTingTiLiNode.getChildByName('curShouYi').getComponent(cc.Label).string = `当前收益:${Common5.getNumberChangeHanzi(curShouYi, '1', 1)}/秒` this.zhongCanTingTiLiNode.getChildByName('layoutTiLi').getChildByName('tiShengTiLi').getComponent(cc.Label).string = `最大提升至:${tiShengTiLi}` this.zhongCanTingTiLiNode.getChildByName('layoutShouYi').getChildByName('tiShengShouYi').getComponent(cc.Label).string = `提升至:${Common5.getNumberChangeHanzi(tiShengShouYi, '1', 1)}/秒` } setZhongCanTingNaoLiNodeInfo(){ this.zhongCanTingNaoLiNode.active = true let curNaoLi = User.getProper_NaoLi() let curShouYi = ZhongCanTingManager.getPerSecondShouYi() let tiShengNaoLi = 70 let tiShengShouYi = ZhongCanTingManager.getPerSecondShouYi(0,tiShengNaoLi-curNaoLi) this.zhongCanTingNaoLiNode.getChildByName('curNaoLi').getComponent(cc.Label).string = `当前脑力:${curNaoLi}` this.zhongCanTingNaoLiNode.getChildByName('curShouYi').getComponent(cc.Label).string = `当前收益:${Common5.getNumberChangeHanzi(curShouYi, '1', 1)}/秒` this.zhongCanTingNaoLiNode.getChildByName('layoutNaoLi').getChildByName('tiShengNaoLi').getComponent(cc.Label).string = `最大提升至:${tiShengNaoLi}` this.zhongCanTingNaoLiNode.getChildByName('layoutShouYi').getChildByName('tiShengShouYi').getComponent(cc.Label).string = `提升至:${Common5.getNumberChangeHanzi(tiShengShouYi, '1', 1)}/秒` } onBtnClickClose(){ this.node.removeFromParent() this.node.destroy() } onBtnSureClick(){ //沙漠 if(this.curTypeId == 0){ this.node.removeFromParent() this.node.destroy() //企鹅 }else if(this.curTypeId == 1){ this.node.removeFromParent() this.node.destroy() //中餐厅体力 }else if(this.curTypeId == 2){ GameEnterClick.clickShaMoZhongShu() //中餐厅脑力 }else if(this.curTypeId == 3){ GameEnterClick.clickBingShanQiE() } } }