diff --git a/assets/script/game/battle/BattleEndSystem.ts b/assets/script/game/battle/BattleEndSystem.ts deleted file mode 100644 index ba67e2b3..00000000 --- a/assets/script/game/battle/BattleEndSystem.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS"; -import { BattleStateComp } from "./BattleStateComp"; -import { HeroViewComp } from "../hero/HeroViewComp"; -import { HeroSkillsComp } from "../skill/heroSkillsComp"; -import { HCardComp } from "../map/HCardComp"; - -@ecs.register('BattleEndSystem') -export class BattleEndSystem extends ecs.ComblockSystem { - filter(): ecs.IMatcher { - return ecs.allOf(BattleStateComp); - } - - update(e: ecs.Entity) { - const state = e.get(BattleStateComp); - if (state.isEnded) { - // 清理战斗残留组件 - this.cleanComponents(); - - // 重置状态 - state.reset(); - console.log(`战斗结束,持续时间: ${Date.now() - state.startTime}ms`); - } - } - - private cleanComponents() { - console.log("cleanComponents"); - console.log("HCardComp",ecs.query(ecs.allOf(HCardComp))); - console.log("HeroSkillsComp",ecs.query(ecs.allOf(HeroSkillsComp))); - console.log("HeroViewComp",ecs.query(ecs.allOf(HeroViewComp))); - ecs.query(ecs.allOf(HCardComp)).forEach(entity => entity.remove(HCardComp)); - ecs.query(ecs.allOf(HeroSkillsComp)).forEach(entity => entity.remove(HeroSkillsComp)); - ecs.query(ecs.allOf(HeroViewComp)).forEach(entity => entity.remove(HeroViewComp)); - } -} \ No newline at end of file diff --git a/assets/script/game/battle/BattleEndSystem.ts.meta b/assets/script/game/battle/BattleEndSystem.ts.meta deleted file mode 100644 index 256eef2e..00000000 --- a/assets/script/game/battle/BattleEndSystem.ts.meta +++ /dev/null @@ -1,9 +0,0 @@ -{ - "ver": "4.0.23", - "importer": "typescript", - "imported": true, - "uuid": "8454cfbc-f83d-45e9-a8c5-5bb4c830ada8", - "files": [], - "subMetas": {}, - "userData": {} -} diff --git a/assets/script/game/battle/BattleEntity.ts b/assets/script/game/battle/BattleEntity.ts deleted file mode 100644 index 7087859c..00000000 --- a/assets/script/game/battle/BattleEntity.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS"; -import { BattleStateComp } from "./BattleStateComp"; -import { BattleManagerComp } from "./BattleManagerComp"; - -/** 战斗实体 */ -export class BattleEntity extends ecs.Entity { - BattleState!: BattleStateComp; - BattleManager!: BattleManagerComp; - - constructor() { - super(); - } - - protected init() { - this.addComponents(BattleStateComp, BattleManagerComp); - } -} \ No newline at end of file diff --git a/assets/script/game/battle/BattleEntity.ts.meta b/assets/script/game/battle/BattleEntity.ts.meta deleted file mode 100644 index 58ab5646..00000000 --- a/assets/script/game/battle/BattleEntity.ts.meta +++ /dev/null @@ -1,9 +0,0 @@ -{ - "ver": "4.0.23", - "importer": "typescript", - "imported": true, - "uuid": "12e09b78-0059-421e-bab8-1677760401d1", - "files": [], - "subMetas": {}, - "userData": {} -} diff --git a/assets/script/game/battle/BattleManager.ts b/assets/script/game/battle/BattleManager.ts deleted file mode 100644 index 7e0677b4..00000000 --- a/assets/script/game/battle/BattleManager.ts +++ /dev/null @@ -1,46 +0,0 @@ -import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS"; -import { BattleEntity } from "./BattleEntity"; -import { BattleStateComp } from "./BattleStateComp"; -import { UIID } from "../common/config/GameUIConfig"; -import { oops } from "db://oops-framework/core/Oops"; - -export class BattleManager { - /** 获取战斗实体实例 */ - static get instance(): ecs.Entity { - return ecs.query(ecs.allOf(BattleStateComp))[0]; - } - - /** 启动战斗 */ - static startBattle(missionId: number) { - const entity = ecs.getEntity(BattleEntity); - entity.get(BattleStateComp).missionId = missionId; - } - - /** 结束战斗 */ - static endBattle() { - const entity = ecs.query(ecs.allOf(BattleStateComp))[0]; - if (entity) { - entity.get(BattleStateComp).isEnded = true; - } - } - - /** 扩展:带UI管理的战斗启动 */ - static startBattleWithUI(missionId: number) { - // 关闭主界面 - // oops.gui.remove(UIID.MainMenu); - // // 显示战斗HUD - // oops.gui.open(UIID.BattleHUD); - // 启动战斗 - this.startBattle(missionId); - } - - /** 扩展:带UI管理的战斗结束 */ - static endBattleWithUI(isVictory: boolean) { - // 关闭战斗HUD - // oops.gui.remove(UIID.BattleHUD); - // 显示结算界面 - // oops.gui.open(isVictory ? UIID.Victory : UIID.Defeat); - // 结束战斗 - this.endBattle(); - } -} \ No newline at end of file diff --git a/assets/script/game/battle/BattleManager.ts.meta b/assets/script/game/battle/BattleManager.ts.meta deleted file mode 100644 index 8d19315e..00000000 --- a/assets/script/game/battle/BattleManager.ts.meta +++ /dev/null @@ -1,9 +0,0 @@ -{ - "ver": "4.0.23", - "importer": "typescript", - "imported": true, - "uuid": "0e6e9aa4-1bc4-49e7-a327-19d2318ac59b", - "files": [], - "subMetas": {}, - "userData": {} -} diff --git a/assets/script/game/battle/BattleManagerComp.ts b/assets/script/game/battle/BattleManagerComp.ts deleted file mode 100644 index 481c3fb9..00000000 --- a/assets/script/game/battle/BattleManagerComp.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS"; - -/** 战斗管理组件 */ -@ecs.register('BattleManager') -export class BattleManagerComp extends ecs.Comp { - /** 单例实例 */ - static instance: ecs.Entity; - - reset() { - BattleManagerComp.instance = this.ent; - } - -} \ No newline at end of file diff --git a/assets/script/game/battle/BattleManagerComp.ts.meta b/assets/script/game/battle/BattleManagerComp.ts.meta deleted file mode 100644 index 4189865f..00000000 --- a/assets/script/game/battle/BattleManagerComp.ts.meta +++ /dev/null @@ -1,9 +0,0 @@ -{ - "ver": "4.0.23", - "importer": "typescript", - "imported": true, - "uuid": "7ab0451e-efe7-4ec3-9d54-d7027a96e005", - "files": [], - "subMetas": {}, - "userData": {} -} diff --git a/assets/script/game/battle/BattlePhaseSystem.ts b/assets/script/game/battle/BattlePhaseSystem.ts deleted file mode 100644 index 087adad7..00000000 --- a/assets/script/game/battle/BattlePhaseSystem.ts +++ /dev/null @@ -1,53 +0,0 @@ -import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS"; -import { BattleStateComp } from "./BattleStateComp"; -import { BattleManager } from "./BattleManager"; - -@ecs.register('BattlePhaseSystem') -export class BattlePhaseSystem extends ecs.ComblockSystem { - filter(): ecs.IMatcher { - return ecs.allOf(BattleStateComp); - - } - - update(e: ecs.Entity) { - const state = e.get(BattleStateComp); - - switch(state.phase) { - case BattleStateComp.Phase.Preparation: - this.handlePreparation(state); - break; - case BattleStateComp.Phase.Fighting: - this.handleFighting(state); - break; - case BattleStateComp.Phase.Victory: - this.handleVictory(state); - break; - case BattleStateComp.Phase.Defeat: - this.handleDefeat(state); - break; - } - } - - private handlePreparation(state: BattleStateComp) { - // 准备阶段逻辑:角色选择、装备检查等 - if (state.startTime > 0) { - state.setPhase(BattleStateComp.Phase.Fighting); - } - } - - private handleFighting(state: BattleStateComp) { - // 实时战斗逻辑:由其他系统处理 - } - - private handleVictory(state: BattleStateComp) { - // 胜利结算逻辑 - BattleManager.endBattleWithUI(true); - state.setPhase(BattleStateComp.Phase.Preparation); - } - - private handleDefeat(state: BattleStateComp) { - // 失败结算逻辑 - BattleManager.endBattleWithUI(false); - state.setPhase(BattleStateComp.Phase.Preparation); - } -} \ No newline at end of file diff --git a/assets/script/game/battle/BattlePhaseSystem.ts.meta b/assets/script/game/battle/BattlePhaseSystem.ts.meta deleted file mode 100644 index 99b23dfe..00000000 --- a/assets/script/game/battle/BattlePhaseSystem.ts.meta +++ /dev/null @@ -1,9 +0,0 @@ -{ - "ver": "4.0.23", - "importer": "typescript", - "imported": true, - "uuid": "60eca3c6-1b6b-4090-a7f9-ca98a3f3c05d", - "files": [], - "subMetas": {}, - "userData": {} -} diff --git a/assets/script/game/battle/BattleStartSystem.ts b/assets/script/game/battle/BattleStartSystem.ts deleted file mode 100644 index 7e5487e5..00000000 --- a/assets/script/game/battle/BattleStartSystem.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS"; -import { BattleStateComp } from "./BattleStateComp"; -import { smc } from "../common/SingletonModuleComp"; - -@ecs.register('BattleStartSystem') -export class BattleStartSystem extends ecs.ComblockSystem { - filter(): ecs.IMatcher { - return ecs.allOf(BattleStateComp); - } - - update(e: ecs.Entity) { - const state = e.get(BattleStateComp); - if (state.startTime === 0) { - // 初始化战斗逻辑 - state.startTime = Date.now(); - - console.log(`战斗开始,关卡ID: ${state.missionId}`); - } - } -} \ No newline at end of file diff --git a/assets/script/game/battle/BattleStartSystem.ts.meta b/assets/script/game/battle/BattleStartSystem.ts.meta deleted file mode 100644 index 95066607..00000000 --- a/assets/script/game/battle/BattleStartSystem.ts.meta +++ /dev/null @@ -1,9 +0,0 @@ -{ - "ver": "4.0.23", - "importer": "typescript", - "imported": true, - "uuid": "7a7dfd93-aebc-4f85-b9b9-f1e355f23285", - "files": [], - "subMetas": {}, - "userData": {} -} diff --git a/assets/script/game/battle/BattleStateComp.ts b/assets/script/game/battle/BattleStateComp.ts deleted file mode 100644 index eb438044..00000000 --- a/assets/script/game/battle/BattleStateComp.ts +++ /dev/null @@ -1,43 +0,0 @@ -import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS"; - -/** 战斗状态组件 */ -@ecs.register('BattleState') -export class BattleStateComp extends ecs.Comp { - /** 战斗阶段枚举 */ - static Phase = { - Preparation: 0, // 准备阶段 - Fighting: 1, // 战斗中 - Victory: 2, // 胜利 - Defeat: 3 // 失败 - }; - - phase: number = BattleStateComp.Phase.Preparation; - /** 是否结束 */ - isEnded: boolean = false; - /** 当前关卡ID */ - missionId: number = 0; - /** 战斗开始时间戳 */ - startTime: number = 0; - - reset() { - this.isEnded = false; - this.missionId = 0; - this.startTime = 0; - } - - /** 安全状态转换 */ - setPhase(newPhase: number) { - const validTransitions = { - [BattleStateComp.Phase.Preparation]: [BattleStateComp.Phase.Fighting], - [BattleStateComp.Phase.Fighting]: [BattleStateComp.Phase.Victory, BattleStateComp.Phase.Defeat], - [BattleStateComp.Phase.Victory]: [BattleStateComp.Phase.Preparation], - [BattleStateComp.Phase.Defeat]: [BattleStateComp.Phase.Preparation] - }; - - if (validTransitions[this.phase]?.includes(newPhase)) { - this.phase = newPhase; - } else { - console.error(`Invalid phase transition from ${this.phase} to ${newPhase}`); - } - } -} \ No newline at end of file diff --git a/assets/script/game/battle/BattleStateComp.ts.meta b/assets/script/game/battle/BattleStateComp.ts.meta deleted file mode 100644 index 385caf60..00000000 --- a/assets/script/game/battle/BattleStateComp.ts.meta +++ /dev/null @@ -1,9 +0,0 @@ -{ - "ver": "4.0.23", - "importer": "typescript", - "imported": true, - "uuid": "9676b38a-0a44-491b-8107-1cd1a46b61e0", - "files": [], - "subMetas": {}, - "userData": {} -} diff --git a/assets/script/game/skill/EcsSkillSystem.ts b/assets/script/game/skill/EcsSkillSystem.ts index 172b7c35..45c977db 100644 --- a/assets/script/game/skill/EcsSkillSystem.ts +++ b/assets/script/game/skill/EcsSkillSystem.ts @@ -1,15 +1,9 @@ import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS"; import { HeroSkillSystem } from "./HeroSkillSystem"; -import { BattleEndSystem } from "../battle/BattleEndSystem"; -import { BattleStartSystem } from "../battle/BattleStartSystem"; -import { BattlePhaseSystem } from "../battle/BattlePhaseSystem"; export class EcsSkillSystem extends ecs.System { constructor() { super(); this.add(new HeroSkillSystem()); - this.add(new BattleStartSystem()); - this.add(new BattlePhaseSystem()); - this.add(new BattleEndSystem());