召唤逻辑改变

This commit is contained in:
2025-06-03 16:34:27 +08:00
parent b66c69d925
commit 899613c689
8 changed files with 943 additions and 804 deletions

View File

@@ -12,6 +12,7 @@ import { HeroViewComp } from "../hero/HeroViewComp";
import { Hero } from "../hero/Hero";
import { HartModelComp } from "../hero/HartModelComp";
import { TimerManager } from "db://oops-framework/core/common/timer/TimerManager";
import { HeroList } from "../common/config/heroSet";
const { ccclass, property } = _decorator;
/** 视图层对象 */
@@ -52,17 +53,33 @@ export class MissionComp extends CCComp {
}
to_end_fight(){
oops.message.dispatchEvent(GameEvent.FightEnd)
}
mission_start(){
/* todo 关卡设定完善*/
console.log("战斗开始 关卡怪物:",Missions[smc.mission.lv])
this.node.active=true
this.data_init()
this.hero_init()
this.hart_hero_load()
this.to_hero_skill_select()
}
to_hero_skill_select(){
oops.message.dispatchEvent(GameEvent.HeroSkillSelect)
}
to_hero_select(){
oops.message.dispatchEvent(GameEvent.HeroSelect)
}
to_fight(){
oops.message.dispatchEvent(GameEvent.FightStart)
}
to_end_fight(){
oops.message.dispatchEvent(GameEvent.FightEnd)
}
fight_end(){
console.log("任务结束")
// 延迟0.5秒后执行任务结束逻辑
@@ -86,16 +103,15 @@ export class MissionComp extends CCComp {
}
//角色初始化
hero_init(){
hart_hero_load(){
let hero = ecs.getEntity<Hero>(Hero);
hero.hart_load()
this.scheduleOnce(() => {
this.card_init()
}, 0.3)
}
card_init(){
oops.message.dispatchEvent(GameEvent.CardRefresh)
}
card_refresh(){
if(smc.vmdata.mission_data.gold< smc.vmdata.mission_data.refresh_gold){
oops.gui.toast("金币不足", false);
@@ -106,12 +122,12 @@ export class MissionComp extends CCComp {
}
private cleanComponents() {
ecs.query(ecs.allOf(HeroViewComp)).forEach(entity => {entity.remove(HeroViewComp);entity.destroy()});
}
/** 视图层逻辑代码分离演示 */
/** 视图对象通过 ecs.Entity.remove(ModuleViewComp) 删除组件是触发组件处理自定义释放逻辑 */