import { _decorator, Component, Node, Label, ProgressBar } from 'cc'; import { jifenDataConfig } from '../../config/jifenDataConfig'; import { GameMng } from '../../GameMng'; import { settlementData } from '../../UserData/settlementData'; const { ccclass, property } = _decorator; @ccclass('jifen_jiesuan') export class jifen_jiesuan extends Component { @property(Node) lab_user_score:Node = null; @property(Node) lab_get_score:Node = null; @property(Node) progress_bar:Node = null; @property(Node) lab_cur_level:Node = null; @property(Node) lab_next_level:Node = null; @property(Node) lab_level_progress:Node = null; start() { } show(settlement:settlementData){ this.node.active = true; let next_data = jifenDataConfig.Instance.getDataByLevel(GameMng._userData.integral_level+1) let nextLevelName =next_data.name; let nextLevelScore = next_data.score; this.lab_user_score.getComponent(Label).string = settlement.user_score+""; let fh = settlement.result===1?"+":"-" this.lab_get_score.getComponent(Label).string = fh+Math.abs(settlement.get_score)+""; this.lab_cur_level.getComponent(Label).string = GameMng._userData.integral_level_name; this.lab_next_level.getComponent(Label).string = nextLevelName; this.lab_level_progress.getComponent(Label).string = settlement.user_score+"/"+nextLevelScore if(settlement.user_score<0){ let all = nextLevelScore+Math.abs(settlement.user_score) let cur = all - Math.abs(settlement.user_score) this.progress_bar.getComponent(ProgressBar).progress = cur/all }else{ this.progress_bar.getComponent(ProgressBar).progress =settlement.user_score/nextLevelScore } } update(deltaTime: number) { } }