From 36a8aff783c916adf3b112eddf8bee65ead1f7b1 Mon Sep 17 00:00:00 2001 From: walkpan Date: Mon, 3 Feb 2025 22:02:26 +0800 Subject: [PATCH] =?UTF-8?q?=E6=88=98=E6=96=97=E7=AE=A1=E7=90=86=E7=B3=BB?= =?UTF-8?q?=E7=BB=9F=E5=9F=BA=E7=A1=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/resources/game/heros/top.prefab | 2 +- .../resources/game/skills/damageText.prefab | 290 ------------------ .../game/skills/damageText.prefab.meta | 13 - assets/resources/game/skills/tooltip.prefab | 10 +- assets/resources/gui/role_controller.prefab | 4 +- assets/script/common.meta | 9 - assets/script/game/battle/BattleEndSystem.ts | 33 +- assets/script/game/battle/BattleEntity.ts | 17 + .../BattleEntity.ts.meta} | 2 +- assets/script/game/battle/BattleManager.ts | 100 +++--- .../script/game/battle/BattleManagerComp.ts | 13 + .../BattleManagerComp.ts.meta} | 2 +- .../script/game/battle/BattlePhaseSystem.ts | 53 ++++ .../game/battle/BattlePhaseSystem.ts.meta | 9 + .../script/game/battle/BattleStartSystem.ts | 20 ++ .../game/battle/BattleStartSystem.ts.meta | 9 + assets/script/game/battle/BattleStateComp.ts | 36 ++- assets/script/game/common/config/heroSet.ts | 76 ++--- assets/script/game/damage/DamageShowSystem.ts | 96 ------ assets/script/game/damage/DamageSystem.ts | 66 +++- assets/script/game/damage/DamageText.ts | 17 - assets/script/game/hero/BuffComp.ts | 3 +- assets/script/game/hero/HeroViewComp.ts | 29 +- assets/script/game/map/MissionComp.ts | 58 ++-- assets/script/game/skill/EcsSkillSystem.ts | 7 +- assets/script/game/skill/HeroSkillSystem.ts | 14 +- assets/script/game/skills/TooltipCom.ts | 6 +- 27 files changed, 375 insertions(+), 619 deletions(-) delete mode 100644 assets/resources/game/skills/damageText.prefab delete mode 100644 assets/resources/game/skills/damageText.prefab.meta delete mode 100644 assets/script/common.meta create mode 100644 assets/script/game/battle/BattleEntity.ts rename assets/script/game/{damage/DamageShowSystem.ts.meta => battle/BattleEntity.ts.meta} (70%) create mode 100644 assets/script/game/battle/BattleManagerComp.ts rename assets/script/game/{damage/DamageText.ts.meta => battle/BattleManagerComp.ts.meta} (70%) create mode 100644 assets/script/game/battle/BattlePhaseSystem.ts create mode 100644 assets/script/game/battle/BattlePhaseSystem.ts.meta create mode 100644 assets/script/game/battle/BattleStartSystem.ts create mode 100644 assets/script/game/battle/BattleStartSystem.ts.meta delete mode 100644 assets/script/game/damage/DamageShowSystem.ts delete mode 100644 assets/script/game/damage/DamageText.ts diff --git a/assets/resources/game/heros/top.prefab b/assets/resources/game/heros/top.prefab index 74a4dec8..82b9836e 100644 --- a/assets/resources/game/heros/top.prefab +++ b/assets/resources/game/heros/top.prefab @@ -100,7 +100,7 @@ "_lpos": { "__type__": "cc.Vec3", "x": 0, - "y": -11.989, + "y": 0, "z": 0 }, "_lrot": { diff --git a/assets/resources/game/skills/damageText.prefab b/assets/resources/game/skills/damageText.prefab deleted file mode 100644 index 55831ad8..00000000 --- a/assets/resources/game/skills/damageText.prefab +++ /dev/null @@ -1,290 +0,0 @@ -[ - { - "__type__": "cc.Prefab", - "_name": "damageText", - "_objFlags": 0, - "__editorExtras__": {}, - "_native": "", - "data": { - "__id__": 1 - }, - "optimizationPolicy": 0, - "persistent": false - }, - { - "__type__": "cc.Node", - "_name": "damageText", - "_objFlags": 0, - "__editorExtras__": {}, - "_parent": null, - "_children": [ - { - "__id__": 2 - } - ], - "_active": true, - "_components": [ - { - "__id__": 8 - }, - { - "__id__": 10 - } - ], - "_prefab": { - "__id__": 12 - }, - "_lpos": { - "__type__": "cc.Vec3", - "x": 0, - "y": 0, - "z": 0 - }, - "_lrot": { - "__type__": "cc.Quat", - "x": 0, - "y": 0, - "z": 0, - "w": 1 - }, - "_lscale": { - "__type__": "cc.Vec3", - "x": 1, - "y": 1, - "z": 1 - }, - "_mobility": 0, - "_layer": 1, - "_euler": { - "__type__": "cc.Vec3", - "x": 0, - "y": 0, - "z": 0 - }, - "_id": "" - }, - { - "__type__": "cc.Node", - "_name": "DamageText", - "_objFlags": 0, - "__editorExtras__": {}, - "_parent": { - "__id__": 1 - }, - "_children": [], - "_active": true, - "_components": [ - { - "__id__": 3 - }, - { - "__id__": 5 - } - ], - "_prefab": { - "__id__": 7 - }, - "_lpos": { - "__type__": "cc.Vec3", - "x": 0, - "y": 0, - "z": 0 - }, - "_lrot": { - "__type__": "cc.Quat", - "x": 0, - "y": 0, - "z": 0, - "w": 1 - }, - "_lscale": { - "__type__": "cc.Vec3", - "x": 1, - "y": 1, - "z": 1 - }, - "_mobility": 0, - "_layer": 1, - "_euler": { - "__type__": "cc.Vec3", - "x": 0, - "y": 0, - "z": 0 - }, - "_id": "" - }, - { - "__type__": "cc.UITransform", - "_name": "", - "_objFlags": 0, - "__editorExtras__": {}, - "node": { - "__id__": 2 - }, - "_enabled": true, - "__prefab": { - "__id__": 4 - }, - "_contentSize": { - "__type__": "cc.Size", - "width": 22.61767578125, - "height": 39.8 - }, - "_anchorPoint": { - "__type__": "cc.Vec2", - "x": 0.5, - "y": 0.5 - }, - "_id": "" - }, - { - "__type__": "cc.CompPrefabInfo", - "fileId": "b2q8sfHG5IWKdfC5g/dDbk" - }, - { - "__type__": "cc.Label", - "_name": "", - "_objFlags": 0, - "__editorExtras__": {}, - "node": { - "__id__": 2 - }, - "_enabled": true, - "__prefab": { - "__id__": 6 - }, - "_customMaterial": null, - "_srcBlendFactor": 2, - "_dstBlendFactor": 4, - "_color": { - "__type__": "cc.Color", - "r": 255, - "g": 0, - "b": 0, - "a": 255 - }, - "_string": "10", - "_horizontalAlign": 1, - "_verticalAlign": 1, - "_actualFontSize": 25, - "_fontSize": 25, - "_fontFamily": "Arial", - "_lineHeight": 30, - "_overflow": 0, - "_enableWrapText": true, - "_font": { - "__uuid__": "a8f2a4a3-911f-43d3-9174-f2176554d7d4", - "__expectedType__": "cc.TTFFont" - }, - "_isSystemFontUsed": false, - "_spacingX": 0, - "_isItalic": false, - "_isBold": false, - "_isUnderline": false, - "_underlineHeight": 2, - "_cacheMode": 1, - "_enableOutline": true, - "_outlineColor": { - "__type__": "cc.Color", - "r": 0, - "g": 0, - "b": 0, - "a": 255 - }, - "_outlineWidth": 1, - "_enableShadow": false, - "_shadowColor": { - "__type__": "cc.Color", - "r": 0, - "g": 0, - "b": 0, - "a": 255 - }, - "_shadowOffset": { - "__type__": "cc.Vec2", - "x": 2, - "y": 2 - }, - "_shadowBlur": 2, - "_id": "" - }, - { - "__type__": "cc.CompPrefabInfo", - "fileId": "c7azLszJlJJ4fkJyxPrZYJ" - }, - { - "__type__": "cc.PrefabInfo", - "root": { - "__id__": 1 - }, - "asset": { - "__id__": 0 - }, - "fileId": "76Mh85YlFJNY/DWA9qkpBH", - "instance": null, - "targetOverrides": null, - "nestedPrefabInstanceRoots": null - }, - { - "__type__": "cc.UITransform", - "_name": "", - "_objFlags": 0, - "__editorExtras__": {}, - "node": { - "__id__": 1 - }, - "_enabled": true, - "__prefab": { - "__id__": 9 - }, - "_contentSize": { - "__type__": "cc.Size", - "width": 100, - "height": 100 - }, - "_anchorPoint": { - "__type__": "cc.Vec2", - "x": 0.5, - "y": 0.5 - }, - "_id": "" - }, - { - "__type__": "cc.CompPrefabInfo", - "fileId": "2fHdG8eeBH07DW0tmYrhH9" - }, - { - "__type__": "96d16N6LftMNLYMRBRGVsYW", - "_name": "", - "_objFlags": 0, - "__editorExtras__": {}, - "node": { - "__id__": 1 - }, - "_enabled": true, - "__prefab": { - "__id__": 11 - }, - "label": { - "__id__": 5 - }, - "critEffect": null, - "_id": "" - }, - { - "__type__": "cc.CompPrefabInfo", - "fileId": "8aOWJ+ZllPHKeljR7my1SB" - }, - { - "__type__": "cc.PrefabInfo", - "root": { - "__id__": 1 - }, - "asset": { - "__id__": 0 - }, - "fileId": "c46/YsCPVOJYA4mWEpNYRx", - "instance": null, - "targetOverrides": null - } -] \ No newline at end of file diff --git a/assets/resources/game/skills/damageText.prefab.meta b/assets/resources/game/skills/damageText.prefab.meta deleted file mode 100644 index 0f050e35..00000000 --- a/assets/resources/game/skills/damageText.prefab.meta +++ /dev/null @@ -1,13 +0,0 @@ -{ - "ver": "1.1.50", - "importer": "prefab", - "imported": true, - "uuid": "cd550fa0-4951-4d3c-a22e-c7ad5520ade4", - "files": [ - ".json" - ], - "subMetas": {}, - "userData": { - "syncNodeName": "damageText" - } -} diff --git a/assets/resources/game/skills/tooltip.prefab b/assets/resources/game/skills/tooltip.prefab index 4a872544..fb0b074a 100644 --- a/assets/resources/game/skills/tooltip.prefab +++ b/assets/resources/game/skills/tooltip.prefab @@ -224,9 +224,9 @@ "_dstBlendFactor": 4, "_color": { "__type__": "cc.Color", - "r": 255, - "g": 0, - "b": 0, + "r": 172, + "g": 166, + "b": 166, "a": 255 }, "_string": "10", @@ -628,7 +628,7 @@ "z": 1 }, "_mobility": 0, - "_layer": 1, + "_layer": 1073741824, "_euler": { "__type__": "cc.Vec3", "x": 0, @@ -678,7 +678,7 @@ "z": 1 }, "_mobility": 0, - "_layer": 1, + "_layer": 1073741824, "_euler": { "__type__": "cc.Vec3", "x": 0, diff --git a/assets/resources/gui/role_controller.prefab b/assets/resources/gui/role_controller.prefab index 63a1ce5f..640e55ef 100644 --- a/assets/resources/gui/role_controller.prefab +++ b/assets/resources/gui/role_controller.prefab @@ -2276,7 +2276,7 @@ "__id__": 384 } ], - "_active": false, + "_active": true, "_components": [ { "__id__": 616 @@ -34035,7 +34035,7 @@ "__id__": 1586 } ], - "_active": true, + "_active": false, "_components": [ { "__id__": 2336 diff --git a/assets/script/common.meta b/assets/script/common.meta deleted file mode 100644 index 4ddc7328..00000000 --- a/assets/script/common.meta +++ /dev/null @@ -1,9 +0,0 @@ -{ - "ver": "1.2.0", - "importer": "directory", - "imported": true, - "uuid": "7df2a856-04db-4d7e-8c91-90db8e4e63e9", - "files": [], - "subMetas": {}, - "userData": {} -} diff --git a/assets/script/game/battle/BattleEndSystem.ts b/assets/script/game/battle/BattleEndSystem.ts index a93d310c..8bb093e8 100644 --- a/assets/script/game/battle/BattleEndSystem.ts +++ b/assets/script/game/battle/BattleEndSystem.ts @@ -1,24 +1,37 @@ import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS"; -import { BattleState } from "./BattleStateComp"; +import { BattleStateComp } from "./BattleStateComp"; import { DamageResult } from "../damage/DamageComp"; +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(BattleState); - + return ecs.allOf(BattleStateComp); } update(e: ecs.Entity) { - const state = e.get(BattleState); + const state = e.get(BattleStateComp); if (state.isEnded) { - // 清理所有残留伤害组件 - ecs.query(ecs.allOf(DamageResult)).forEach(entity => { - entity.remove(DamageResult); - }); + // 清理战斗残留组件 + this.cleanComponents(); - // 重置战斗状态 - state.isEnded = false; + // 重置状态 + state.reset(); + console.log(`战斗结束,持续时间: ${Date.now() - state.startTime}ms`); } } + + private cleanComponents() { + console.log("cleanComponents"); + console.log("DamageResult",ecs.query(ecs.allOf(DamageResult))); + 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(DamageResult)).forEach(entity => entity.remove(DamageResult)); + 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/BattleEntity.ts b/assets/script/game/battle/BattleEntity.ts new file mode 100644 index 00000000..7087859c --- /dev/null +++ b/assets/script/game/battle/BattleEntity.ts @@ -0,0 +1,17 @@ +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/damage/DamageShowSystem.ts.meta b/assets/script/game/battle/BattleEntity.ts.meta similarity index 70% rename from assets/script/game/damage/DamageShowSystem.ts.meta rename to assets/script/game/battle/BattleEntity.ts.meta index 4bfd68fc..58ab5646 100644 --- a/assets/script/game/damage/DamageShowSystem.ts.meta +++ b/assets/script/game/battle/BattleEntity.ts.meta @@ -2,7 +2,7 @@ "ver": "4.0.23", "importer": "typescript", "imported": true, - "uuid": "9c86e3d7-f8da-4e74-b180-76fe3f1fda90", + "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 index 3d3c3460..7e0677b4 100644 --- a/assets/script/game/battle/BattleManager.ts +++ b/assets/script/game/battle/BattleManager.ts @@ -1,76 +1,46 @@ -import { oops } from "db://oops-framework/core/Oops"; import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS"; -import { BattleState } from "./BattleStateComp"; -import { smc } from "../common/SingletonModuleComp"; -import { GameEvent } from "../common/config/GameEvent"; - -@ecs.register('BattleManager') -export class BattleManager extends ecs.Entity { - private static _instance: BattleManager; - - static get instance(): BattleManager { - if (!this._instance) { - this._instance = new BattleManager(); - this._instance.add(BattleState); - } - return this._instance; +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]; } - /** 外部调用入口:开始新战斗 */ - startBattle(missionId: number) { - this.get(BattleState).isEnded = false; - // 加载关卡配置、生成敌人等 - smc.mission.load(missionId); + /** 启动战斗 */ + static startBattle(missionId: number) { + const entity = ecs.getEntity(BattleEntity); + entity.get(BattleStateComp).missionId = missionId; } - /** 外部调用入口:结束战斗 */ - endBattle() { - this.get(BattleState).isEnded = true; - } - - private initEvents() { - oops.message.on("HeroDead", this.onHeroDead, this); - oops.message.on("AllEnemyDead", this.onAllEnemyDead, this); - oops.message.on(GameEvent.MissionEnd, this.endBattle, this); - oops.message.on("BattleEndCheck", this.onBattleEndCheck, this); - } - - private onHeroDead() { - this.endBattle(); - } - - private onAllEnemyDead() { - this.endBattle(); - } - - private onBattleEndCheck() { - // 留空或添加实际需要的检测逻辑 - } -} - -@ecs.register('BattleManagerComp') -export class BattleManagerComp extends ecs.Comp { - reset() { - // 初始化战斗状态 - } -} - -export class BattleManagerSystem extends ecs.ComblockSystem { - filter(): ecs.IMatcher { - return ecs.allOf(BattleManagerComp); - } - - update(e: ecs.Entity) { - const state = e.get(BattleState); - if (state.isEnded) { - // 处理战斗结束逻辑 - this.onBattleEnd(e); + /** 结束战斗 */ + static endBattle() { + const entity = ecs.query(ecs.allOf(BattleStateComp))[0]; + if (entity) { + entity.get(BattleStateComp).isEnded = true; } } - private onBattleEnd(entity: ecs.Entity) { - // 发放奖励、保存进度等 - entity.destroy(); + /** 扩展:带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/BattleManagerComp.ts b/assets/script/game/battle/BattleManagerComp.ts new file mode 100644 index 00000000..481c3fb9 --- /dev/null +++ b/assets/script/game/battle/BattleManagerComp.ts @@ -0,0 +1,13 @@ +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/damage/DamageText.ts.meta b/assets/script/game/battle/BattleManagerComp.ts.meta similarity index 70% rename from assets/script/game/damage/DamageText.ts.meta rename to assets/script/game/battle/BattleManagerComp.ts.meta index 9d817ed2..4189865f 100644 --- a/assets/script/game/damage/DamageText.ts.meta +++ b/assets/script/game/battle/BattleManagerComp.ts.meta @@ -2,7 +2,7 @@ "ver": "4.0.23", "importer": "typescript", "imported": true, - "uuid": "96d1637a-2dfb-4c34-b60c-44144656c616", + "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 new file mode 100644 index 00000000..087adad7 --- /dev/null +++ b/assets/script/game/battle/BattlePhaseSystem.ts @@ -0,0 +1,53 @@ +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 new file mode 100644 index 00000000..99b23dfe --- /dev/null +++ b/assets/script/game/battle/BattlePhaseSystem.ts.meta @@ -0,0 +1,9 @@ +{ + "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 new file mode 100644 index 00000000..7e5487e5 --- /dev/null +++ b/assets/script/game/battle/BattleStartSystem.ts @@ -0,0 +1,20 @@ +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 new file mode 100644 index 00000000..95066607 --- /dev/null +++ b/assets/script/game/battle/BattleStartSystem.ts.meta @@ -0,0 +1,9 @@ +{ + "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 index d229f49a..eb438044 100644 --- a/assets/script/game/battle/BattleStateComp.ts +++ b/assets/script/game/battle/BattleStateComp.ts @@ -1,11 +1,43 @@ import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS"; +/** 战斗状态组件 */ @ecs.register('BattleState') -export class BattleState extends ecs.Comp { - isEnded: boolean = false; +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/common/config/heroSet.ts b/assets/script/game/common/config/heroSet.ts index de61f26b..7c078f53 100644 --- a/assets/script/game/common/config/heroSet.ts +++ b/assets/script/game/common/config/heroSet.ts @@ -67,266 +67,266 @@ export const HeroInfo = { hp:5120,hp_up:130,shp_up:100,def:100,def_up:16,sdef_up:50,ap:100,ap_up:6, sap_up:100,atp:1,vun:0,crit:20,crit_add:0,ucr:0,dodge:0,dis:180, a_cd:1,speed:80,lvexp:0,slvexp:0,slv:0,aexp:5,uaexp:2,cexp:5, - doexp:5,dexp:20,pw:0,pwm:150,pws:10,apw:2,uapw:1,cpw:5,dpw:5, + doexp:5,dexp:20,pw:0,pwm:100,pws:10,apw:2,uapw:1,cpw:5,dpw:5, dopw:5,wp:1001,arm:2001,ring:3001,shoes:4001, skills:[6005,6018],tals:["无","无","无","无","无"]}, 5002:{uuid:5002,name:"幻影剑豪",path:"k1",quality:3,kind:2,type:0, hp:4650,hp_up:130,shp_up:100,def:100,def_up:16,sdef_up:50,ap:100,ap_up:6, sap_up:100,atp:1,vun:0,crit:40,crit_add:0,ucr:0,dodge:0,dis:180, a_cd:1,speed:80,lvexp:0,slvexp:0,slv:0,aexp:5,uaexp:2,cexp:5, - doexp:5,dexp:20,pw:0,pwm:150,pws:10,apw:2,uapw:1,cpw:5,dpw:5, + doexp:5,dexp:20,pw:0,pwm:100,pws:10,apw:2,uapw:1,cpw:5,dpw:5, dopw:5,wp:1001,arm:2001,ring:3001,shoes:4001, skills:[6005,6024],tals:["无","无","无","无","无"]}, 5003:{uuid:5003,name:"战争领主",path:"k5",quality:3,kind:2,type:0, hp:5230,hp_up:130,shp_up:100,def:100,def_up:16,sdef_up:50,ap:100,ap_up:6, sap_up:100,atp:1,vun:0,crit:20,crit_add:0,ucr:0,dodge:0,dis:180, a_cd:1,speed:80,lvexp:0,slvexp:0,slv:0,aexp:5,uaexp:2,cexp:5, - doexp:5,dexp:20,pw:0,pwm:150,pws:10,apw:2,uapw:1,cpw:5,dpw:5, + doexp:5,dexp:20,pw:0,pwm:100,pws:10,apw:2,uapw:1,cpw:5,dpw:5, dopw:5,wp:1001,arm:2001,ring:3001,shoes:4001, skills:[6005,6027],tals:["无","无","无","无","无"]}, 5004:{uuid:5004,name:"混沌法师",path:"zh1",quality:3,kind:2,type:2, hp:6160,hp_up:110,shp_up:100,def:50,def_up:3,sdef_up:0,ap:100,ap_up:6, sap_up:100,atp:1,vun:0,crit:20,crit_add:0,ucr:0,dodge:0,dis:500, a_cd:1.5,speed:40,lvexp:0,slvexp:0,slv:0,aexp:6,uaexp:1,cexp:10, - doexp:10,dexp:20,pw:0,pwm:150,pws:10,apw:4,uapw:2,cpw:5,dpw:5, + doexp:10,dexp:20,pw:0,pwm:100,pws:10,apw:4,uapw:2,cpw:5,dpw:5, dopw:5,wp:1001,arm:2001,ring:3001,shoes:4001, skills:[6003,6031],tals:["无","无","无","无","无"]}, 5005:{uuid:5005,name:"火焰法师",path:"zh2",quality:3,kind:2,type:2, hp:3110,hp_up:110,shp_up:100,def:50,def_up:3,sdef_up:0,ap:150,ap_up:12, sap_up:100,atp:1,vun:0,crit:20,crit_add:0,ucr:0,dodge:0,dis:500, a_cd:1.5,speed:50,lvexp:0,slvexp:0,slv:0,aexp:6,uaexp:1,cexp:10, - doexp:10,dexp:20,pw:0,pwm:150,pws:10,apw:4,uapw:2,cpw:5,dpw:5, + doexp:10,dexp:20,pw:0,pwm:100,pws:10,apw:4,uapw:2,cpw:5,dpw:5, dopw:5,wp:1001,arm:2001,ring:3001,shoes:4001, skills:[6003,6013],tals:["无","无","无","无","无"]}, 5006:{uuid:5006,name:"风暴精灵",path:"m4",quality:3,kind:2,type:2, hp:3110,hp_up:110,shp_up:100,def:50,def_up:3,sdef_up:0,ap:150,ap_up:12, sap_up:100,atp:1,vun:0,crit:20,crit_add:0,ucr:0,dodge:0,dis:500, a_cd:1.5,speed:40,lvexp:0,slvexp:0,slv:0,aexp:6,uaexp:1,cexp:10, - doexp:10,dexp:20,pw:0,pwm:150,pws:10,apw:4,uapw:2,cpw:5,dpw:5, + doexp:10,dexp:20,pw:0,pwm:100,pws:10,apw:4,uapw:2,cpw:5,dpw:5, dopw:5,wp:1001,arm:2001,ring:3001,shoes:4001, skills:[6001,6016],tals:["无","无","无","无","无"]}, 5007:{uuid:5007,name:"生命圣者",path:"d1",quality:3,kind:2,type:2, hp:6220,hp_up:150,shp_up:100,def:50,def_up:3,sdef_up:0,ap:100,ap_up:6, sap_up:100,atp:1,vun:0,crit:20,crit_add:0,ucr:0,dodge:0,dis:500, a_cd:1.5,speed:40,lvexp:0,slvexp:0,slv:0,aexp:6,uaexp:1,cexp:10, - doexp:10,dexp:20,pw:0,pwm:150,pws:10,apw:4,uapw:2,cpw:5,dpw:5, + doexp:10,dexp:20,pw:0,pwm:100,pws:10,apw:4,uapw:2,cpw:5,dpw:5, dopw:5,wp:1001,arm:2001,ring:3001,shoes:4001, skills:[6003,6028],tals:["无","无","无","无","无"]}, 5008:{uuid:5008,name:"战争祭祀",path:"d2",quality:3,kind:2,type:2, hp:6010,hp_up:150,shp_up:100,def:50,def_up:3,sdef_up:0,ap:100,ap_up:6, sap_up:100,atp:1,vun:0,crit:20,crit_add:0,ucr:0,dodge:0,dis:500, a_cd:1.5,speed:40,lvexp:0,slvexp:0,slv:0,aexp:6,uaexp:1,cexp:10, - doexp:10,dexp:20,pw:0,pwm:150,pws:10,apw:4,uapw:2,cpw:5,dpw:5, + doexp:10,dexp:20,pw:0,pwm:100,pws:10,apw:4,uapw:2,cpw:5,dpw:5, dopw:5,wp:1001,arm:2001,ring:3001,shoes:4001, skills:[6003,6019],tals:["无","无","无","无","无"]}, 5009:{uuid:5009,name:"暴风射手",path:"a5",quality:3,kind:2,type:1, hp:3080,hp_up:110,shp_up:100,def:50,def_up:3,sdef_up:0,ap:150,ap_up:12, sap_up:100,atp:1,vun:0,crit:20,crit_add:0,ucr:0,dodge:0,dis:400, a_cd:1.2,speed:50,lvexp:0,slvexp:0,slv:0,aexp:6,uaexp:1,cexp:10, - doexp:10,dexp:20,pw:0,pwm:150,pws:10,apw:3,uapw:2,cpw:5,dpw:5, + doexp:10,dexp:20,pw:0,pwm:100,pws:10,apw:3,uapw:2,cpw:5,dpw:5, dopw:5,wp:1001,arm:2001,ring:3001,shoes:4001, skills:[6006,6034],tals:["无","无","无","无","无"]}, 5010:{uuid:5010,name:"苍穹射手",path:"a3",quality:3,kind:1,type:1, hp:3230,hp_up:110,shp_up:100,def:50,def_up:3,sdef_up:0,ap:150,ap_up:12, sap_up:100,atp:1,vun:0,crit:20,crit_add:0,ucr:0,dodge:0,dis:400, a_cd:1.2,speed:50,lvexp:0,slvexp:0,slv:0,aexp:6,uaexp:1,cexp:10, - doexp:10,dexp:20,pw:0,pwm:150,pws:10,apw:3,uapw:2,cpw:5,dpw:5, + doexp:10,dexp:20,pw:0,pwm:100,pws:10,apw:3,uapw:2,cpw:5,dpw:5, dopw:5,wp:1001,arm:2001,ring:3001,shoes:4001, skills:[6006,6014],tals:["无","无","无","无","无"]}, 5011:{uuid:5011,name:"幽灵射手",path:"a4",quality:3,kind:2,type:1, hp:3090,hp_up:110,shp_up:100,def:50,def_up:3,sdef_up:0,ap:150,ap_up:12, sap_up:100,atp:1,vun:0,crit:40,crit_add:0,ucr:0,dodge:0,dis:400, a_cd:1.2,speed:50,lvexp:0,slvexp:0,slv:0,aexp:6,uaexp:1,cexp:10, - doexp:10,dexp:20,pw:0,pwm:150,pws:10,apw:3,uapw:2,cpw:5,dpw:5, + doexp:10,dexp:20,pw:0,pwm:100,pws:10,apw:3,uapw:2,cpw:5,dpw:5, dopw:5,wp:1001,arm:2001,ring:3001,shoes:4001, skills:[6006,6021],tals:["无","无","无","无","无"]}, 5201:{uuid:5201,name:"兽人战士",path:"mor1",quality:1,kind:1,type:0, hp:5000,hp_up:110,shp_up:100,def:100,def_up:14,sdef_up:50,ap:100,ap_up:4, sap_up:100,atp:1,vun:0,crit:20,crit_add:0,ucr:0,dodge:0,dis:180, a_cd:1,speed:80,lvexp:0,slvexp:0,slv:0,aexp:5,uaexp:2,cexp:5, - doexp:5,dexp:20,pw:0,pwm:150,pws:10,apw:2,uapw:1,cpw:5,dpw:5, + doexp:5,dexp:20,pw:0,pwm:100,pws:10,apw:2,uapw:1,cpw:5,dpw:5, dopw:5,wp:1001,arm:2001,ring:3001,shoes:4001, skills:[6005,6005],tals:["无","无","无","无","无"]}, 5202:{uuid:5202,name:"兽人刺客",path:"mor2",quality:1,kind:1,type:0, hp:5000,hp_up:110,shp_up:100,def:100,def_up:14,sdef_up:50,ap:100,ap_up:4, sap_up:100,atp:1,vun:0,crit:20,crit_add:0,ucr:0,dodge:0,dis:180, a_cd:1,speed:80,lvexp:0,slvexp:0,slv:0,aexp:5,uaexp:2,cexp:5, - doexp:5,dexp:20,pw:0,pwm:150,pws:10,apw:2,uapw:1,cpw:5,dpw:5, + doexp:5,dexp:20,pw:0,pwm:100,pws:10,apw:2,uapw:1,cpw:5,dpw:5, dopw:5,wp:1001,arm:2001,ring:3001,shoes:4001, skills:[6005,6005],tals:["无","无","无","无","无"]}, 5203:{uuid:5203,name:"兽人护卫",path:"mor3",quality:1,kind:1,type:1, hp:3000,hp_up:90,shp_up:100,def:50,def_up:2,sdef_up:0,ap:150,ap_up:9, sap_up:100,atp:1,vun:0,crit:20,crit_add:0,ucr:0,dodge:0,dis:400, a_cd:1.2,speed:50,lvexp:0,slvexp:0,slv:0,aexp:6,uaexp:1,cexp:10, - doexp:10,dexp:20,pw:0,pwm:150,pws:10,apw:3,uapw:2,cpw:5,dpw:5, + doexp:10,dexp:20,pw:0,pwm:100,pws:10,apw:3,uapw:2,cpw:5,dpw:5, dopw:5,wp:1001,arm:2001,ring:3001,shoes:4001, skills:[6007,6007],tals:["无","无","无","无","无"]}, 5204:{uuid:5204,name:"石卫",path:"mgem1",quality:1,kind:1,type:0, hp:5000,hp_up:110,shp_up:100,def:100,def_up:14,sdef_up:50,ap:100,ap_up:4, sap_up:100,atp:1,vun:0,crit:20,crit_add:0,ucr:0,dodge:0,dis:180, a_cd:1,speed:80,lvexp:0,slvexp:0,slv:0,aexp:5,uaexp:2,cexp:5, - doexp:5,dexp:20,pw:0,pwm:150,pws:10,apw:2,uapw:1,cpw:5,dpw:5, + doexp:5,dexp:20,pw:0,pwm:100,pws:10,apw:2,uapw:1,cpw:5,dpw:5, dopw:5,wp:1001,arm:2001,ring:3001,shoes:4001, skills:[6005,6005],tals:["无","无","无","无","无"]}, 5205:{uuid:5205,name:"土卫",path:"mgem2",quality:1,kind:1,type:0, hp:5000,hp_up:110,shp_up:100,def:100,def_up:14,sdef_up:50,ap:100,ap_up:4, sap_up:100,atp:1,vun:0,crit:20,crit_add:0,ucr:0,dodge:0,dis:180, a_cd:1,speed:80,lvexp:0,slvexp:0,slv:0,aexp:5,uaexp:2,cexp:5, - doexp:5,dexp:20,pw:0,pwm:150,pws:10,apw:2,uapw:1,cpw:5,dpw:5, + doexp:5,dexp:20,pw:0,pwm:100,pws:10,apw:2,uapw:1,cpw:5,dpw:5, dopw:5,wp:1001,arm:2001,ring:3001,shoes:4001, skills:[6005,6005],tals:["无","无","无","无","无"]}, 5206:{uuid:5206,name:"树人",path:"mgem3",quality:1,kind:1,type:0, hp:5000,hp_up:110,shp_up:100,def:100,def_up:14,sdef_up:50,ap:100,ap_up:4, sap_up:100,atp:1,vun:0,crit:20,crit_add:0,ucr:0,dodge:0,dis:180, a_cd:1,speed:80,lvexp:0,slvexp:0,slv:0,aexp:5,uaexp:2,cexp:5, - doexp:5,dexp:20,pw:0,pwm:150,pws:10,apw:2,uapw:1,cpw:5,dpw:5, + doexp:5,dexp:20,pw:0,pwm:100,pws:10,apw:2,uapw:1,cpw:5,dpw:5, dopw:5,wp:1001,arm:2001,ring:3001,shoes:4001, skills:[6005,6005],tals:["无","无","无","无","无"]}, 5207:{uuid:5207,name:"小骷髅",path:"mkl1",quality:1,kind:1,type:0, hp:5000,hp_up:110,shp_up:100,def:100,def_up:14,sdef_up:50,ap:100,ap_up:4, sap_up:100,atp:1,vun:0,crit:20,crit_add:0,ucr:0,dodge:0,dis:180, a_cd:1,speed:80,lvexp:0,slvexp:0,slv:0,aexp:5,uaexp:2,cexp:5, - doexp:5,dexp:20,pw:0,pwm:150,pws:10,apw:2,uapw:1,cpw:5,dpw:5, + doexp:5,dexp:20,pw:0,pwm:100,pws:10,apw:2,uapw:1,cpw:5,dpw:5, dopw:5,wp:1001,arm:2001,ring:3001,shoes:4001, skills:[6005,6005],tals:["无","无","无","无","无"]}, 5208:{uuid:5208,name:"小骷髅",path:"mkl2",quality:1,kind:1,type:0, hp:5000,hp_up:110,shp_up:100,def:100,def_up:14,sdef_up:50,ap:100,ap_up:4, sap_up:100,atp:1,vun:0,crit:20,crit_add:0,ucr:0,dodge:0,dis:180, a_cd:1,speed:80,lvexp:0,slvexp:0,slv:0,aexp:5,uaexp:2,cexp:5, - doexp:5,dexp:20,pw:0,pwm:150,pws:10,apw:2,uapw:1,cpw:5,dpw:5, + doexp:5,dexp:20,pw:0,pwm:100,pws:10,apw:2,uapw:1,cpw:5,dpw:5, dopw:5,wp:1001,arm:2001,ring:3001,shoes:4001, skills:[6005,6005],tals:["无","无","无","无","无"]}, 5209:{uuid:5209,name:"小骷髅",path:"mkl3",quality:1,kind:1,type:0, hp:5000,hp_up:110,shp_up:100,def:100,def_up:14,sdef_up:50,ap:100,ap_up:4, sap_up:100,atp:1,vun:0,crit:20,crit_add:0,ucr:0,dodge:0,dis:180, a_cd:1,speed:80,lvexp:0,slvexp:0,slv:0,aexp:5,uaexp:2,cexp:5, - doexp:5,dexp:20,pw:0,pwm:150,pws:10,apw:2,uapw:1,cpw:5,dpw:5, + doexp:5,dexp:20,pw:0,pwm:100,pws:10,apw:2,uapw:1,cpw:5,dpw:5, dopw:5,wp:1001,arm:2001,ring:3001,shoes:4001, skills:[6005,6005],tals:["无","无","无","无","无"]}, 5210:{uuid:5210,name:"骷髅战士",path:"mkl4",quality:1,kind:1,type:0, hp:5000,hp_up:110,shp_up:100,def:100,def_up:14,sdef_up:50,ap:100,ap_up:4, sap_up:100,atp:1,vun:0,crit:20,crit_add:0,ucr:0,dodge:0,dis:180, a_cd:1,speed:80,lvexp:0,slvexp:0,slv:0,aexp:5,uaexp:2,cexp:5, - doexp:5,dexp:20,pw:0,pwm:150,pws:10,apw:2,uapw:1,cpw:5,dpw:5, + doexp:5,dexp:20,pw:0,pwm:100,pws:10,apw:2,uapw:1,cpw:5,dpw:5, dopw:5,wp:1001,arm:2001,ring:3001,shoes:4001, skills:[6005,6005],tals:["无","无","无","无","无"]}, 5211:{uuid:5211,name:"骷髅战士",path:"mkl5",quality:1,kind:1,type:0, hp:5000,hp_up:110,shp_up:100,def:100,def_up:14,sdef_up:50,ap:100,ap_up:4, sap_up:100,atp:1,vun:0,crit:20,crit_add:0,ucr:0,dodge:0,dis:180, a_cd:1,speed:80,lvexp:0,slvexp:0,slv:0,aexp:5,uaexp:2,cexp:5, - doexp:5,dexp:20,pw:0,pwm:150,pws:10,apw:2,uapw:1,cpw:5,dpw:5, + doexp:5,dexp:20,pw:0,pwm:100,pws:10,apw:2,uapw:1,cpw:5,dpw:5, dopw:5,wp:1001,arm:2001,ring:3001,shoes:4001, skills:[6005,6005],tals:["无","无","无","无","无"]}, 5212:{uuid:5212,name:"骷髅战士",path:"mkl6",quality:1,kind:1,type:0, hp:5000,hp_up:110,shp_up:100,def:100,def_up:14,sdef_up:50,ap:100,ap_up:4, sap_up:100,atp:1,vun:0,crit:20,crit_add:0,ucr:0,dodge:0,dis:180, a_cd:1,speed:80,lvexp:0,slvexp:0,slv:0,aexp:5,uaexp:2,cexp:5, - doexp:5,dexp:20,pw:0,pwm:150,pws:10,apw:2,uapw:1,cpw:5,dpw:5, + doexp:5,dexp:20,pw:0,pwm:100,pws:10,apw:2,uapw:1,cpw:5,dpw:5, dopw:5,wp:1001,arm:2001,ring:3001,shoes:4001, skills:[6005,6005],tals:["无","无","无","无","无"]}, 5213:{uuid:5213,name:"骷髅射手",path:"mkla1",quality:1,kind:1,type:1, hp:3000,hp_up:90,shp_up:100,def:50,def_up:2,sdef_up:0,ap:150,ap_up:9, sap_up:100,atp:1,vun:0,crit:20,crit_add:0,ucr:0,dodge:0,dis:400, a_cd:1.2,speed:50,lvexp:0,slvexp:0,slv:0,aexp:6,uaexp:1,cexp:10, - doexp:10,dexp:20,pw:0,pwm:150,pws:10,apw:3,uapw:2,cpw:5,dpw:5, + doexp:10,dexp:20,pw:0,pwm:100,pws:10,apw:3,uapw:2,cpw:5,dpw:5, dopw:5,wp:1001,arm:2001,ring:3001,shoes:4001, skills:[6005,6005],tals:["无","无","无","无","无"]}, 5214:{uuid:5214,name:"骷髅射手",path:"mkla2",quality:1,kind:1,type:1, hp:3000,hp_up:90,shp_up:100,def:50,def_up:2,sdef_up:0,ap:150,ap_up:9, sap_up:100,atp:1,vun:0,crit:20,crit_add:0,ucr:0,dodge:0,dis:400, a_cd:1.2,speed:50,lvexp:0,slvexp:0,slv:0,aexp:6,uaexp:1,cexp:10, - doexp:10,dexp:20,pw:0,pwm:150,pws:10,apw:3,uapw:2,cpw:5,dpw:5, + doexp:10,dexp:20,pw:0,pwm:100,pws:10,apw:3,uapw:2,cpw:5,dpw:5, dopw:5,wp:1001,arm:2001,ring:3001,shoes:4001, skills:[6005,6005],tals:["无","无","无","无","无"]}, 5215:{uuid:5215,name:"骷髅射手",path:"mkla3",quality:1,kind:1,type:1, hp:3000,hp_up:90,shp_up:100,def:50,def_up:2,sdef_up:0,ap:150,ap_up:9, sap_up:100,atp:1,vun:0,crit:20,crit_add:0,ucr:0,dodge:0,dis:400, a_cd:1.2,speed:50,lvexp:0,slvexp:0,slv:0,aexp:6,uaexp:1,cexp:10, - doexp:10,dexp:20,pw:0,pwm:150,pws:10,apw:3,uapw:2,cpw:5,dpw:5, + doexp:10,dexp:20,pw:0,pwm:100,pws:10,apw:3,uapw:2,cpw:5,dpw:5, dopw:5,wp:1001,arm:2001,ring:3001,shoes:4001, skills:[6005,6005],tals:["无","无","无","无","无"]}, 5216:{uuid:5216,name:"元素1",path:"my1",quality:2,kind:1,type:2, hp:3000,hp_up:100,shp_up:100,def:50,def_up:2,sdef_up:0,ap:150,ap_up:10, sap_up:100,atp:1,vun:0,crit:20,crit_add:0,ucr:0,dodge:0,dis:500, a_cd:1.5,speed:40,lvexp:0,slvexp:0,slv:0,aexp:6,uaexp:1,cexp:10, - doexp:10,dexp:20,pw:0,pwm:150,pws:10,apw:3,uapw:2,cpw:5,dpw:5, + doexp:10,dexp:20,pw:0,pwm:100,pws:10,apw:3,uapw:2,cpw:5,dpw:5, dopw:5,wp:1001,arm:2001,ring:3001,shoes:4001, skills:[6001,6001],tals:["无","无","无","无","无"]}, 5217:{uuid:5217,name:"元素2",path:"my2",quality:2,kind:1,type:2, hp:3000,hp_up:100,shp_up:100,def:50,def_up:2,sdef_up:0,ap:150,ap_up:10, sap_up:100,atp:1,vun:0,crit:20,crit_add:0,ucr:0,dodge:0,dis:500, a_cd:1.5,speed:40,lvexp:0,slvexp:0,slv:0,aexp:6,uaexp:1,cexp:10, - doexp:10,dexp:20,pw:0,pwm:150,pws:10,apw:3,uapw:2,cpw:5,dpw:5, + doexp:10,dexp:20,pw:0,pwm:100,pws:10,apw:3,uapw:2,cpw:5,dpw:5, dopw:5,wp:1001,arm:2001,ring:3001,shoes:4001, skills:[6002,6002],tals:["无","无","无","无","无"]}, 5218:{uuid:5218,name:"元素3",path:"my3",quality:2,kind:1,type:2, hp:3000,hp_up:100,shp_up:100,def:50,def_up:2,sdef_up:0,ap:150,ap_up:10, sap_up:100,atp:1,vun:0,crit:20,crit_add:0,ucr:0,dodge:0,dis:500, a_cd:1.5,speed:40,lvexp:0,slvexp:0,slv:0,aexp:6,uaexp:1,cexp:10, - doexp:10,dexp:20,pw:0,pwm:150,pws:10,apw:3,uapw:2,cpw:5,dpw:5, + doexp:10,dexp:20,pw:0,pwm:100,pws:10,apw:3,uapw:2,cpw:5,dpw:5, dopw:5,wp:1001,arm:2001,ring:3001,shoes:4001, skills:[6003,6003],tals:["无","无","无","无","无"]}, 5219:{uuid:5219,name:"牛头战士",path:"mn1",quality:2,kind:1,type:0, hp:5000,hp_up:120,shp_up:100,def:100,def_up:15,sdef_up:50,ap:100,ap_up:5, sap_up:100,atp:1,vun:0,crit:20,crit_add:0,ucr:0,dodge:0,dis:180, a_cd:1,speed:80,lvexp:0,slvexp:0,slv:0,aexp:5,uaexp:2,cexp:5, - doexp:5,dexp:20,pw:0,pwm:150,pws:10,apw:2,uapw:1,cpw:5,dpw:5, + doexp:5,dexp:20,pw:0,pwm:100,pws:10,apw:2,uapw:1,cpw:5,dpw:5, dopw:5,wp:1001,arm:2001,ring:3001,shoes:4001, skills:[6005,6005],tals:["无","无","无","无","无"]}, 5220:{uuid:5220,name:"牛头战士",path:"mn2",quality:1,kind:1,type:1, hp:3000,hp_up:90,shp_up:100,def:50,def_up:2,sdef_up:0,ap:150,ap_up:9, sap_up:100,atp:1,vun:0,crit:20,crit_add:0,ucr:0,dodge:0,dis:400, a_cd:1.2,speed:50,lvexp:0,slvexp:0,slv:0,aexp:6,uaexp:1,cexp:10, - doexp:10,dexp:20,pw:0,pwm:150,pws:10,apw:3,uapw:2,cpw:5,dpw:5, + doexp:10,dexp:20,pw:0,pwm:100,pws:10,apw:3,uapw:2,cpw:5,dpw:5, dopw:5,wp:1001,arm:2001,ring:3001,shoes:4001, skills:[6010,6010],tals:["无","无","无","无","无"]}, 5221:{uuid:5221,name:"牛头战士",path:"mn3",quality:1,kind:1,type:0, hp:5000,hp_up:110,shp_up:100,def:100,def_up:14,sdef_up:50,ap:100,ap_up:4, sap_up:100,atp:1,vun:0,crit:20,crit_add:0,ucr:0,dodge:0,dis:180, a_cd:1,speed:80,lvexp:0,slvexp:0,slv:0,aexp:5,uaexp:2,cexp:5, - doexp:5,dexp:20,pw:0,pwm:150,pws:10,apw:2,uapw:1,cpw:5,dpw:5, + doexp:5,dexp:20,pw:0,pwm:100,pws:10,apw:2,uapw:1,cpw:5,dpw:5, dopw:5,wp:1001,arm:2001,ring:3001,shoes:4001, skills:[6005,6005],tals:["无","无","无","无","无"]}, 5222:{uuid:5222,name:"独眼巨人",path:"md1",quality:1,kind:1,type:0, hp:5000,hp_up:110,shp_up:100,def:100,def_up:14,sdef_up:50,ap:100,ap_up:4, sap_up:100,atp:1,vun:0,crit:20,crit_add:0,ucr:0,dodge:0,dis:180, a_cd:1,speed:80,lvexp:0,slvexp:0,slv:0,aexp:5,uaexp:2,cexp:5, - doexp:5,dexp:20,pw:0,pwm:150,pws:10,apw:2,uapw:1,cpw:5,dpw:5, + doexp:5,dexp:20,pw:0,pwm:100,pws:10,apw:2,uapw:1,cpw:5,dpw:5, dopw:5,wp:1001,arm:2001,ring:3001,shoes:4001, skills:[6005,6005],tals:["无","无","无","无","无"]}, 5223:{uuid:5223,name:"独眼巨人",path:"md2",quality:1,kind:1,type:0, hp:5000,hp_up:110,shp_up:100,def:100,def_up:14,sdef_up:50,ap:100,ap_up:4, sap_up:100,atp:1,vun:0,crit:20,crit_add:0,ucr:0,dodge:0,dis:180, a_cd:1,speed:80,lvexp:0,slvexp:0,slv:0,aexp:5,uaexp:2,cexp:5, - doexp:5,dexp:20,pw:0,pwm:150,pws:10,apw:2,uapw:1,cpw:5,dpw:5, + doexp:5,dexp:20,pw:0,pwm:100,pws:10,apw:2,uapw:1,cpw:5,dpw:5, dopw:5,wp:1001,arm:2001,ring:3001,shoes:4001, skills:[6008,6008],tals:["无","无","无","无","无"]}, 5224:{uuid:5224,name:"独眼巨人",path:"md3",quality:1,kind:1,type:1, hp:3000,hp_up:90,shp_up:100,def:50,def_up:2,sdef_up:0,ap:150,ap_up:9, sap_up:100,atp:1,vun:0,crit:20,crit_add:0,ucr:0,dodge:0,dis:400, a_cd:1.2,speed:50,lvexp:0,slvexp:0,slv:0,aexp:6,uaexp:1,cexp:10, - doexp:10,dexp:20,pw:0,pwm:150,pws:10,apw:3,uapw:2,cpw:5,dpw:5, + doexp:10,dexp:20,pw:0,pwm:100,pws:10,apw:3,uapw:2,cpw:5,dpw:5, dopw:5,wp:1001,arm:2001,ring:3001,shoes:4001, skills:[6005,6005],tals:["无","无","无","无","无"]}, 5225:{uuid:5225,name:"精英独眼",path:"md4",quality:3,kind:1,type:2, hp:6000,hp_up:110,shp_up:100,def:50,def_up:3,sdef_up:0,ap:150,ap_up:12, sap_up:100,atp:1,vun:0,crit:20,crit_add:0,ucr:0,dodge:0,dis:500, a_cd:1,speed:40,lvexp:0,slvexp:0,slv:0,aexp:6,uaexp:1,cexp:10, - doexp:10,dexp:20,pw:0,pwm:150,pws:10,apw:3,uapw:2,cpw:5,dpw:5, + doexp:10,dexp:20,pw:0,pwm:100,pws:10,apw:3,uapw:2,cpw:5,dpw:5, dopw:5,wp:1001,arm:2001,ring:3001,shoes:4001, skills:[6009,6009],tals:["无","无","无","无","无"]}, 5226:{uuid:5226,name:"精英牛头",path:"mn4",quality:3,kind:1,type:2, hp:6000,hp_up:110,shp_up:100,def:50,def_up:3,sdef_up:0,ap:150,ap_up:12, sap_up:100,atp:1,vun:0,crit:20,crit_add:0,ucr:0,dodge:0,dis:500, a_cd:1,speed:40,lvexp:0,slvexp:0,slv:0,aexp:6,uaexp:1,cexp:10, - doexp:10,dexp:20,pw:0,pwm:150,pws:10,apw:3,uapw:2,cpw:5,dpw:5, + doexp:10,dexp:20,pw:0,pwm:100,pws:10,apw:3,uapw:2,cpw:5,dpw:5, dopw:5,wp:1001,arm:2001,ring:3001,shoes:4001, skills:[6010,6010],tals:["无","无","无","无","无"]}, 5227:{uuid:5227,name:"精英兽人",path:"mor4",quality:3,kind:1,type:2, hp:6000,hp_up:110,shp_up:100,def:50,def_up:3,sdef_up:0,ap:150,ap_up:12, sap_up:100,atp:1,vun:0,crit:20,crit_add:0,ucr:0,dodge:0,dis:500, a_cd:1,speed:40,lvexp:0,slvexp:0,slv:0,aexp:6,uaexp:1,cexp:10, - doexp:10,dexp:20,pw:0,pwm:150,pws:10,apw:3,uapw:2,cpw:5,dpw:5, + doexp:10,dexp:20,pw:0,pwm:100,pws:10,apw:3,uapw:2,cpw:5,dpw:5, dopw:5,wp:1001,arm:2001,ring:3001,shoes:4001, skills:[6009,6009],tals:["无","无","无","无","无"]} }; \ No newline at end of file diff --git a/assets/script/game/damage/DamageShowSystem.ts b/assets/script/game/damage/DamageShowSystem.ts deleted file mode 100644 index 29cd8ea0..00000000 --- a/assets/script/game/damage/DamageShowSystem.ts +++ /dev/null @@ -1,96 +0,0 @@ -import { _decorator, NodePool, Node, Label, Color, tween, Vec3, instantiate, Prefab, resources } from "cc"; -import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS"; -import { DamageResult } from "./DamageComp"; -import { oops } from "../../../../extensions/oops-plugin-framework/assets/core/Oops"; -import { DamageText } from "./DamageText"; - -@ecs.register('DamageShowSystem') -export class DamageShowSystem extends ecs.ComblockSystem implements ecs.ISystemUpdate{ - private _pool: NodePool = new NodePool(); - private _timers: Set = new Set(); - private _prefab: Prefab | null = null; - - init() { - // 使用原生资源加载 - resources.load("game/skills/damageText", Prefab, (err, prefab) => { - if (err) { - console.error("预制体加载失败:", err); - return; - } - this._prefab = prefab; - console.log("预制体加载成功:", this._prefab); - // 初始化对象池 - for (let i = 0; i < 10; i++) { - const node = instantiate(this._prefab!); - this._pool.put(node); - } - }); - } - - filter(): ecs.IMatcher { - return ecs.allOf(DamageResult); - } - - update(e: ecs.Entity) { - const res = e.get(DamageResult); - this.scheduleShow(res); - e.remove(DamageResult); - } - - private scheduleShow(res: DamageResult) { - const timer = setTimeout(() => { - let node = this._pool.get(); - if (!node || !node.isValid) { - node = instantiate(this._prefab); - } - - const damageText = node.getComponent(DamageText); - - if (!damageText) { - console.error("Damage text prefab must have DamageText component!"); - return; - } - - this.setupText(node, res); - this.playAnimation(node, res.position); - - this._timers.delete(timer); - }, res.delay * 1000); - - this._timers.add(timer); - } - - private setupText(node: Node, res: DamageResult) { - const damageText = node.getComponent(DamageText)!; - const label = damageText.label; - - if (res.isDodged) { - label.string = "Miss"; - label.color = Color.GRAY; - return; - } - - label.string = Math.round(res.value).toString(); - label.color = res.isCrit ? Color.RED : Color.WHITE; - damageText.playEffect(res.isCrit); - } - - private playAnimation(node: Node, position: Vec3) { - node.setPosition(position); - tween(node) - .by(0.5, { position: new Vec3(0, 100, 0) }) - .call(() => { - if (this._pool.size() < 20) { // 控制最大缓存数量 - this._pool.put(node); - } else { - node.destroy(); - } - }) - .start(); - } - - onDestroy() { - this._timers.forEach(clearTimeout); - this._pool.clear(); - } -} \ No newline at end of file diff --git a/assets/script/game/damage/DamageSystem.ts b/assets/script/game/damage/DamageSystem.ts index 2ddd324b..3374f932 100644 --- a/assets/script/game/damage/DamageSystem.ts +++ b/assets/script/game/damage/DamageSystem.ts @@ -23,8 +23,13 @@ export class DamageSystem extends ecs.ComblockSystem implements ecs.ISystemUpdat const sourceView = req.source.get(HeroViewComp); let final = req.baseValue; + // 伤害浮动(±10%) + const damageFloat = 0.9 + Math.random() * 0.2; // 0.9~1.1 + final *= damageFloat; + final = Math.round(final); + // 闪避判定 - if (Math.random() < targetView.dodge) { + if (Math.random()*100 < targetView.dodge) { const result = new DamageResult(); result.isDodged = true; return result; @@ -32,21 +37,24 @@ export class DamageSystem extends ecs.ComblockSystem implements ecs.ISystemUpdat // 护甲减伤 if (!req.ignoreDefense) { - final -= targetView.def * 0.5; + const effectiveArmor = Math.min(targetView.def, 300); // 最大减伤75% + const damageReduction = effectiveArmor / (effectiveArmor + 100); + final *= (1 - damageReduction); + final = Math.round(final); // 四舍五入取整 } // 暴击判定 let isCrit = false; if (req.canCrit) { const critRate = sourceView.crit; - if (Math.random() < critRate) { + if (Math.random() * 100 < critRate) { final *= 1.5; isCrit = true; } } const result = new DamageResult(); - result.value = Math.max(0, final); + result.value = Math.max(1, final); // 确保最小伤害为1 result.isCrit = isCrit; result.position = req.target.get(HeroViewComp).node.position; result.delay = req.delay; @@ -55,20 +63,52 @@ export class DamageSystem extends ecs.ComblockSystem implements ecs.ISystemUpdat private applyDamage(target: ecs.Entity, result: DamageResult) { const view = target.get(HeroViewComp); - view.hp -= result.value; - // 添加伤害结果组件 - const comp = target.add(DamageResult); - comp.value = result.value; - comp.isCrit = result.isCrit; - comp.position = result.position; - comp.delay = result.delay; - comp.isDodged = result.isDodged; + if (!view.ent.has(HeroViewComp)) return; + this.scheduleOnce(()=>{ + // 护盾优先吸收伤害 + let remainingDamage = result.value; + if(result.isDodged){ + view.BUFFCOMP.tooltip(5,"*闪避*"); + return; + } + if (view.shield > 0) { + const shieldAbsorb = Math.min(view.shield, remainingDamage); + view.shield -= shieldAbsorb; + remainingDamage -= shieldAbsorb; + + if (view.shield <= 0) { + view.BUFFCOMP.show_shield(false); + } + } + + // 剩余伤害扣除血量 + if (remainingDamage > 0) { + view.hp -= remainingDamage; + view.showDamage(result.value, result.isCrit); + }else{ + view.BUFFCOMP.tooltip(5,"*吸收*"); + } + - // 触发伤害事件 + }, result.delay) + + // 直接触发事件 oops.message.dispatchEvent("OnDamage", { target, damage: result.value, isCrit: result.isCrit }); } + + private scheduleOnce(callback: () => void, delay: number) { + const timer = setTimeout(() => { + callback(); + delete this._timers[timer]; + }, delay * 1000); + this._timers[timer] = timer; + } + + onDestroy() { + Object.values(this._timers).forEach(clearTimeout); + } } \ No newline at end of file diff --git a/assets/script/game/damage/DamageText.ts b/assets/script/game/damage/DamageText.ts deleted file mode 100644 index 748a4c91..00000000 --- a/assets/script/game/damage/DamageText.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { _decorator, Component, Label, ParticleSystem } from "cc"; -const { ccclass, property } = _decorator; - -@ccclass('DamageText') -export class DamageText extends Component { - @property(Label) - label: Label = null!; - - @property(ParticleSystem) - critEffect: ParticleSystem = null!; - - playEffect(isCrit: boolean) { - if (isCrit && this.critEffect) { - this.critEffect.play(); - } - } -} \ No newline at end of file diff --git a/assets/script/game/hero/BuffComp.ts b/assets/script/game/hero/BuffComp.ts index 807127f7..6bfc132d 100644 --- a/assets/script/game/hero/BuffComp.ts +++ b/assets/script/game/hero/BuffComp.ts @@ -36,7 +36,8 @@ export class BuffComp extends Component { // this.node.getChildByName("top").getChildByName("buff").getChildByName("cd").active = false; // this.node.getChildByName("top").getChildByName("buff").getChildByName("def").active = false; // this.node.getChildByName("top").getChildByName("buff").getChildByName("hp").active = false; - // this.node.getChildByName("top").getChildByName("buff").getChildByName("crit").active = false; + let hp_node = this.node.getChildByName("top").getChildByName("hp"); + hp_node.setPosition(hp_node.position.x,hp_node.position.y-140) } update(deltaTime: number) { diff --git a/assets/script/game/hero/HeroViewComp.ts b/assets/script/game/hero/HeroViewComp.ts index 99c56df1..47d4eca6 100644 --- a/assets/script/game/hero/HeroViewComp.ts +++ b/assets/script/game/hero/HeroViewComp.ts @@ -14,6 +14,7 @@ import { BuffComp } from "./BuffComp"; import { MonModelComp } from "./MonModelComp"; import { getMonsterDrops, MonsterType } from "../common/config/RewardSet"; import { HeroSkillsComp } from "../skill/heroSkillsComp"; +import { DamageResult } from "../damage/DamageComp"; const { ccclass, property } = _decorator; @@ -149,16 +150,19 @@ export class HeroViewComp extends CCComp { this.in_stop(dt); } - + get isActive() { + return this.ent.has(HeroViewComp) && this.node?.isValid; + } hp_show(){ let hp_progress= this.hp/this.hp_max; this.node.getChildByName("top").getChildByName("hp").getComponent(ProgressBar)!.progress = hp_progress; if(this.is_boss) return - if(this.hp == this.hp_max){ - this.node.getChildByName("top").getChildByName("hp").active = false; - } else{ - this.node.getChildByName("top").getChildByName("hp").active = true; - } + this.node.getChildByName("top").getChildByName("hp").active = true; + // if(this.hp == this.hp_max){ + // this.node.getChildByName("top").getChildByName("hp").active = false; + // } else{ + // this.node.getChildByName("top").getChildByName("hp").active = true; + // } } //移动 @@ -561,13 +565,24 @@ export class HeroViewComp extends CCComp { const skills = this.ent.get(HeroSkillsComp); skills.resetAllCooldowns(); } - + applyDamage(result:DamageResult){ + + } /** 显示伤害数字 */ + showDamage(damage: number, isCrit: boolean) { + if(!this.BUFFCOMP.isValid){ + return; + } if(isCrit){ this.BUFFCOMP.tooltip(4,damage.toFixed(0),damage) + console.log("暴击伤害:"+damage) + + }else{ this.BUFFCOMP.tooltip(1,damage.toFixed(0),damage) + console.log("普通伤害:"+damage) } + } } \ No newline at end of file diff --git a/assets/script/game/map/MissionComp.ts b/assets/script/game/map/MissionComp.ts index 5bd2ce49..956c37d6 100644 --- a/assets/script/game/map/MissionComp.ts +++ b/assets/script/game/map/MissionComp.ts @@ -21,7 +21,7 @@ import { UIID } from "../common/config/GameUIConfig"; import { CardControllerComp } from "./CardController"; import { MissionHomeComp } from "./MissionHomeComp"; import { GameEvent } from "../common/config/GameEvent"; -import { BattleState } from "../battle/BattleStateComp"; +import { BattleManager } from "../battle/BattleManager"; const { ccclass, property } = _decorator; /** 视图层对象 */ @@ -69,42 +69,30 @@ export class MissionComp extends CCComp { // } // this.shuaxin(dt) } - mission_start(){ - /* todo 关卡设定完善*/ - console.log("mission_start Missions mons:",Missions[smc.mission.lv]) - this.colose_victory() - this.mission_init() - // this.mskill_init() - this.mon_refresh() - this.heros_call() + mission_start(missionId: number) { + // 初始化关卡数据 + this.colose_victory(); + this.mission_init(); + + // 启动战斗(外部控制入口) + BattleManager.startBattle(smc.mission.lv); + + // 生成怪物和英雄 + this.mon_refresh(); + this.heros_call(); + } - mission_end(){ - oops.message.dispatchEvent(GameEvent.MissionEnd) - smc.mission.play=false - smc.mission.pause=false - let heros:any= this.get_heros();; - let monsters:any= this.get_mons(); - let hcards:any= ecs.query(ecs.allOf(HCardComp)); - let rewards:any= ecs.query(ecs.allOf(ItemComp)); - // let hcns=this.node.getChildByName("hcards") - // for(let i=0;i= this.updateInterval) { - this.accumulator -= this.updateInterval; - + // 只在攻击状态触发技能 if (view.is_atking) { this.processSkills(e, skills); @@ -35,7 +32,7 @@ export class HeroSkillSystem extends ecs.ComblockSystem implements ecs.ISystemUp skills.skills.forEach(skillId => { this.updateCooldown(skills, skillId); }); - } + } /** 处理所有技能逻辑 */ @@ -79,11 +76,11 @@ export class HeroSkillSystem extends ecs.ComblockSystem implements ecs.ISystemUp private castSkill(caster: ecs.Entity, skillId: number, config: typeof SkillSet[keyof typeof SkillSet]) { const view = caster.get(HeroViewComp); const comp = caster.get(HeroSkillsComp); - console.log(view.hero_name+"施放技能",config.uuid,comp,view) - + console.log(view.hero_name+"施放技能:"+config.uuid+"=>"+view.hero_name) switch(config.CdType) { case CdType.SkillCD: view.as.max() + comp.cooldowns.set(skillId, config.cd); // 重置冷却时间 break; case CdType.HeroCD: @@ -116,7 +113,7 @@ export class HeroSkillSystem extends ecs.ComblockSystem implements ecs.ISystemUp const casterView = caster.get(HeroViewComp); const team = casterView.fac; const isEnemyTeam = team === 0 ? 1 : 0; - + // 第一阶段:基础目标筛选 let candidates = ecs.query(ecs.allOf(HeroViewComp)).filter(e => { const view = e.get(HeroViewComp); @@ -210,6 +207,7 @@ export class HeroSkillSystem extends ecs.ComblockSystem implements ecs.ISystemUp // 播放技能特效 caster.get(HeroViewComp).playSkillEffect(config.uuid); + console.log(caster.get(HeroViewComp).hero_name+"技能反馈"+"=>"+req.target.get(HeroViewComp).hero_name+":"+req.baseValue) } /** 应用负面状态 */ diff --git a/assets/script/game/skills/TooltipCom.ts b/assets/script/game/skills/TooltipCom.ts index 08ffda91..b8db9251 100644 --- a/assets/script/game/skills/TooltipCom.ts +++ b/assets/script/game/skills/TooltipCom.ts @@ -26,7 +26,7 @@ export class TooltipCom extends CCComp { start() { switch(this.stype){ case 1: - this.node.setSiblingIndex(1); + this.node.setSiblingIndex(100); this.node.getChildByName("loss_life").getChildByName("hp").getComponent(Label).string = this.value; this.node.getChildByName("loss_life").active=true; this.scheduleOnce(()=>{ @@ -34,7 +34,7 @@ export class TooltipCom extends CCComp { },0.5) break case 2: - this.node.setSiblingIndex(1); + this.node.setSiblingIndex(110); this.node.getChildByName("add_life").getChildByName("hp").getComponent(Label).string = this.value; this.node.getChildByName("add_life").active=true; this.scheduleOnce(()=>{ @@ -42,7 +42,7 @@ export class TooltipCom extends CCComp { },0.5) break case 4: - this.node.setSiblingIndex(2); + this.node.setSiblingIndex(200); this.node.getChildByName("bloss").getChildByName("hp").getComponent(Label).string = this.value; this.node.getChildByName("bloss").active=true; this.scheduleOnce(()=>{