英雄出战选择 +英雄相关 ui 改变
This commit is contained in:
@@ -3,11 +3,17 @@ import { HeroInfo, HQuality, HType } from '../common/config/heroSet';
|
||||
import { smc } from '../common/SingletonModuleComp';
|
||||
import { oops } from 'db://oops-framework/core/Oops';
|
||||
import { UIID } from '../common/config/GameUIConfig';
|
||||
import { GameSet, HeroConSet } from '../common/config/BoxSet';
|
||||
import { HttpReturn } from 'db://oops-framework/libs/network/HttpRequest';
|
||||
import { GameEvent } from '../common/config/GameEvent';
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@ccclass('HCardUICom')
|
||||
export class HCardUICom extends Component {
|
||||
h_uuid:number=0
|
||||
type:number=0
|
||||
slot:number=0
|
||||
|
||||
start() {
|
||||
console.log("[HCardUICom]:start")
|
||||
}
|
||||
@@ -15,9 +21,12 @@ export class HCardUICom extends Component {
|
||||
update(deltaTime: number) {
|
||||
|
||||
}
|
||||
update_data(uuid:number){
|
||||
console.log("[HCardUICom]:update_data",uuid)
|
||||
update_data(uuid:number,args:any){
|
||||
this.type=args.type
|
||||
if(args.slot) this.slot=args.slot
|
||||
console.log("[HCardUICom]:update_data",uuid,this.type,this.slot,args)
|
||||
this.h_uuid=uuid
|
||||
this.node.getChildByName("in_fight").active=this.check_in_fight(uuid)
|
||||
let hero_data = HeroInfo[uuid]
|
||||
let hero= this.node.getChildByName("hero")
|
||||
let anm_path=hero_data.path
|
||||
@@ -26,7 +35,10 @@ export class HCardUICom extends Component {
|
||||
hero.getComponent(Animation).play("idle");
|
||||
});
|
||||
this.node.getChildByName("name").getComponent(Label).string=hero_data.name
|
||||
this.node.getChildByName("lv").getChildByName("num").getComponent(Label).string=smc.heros[uuid].lv.toString()
|
||||
let lv=smc.heros[uuid]?.lv??0
|
||||
this.node.getChildByName("luck").active=lv==0
|
||||
this.node.getChildByName("lv").getChildByName("num").getComponent(Label).string=lv > 0 ? lv.toString() : ""
|
||||
this.node.getChildByName("lv").active=lv > 0
|
||||
// this.node.getChildByName("slv").getChildByName("lv1").active=smc.heros[uuid].slv>=1
|
||||
// this.node.getChildByName("slv").getChildByName("lv2").active=smc.heros[uuid].slv>=2
|
||||
// this.node.getChildByName("slv").getChildByName("lv3").active=smc.heros[uuid].slv>=3
|
||||
@@ -43,9 +55,37 @@ export class HCardUICom extends Component {
|
||||
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
|
||||
|
||||
}
|
||||
show_info(){
|
||||
oops.gui.open(UIID.HeroInfo,this.h_uuid)
|
||||
do_click(){
|
||||
switch(this.type){
|
||||
case HeroConSet.INFO:
|
||||
oops.gui.open(UIID.HeroInfo,this.h_uuid)
|
||||
break
|
||||
case HeroConSet.SELECT:
|
||||
if(oops.gui.has(UIID.HeroSelect)) {
|
||||
this.check_in_slot(this.h_uuid)
|
||||
smc.setFightHero(this.slot,this.h_uuid,true)
|
||||
oops.message.dispatchEvent(GameEvent.UpdateHero)
|
||||
oops.gui.remove(UIID.HeroSelect)
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
check_in_slot(uuid:number){ //如果英雄在出战位,则移除久的出战位
|
||||
let heros=smc.fight_heros
|
||||
for(let i=0;i<GameSet.HERO_NUM;i++){
|
||||
if(heros[i]==uuid) {
|
||||
smc.setFightHero(i,0,true)
|
||||
}
|
||||
}
|
||||
}
|
||||
check_in_fight(uuid:number){
|
||||
let heros=smc.fight_heros
|
||||
for(let i=0;i<GameSet.HERO_NUM;i++){
|
||||
if(heros[i]==uuid) return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user