页面转换做了调整

This commit is contained in:
2024-12-12 23:30:35 +08:00
parent ed64cab535
commit 329d8b5694
2 changed files with 1201 additions and 286 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -30,10 +30,9 @@ export class CardControllerComp extends CCComp {
this.bbg=this.node.getChildByName("bar").getChildByName("bbg") this.bbg=this.node.getChildByName("bar").getChildByName("bbg")
} }
start() { start() {
this.hero_home_hide()
this.mission_hide()
this.bbg=this.node.getChildByName("bar").getChildByName("bbg") this.bbg=this.node.getChildByName("bar").getChildByName("bbg")
this.bbg.setPosition(v3(this.bbg_x[2],this.bbg_y)) this.bbg.setPosition(v3(this.bbg_x[2],this.bbg_y))
this.page_init()
} }
show_info(uuid:number,type:number){ show_info(uuid:number,type:number){
@@ -45,88 +44,62 @@ export class CardControllerComp extends CCComp {
return return
} }
}
page_init(){
this.node.getChildByName("mission_home").active=true;
this.node.getChildByName("hero_home").setPosition(v3(1000,this.node.getChildByName("hero_home").position.y))
this.node.getChildByName("shop_home").setPosition(v3(1000,this.node.getChildByName("shop_home").position.y))
this.node.getChildByName("battle_home").setPosition(v3(1000,this.node.getChildByName("battle_home").position.y))
this.node.getChildByName("skill_home").setPosition(v3(1000,this.node.getChildByName("skill_home").position.y))
this.node.getChildByName("mission").active = false;
} }
bar_change(e:any,args:any){ bar_change(e:any,args:any){
console.log("bar_change",args)
this.node.getChildByName("mission_home").active=true;
this.node.getChildByName("bar").active=true;
this.bbg.setPosition(v3(this.bbg_x[2],this.bbg_y))
this.node.getChildByName("mission").active = false;
this.node.getChildByName("hero_home").setPosition(v3(2000,this.node.getChildByName("hero_home").position.y))
this.node.getChildByName("shop_home").setPosition(v3(2000,this.node.getChildByName("shop_home").position.y))
this.node.getChildByName("battle_home").setPosition(v3(2000,this.node.getChildByName("battle_home").position.y))
this.node.getChildByName("skill_home").setPosition(v3(2000,this.node.getChildByName("skill_home").position.y))
switch(args){ switch(args){
case "hero": case "hero":
this.node.getChildByName("hero_home").setPosition(v3(0,this.node.getChildByName("hero_home").position.y))
this.bbg.setPosition(v3(this.bbg_x[1],this.bbg_y))
break;
case "shop":
this.node.getChildByName("shop_home").setPosition(v3(0,this.node.getChildByName("shop_home").position.y))
this.bbg.setPosition(v3(this.bbg_x[0],this.bbg_y))
break;
case "battle":
this.node.getChildByName("battle_home").setPosition(v3(0,this.node.getChildByName("battle_home").position.y))
this.bbg.setPosition(v3(this.bbg_x[4],this.bbg_y))
break;
case "skill":
this.node.getChildByName("skill_home").setPosition(v3(0,this.node.getChildByName("skill_home").position.y))
this.bbg.setPosition(v3(this.bbg_x[3],this.bbg_y))
break; break;
} }
} }
hero_home_show(){
let node=this.node.getChildByName("hero_home")
node.active = true
tween(node).to( 0.1,{ position: v3(0,node.position.y)}, ).start();
}
hero_home_hide(){
let node=this.node.getChildByName("hero_home")
node.active = false
// tween(node).to( 0.1,{ position: v3(2000,node.position.y)}, ).start();
}
mission_home_show(){
this.node.getChildByName("mission_home").active=true;
}
mission_home_hide(){
this.node.getChildByName("mission_home").active=false;
}
mission_show(){
this.node.getChildByName("mission").active = true;
}
mission_hide(){
this.node.getChildByName("mission").active = false;
}
mission_start(){ mission_start(){
this.node.getChildByName("bar").active=false; this.node.getChildByName("bar").active=false;
this.mission_home_hide() this.node.getChildByName("mission_home").active=false;
this.mission_show(); this.node.getChildByName("mission").active = true;
smc.mission.play = true; smc.mission.play = true;
// oops.message.dispatchEvent("mission_start") // oops.message.dispatchEvent("mission_start")
} }
to_mission(){ to_mission(){
this.hero_home_hide() this.bar_change(null,"home")
this.mission_home_show()
this.mission_hide()
this.node.getChildByName("bar").active=true; this.node.getChildByName("bar").active=true;
// tween(this.bbg).to(0.1,{Position:v3(this.bbg_x[2],this.bbg_y)}).start() // tween(this.bbg).to(0.1,{Position:v3(this.bbg_x[2],this.bbg_y)}).start()
this.bbg.setPosition(this.bbg_x[2],this.bbg_y) this.bbg.setPosition(this.bbg_x[2],this.bbg_y)
} }
to_shop(){ /** 视图对象通过 ecs.Entity.remove(ControllerComp) 删除组件是触发组件处理自定义释放逻辑 */
this.mission_home_hide()
this.hero_home_hide()
this.mission_hide()
// tween(this.bbg).to(0.1,{Position:v3(this.bbg_x[0],this.bbg_y)}).start()
this.bbg.setPosition(this.bbg_x[0],this.bbg_y)
}
to_hero(){
this.mission_home_hide()
this.hero_home_show()
this.mission_hide()
// tween(this.bbg).to(0.1,{Position:v3(this.bbg_x[1],this.bbg_y)}).start()
this.bbg.setPosition(this.bbg_x[1],this.bbg_y)
}
to_skills(){
this.mission_home_hide()
this.hero_home_hide()
this.mission_hide()
// tween(this.bbg).to(0.1,{Position:v3(this.bbg_x[3],this.bbg_y)}).start()
this.bbg.setPosition(this.bbg_x[3],this.bbg_y)
}
to_battle(){
this.mission_home_hide()
this.hero_home_hide()
this.mission_hide()
// tween(this.bbg).to(0.1,{Position:v3(this.bbg_x[4],this.bbg_y)}).start()
this.bbg.setPosition(this.bbg_x[4],this.bbg_y)
}
/** 视图对象通过 ecs.Entity.remove(ControllerComp) 删除组件是触发组件处理自定义释放逻辑 */
reset() { reset() {
this.node.destroy(); this.node.destroy();
} }