开始商店 脚本和ui
This commit is contained in:
@@ -4,6 +4,7 @@ import { UIID } from '../common/config/GameUIConfig';
|
||||
import { getHeroList, getHeroStatsByLevel, getUpgradeResources, HeroInfo, HType } from '../common/config/heroSet';
|
||||
import { smc } from '../common/SingletonModuleComp';
|
||||
import { GameEvent } from '../common/config/GameEvent';
|
||||
import { NumberFormatter } from '../common/config/BoxSet';
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@ccclass('HInfoComp')
|
||||
@@ -42,14 +43,20 @@ export class HInfoComp extends Component {
|
||||
this.node.getChildByName("info").getChildByName("ap").getChildByName("num").getComponent(Label).string=ap.toString()
|
||||
this.node.getChildByName("info").getChildByName("def").getChildByName("num").getComponent(Label).string=def.toString()
|
||||
let {experience,gold}=getUpgradeResources(lv)
|
||||
let need_node=this.node.getChildByName("upNeed").getChildByName("need")
|
||||
need_node.getChildByName("exp").getChildByName("need").getComponent(Label).string=experience.toString()
|
||||
need_node.getChildByName("gold").getChildByName("need").getComponent(Label).string=gold.toString()
|
||||
this.updata_need(experience,gold)
|
||||
this.node.getChildByName("upBtn").active=smc.data.exp>=experience&&smc.data.gold>=gold
|
||||
this.node.getChildByName("type").getChildByName("w").active=hero_data.type==HType.warrior
|
||||
this.node.getChildByName("type").getChildByName("r").active=hero_data.type==HType.remote
|
||||
this.node.getChildByName("type").getChildByName("m").active=hero_data.type==HType.mage
|
||||
this.show_luck(smc.heros[uuid]?.lv??0)
|
||||
}
|
||||
updata_need(experience:number,gold:number){
|
||||
let need_node=this.node.getChildByName("upNeed").getChildByName("need")
|
||||
need_node.getChildByName("exp").getChildByName("need").getComponent(Label).string=NumberFormatter.formatNumber(experience)
|
||||
need_node.getChildByName("gold").getChildByName("need").getComponent(Label).string=NumberFormatter.formatNumber(gold)
|
||||
need_node.getChildByName("exp").getChildByName("has").getComponent(Label).string=NumberFormatter.formatNumber(smc.data.exp)
|
||||
need_node.getChildByName("gold").getChildByName("has").getComponent(Label).string=NumberFormatter.formatNumber(smc.data.gold)
|
||||
}
|
||||
show_luck(lv:number){
|
||||
this.node.getChildByName("upBtn").active=lv > 0
|
||||
this.node.getChildByName("upNeed").active=lv > 0
|
||||
@@ -58,7 +65,7 @@ export class HInfoComp extends Component {
|
||||
uplevel(){
|
||||
let lv=smc.heros[this.h_uuid].lv
|
||||
let {experience,gold}=getUpgradeResources(lv)
|
||||
if(smc.vmdata.data.exp<=experience||smc.vmdata.data.gold<=gold){
|
||||
if(smc.data.exp<=experience||smc.data.gold<=gold){
|
||||
oops.gui.toast("经验或金币不足")
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user