M1 回合制战斗架构收敛与 1v1 攻击闭环:BattleRuntime 内核、组件唯一入口、UI 数据驱动与 EditMode 测试

- 删除中间契约(BattleStartRequest/BattlePlayerInput/BattleReturnPlan/桥接与策略接口/FlowState),收敛为 BattleViewState/BattleStep/一层 BattleEvent
- 新增内部 BattleRuntime/BattleUnit/BattleStatus 共享上下文;TurnBattleComponent 成为唯一外部入口,吸收启动/暂停/回写职责
- 内核支持 1v1 攻击闭环:效果公式、HP/MP 钳制、阵亡、Victory/TotalDefeat、敌人随机决策;敌人行动间歇 0.6s 由组件协程编排并经 StepListener 推送
- UI:玩家卡片/敌人槽/回合槽按战局重建,图标配置驱动(含新增 EnemyConfig.Icon),每轮刷新一次 TurnSlots 且轮内只移动高亮
- 新增 Tests 程序集 + InternalsVisibleTo,25 个 BattleRuntime 纯逻辑用例全部通过
This commit is contained in:
huangjun
2026-09-02 08:42:04 +08:00
parent 8413c2688b
commit 7dcac0ac87
65 changed files with 3067 additions and 1225 deletions
@@ -27,6 +27,8 @@ public sealed partial class EnemyConfig : Luban.BeanBase
AiType = (EnemyAiType)_buf.ReadInt();
{int n0 = System.Math.Min(_buf.ReadSize(), _buf.Size);ActionIds = new System.Collections.Generic.List<int>(n0);for(var i0 = 0 ; i0 < n0 ; i0++) { int _e0; _e0 = _buf.ReadInt(); ActionIds.Add(_e0);}}
DropTableId = _buf.ReadInt();
Icon = _buf.ReadString();
Icon_Ref = null;
}
public static EnemyConfig DeserializeEnemyConfig(ByteBuf _buf)
@@ -78,6 +80,11 @@ public sealed partial class EnemyConfig : Luban.BeanBase
/// 独立掉落表ID
/// </summary>
public readonly int DropTableId;
/// <summary>
/// 图标资源配置
/// </summary>
public readonly string Icon;
public SpriteConfig Icon_Ref;
public const int __ID__ = 1284055242;
public override int GetTypeId() => __ID__;
@@ -95,6 +102,7 @@ public sealed partial class EnemyConfig : Luban.BeanBase
Icon_Ref = tables.TbSpriteConfig.GetOrDefault(Icon);
}
public override string ToString()
@@ -111,6 +119,7 @@ public sealed partial class EnemyConfig : Luban.BeanBase
+ "aiType:" + AiType + ","
+ "actionIds:" + Luban.StringUtil.CollectionToString(ActionIds) + ","
+ "dropTableId:" + DropTableId + ","
+ "icon:" + Icon + ","
+ "}";
}
}