refactor & fix
- 将 `CombatScheduler` 的职责分散到 3 个类中
- `PhaseLoopRuntime`:负责关卡各波次的调度
- `CombatLoadSession`:负责地图与 UI 等资源的加载
- `CombatEventBridge`:负责相关事件的处理
- 统一了战斗的命名为 `Combat`
- 调整了各个地图的坐标,使其位于摄像头中心
- 新增了 CombatInfoForm 展示战斗内的信息
- 补充了循环执行 LevelPhase,手动结束战斗的逻辑
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
using GeometryTD.CustomComponent;
|
||||
using GeometryTD.CustomEvent;
|
||||
using GeometryTD.Definition;
|
||||
using UnityGameFramework.Runtime;
|
||||
|
||||
namespace GeometryTD.UI
|
||||
{
|
||||
public class EventFormUseCase : IUIUseCase
|
||||
{
|
||||
private EventItem _currentEvent;
|
||||
|
||||
public void SetCurrentEvent(EventItem eventItem)
|
||||
{
|
||||
_currentEvent = eventItem;
|
||||
}
|
||||
|
||||
public EventFormRawData CreateInitialModel()
|
||||
{
|
||||
if (_currentEvent == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return new EventFormRawData
|
||||
{
|
||||
EventItem = _currentEvent
|
||||
};
|
||||
}
|
||||
|
||||
public EventOption SelectOption(int optionIndex)
|
||||
{
|
||||
if (_currentEvent == null || _currentEvent.Options == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if (optionIndex < 0 || optionIndex >= _currentEvent.Options.Length)
|
||||
{
|
||||
Log.Warning("EventFormUseCase.SelectOption() option index is invalid: {0}", optionIndex);
|
||||
return null;
|
||||
}
|
||||
|
||||
// TODO: 执行 Requirements 校验、CostEffects/RewardEffects 结算与后续节点推进。
|
||||
GameEntry.EventNode.EndEvent();
|
||||
return _currentEvent.Options[optionIndex];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 80d6d6100109462ea498781e9e70201d
|
||||
timeCreated: 1772104203
|
||||
@@ -0,0 +1,115 @@
|
||||
using System.Collections.Generic;
|
||||
using GeometryTD.Definition;
|
||||
|
||||
namespace GeometryTD.UI
|
||||
{
|
||||
public class RepoFormUseCase : IUIUseCase
|
||||
{
|
||||
public RepoFormRawData CreateInitialModel()
|
||||
{
|
||||
BackpackInventoryData sample = BuildSampleInventory();
|
||||
return new RepoFormRawData
|
||||
{
|
||||
Inventory = sample
|
||||
};
|
||||
}
|
||||
|
||||
private static BackpackInventoryData BuildSampleInventory()
|
||||
{
|
||||
BackpackInventoryData inventory = new BackpackInventoryData
|
||||
{
|
||||
Gold = 500
|
||||
};
|
||||
|
||||
MuzzleCompItemData muzzle = new MuzzleCompItemData
|
||||
{
|
||||
InstanceId = 10001,
|
||||
ConfigId = 1,
|
||||
Name = "元素枪口",
|
||||
Rarity = RarityType.Green,
|
||||
Endurance = 90f,
|
||||
AttackDamage = new[] { 20, 30, 40, 50, 80 },
|
||||
DamageRandomRate = 0.05f,
|
||||
AttackMethodType = AttackMethodType.NormalBullet,
|
||||
Constraint = string.Empty,
|
||||
Tags = new[] { TagType.Fire }
|
||||
};
|
||||
inventory.MuzzleComponents.Add(muzzle);
|
||||
|
||||
BearingCompItemData bearing = new BearingCompItemData
|
||||
{
|
||||
InstanceId = 20001,
|
||||
ConfigId = 1,
|
||||
Name = "元素轴承",
|
||||
Rarity = RarityType.Green,
|
||||
Endurance = 95f,
|
||||
RotateSpeed = new[] { 10f, 12f, 13f, 14f, 15f },
|
||||
AttackRange = new[] { 2f, 2f, 2f, 2f, 2f },
|
||||
Constraint = string.Empty,
|
||||
Tags = new[] { TagType.Fire }
|
||||
};
|
||||
inventory.BearingComponents.Add(bearing);
|
||||
|
||||
BaseCompItemData baseComp = new BaseCompItemData
|
||||
{
|
||||
InstanceId = 30001,
|
||||
ConfigId = 1,
|
||||
Name = "元素底座",
|
||||
Rarity = RarityType.Green,
|
||||
Endurance = 88f,
|
||||
AttackSpeed = new[] { 2f, 1.5f, 1f, 0.8f, 0.7f },
|
||||
AttackPropertyType = AttackPropertyType.Fire,
|
||||
Constraint = string.Empty,
|
||||
Tags = new[] { TagType.Fire }
|
||||
};
|
||||
inventory.BaseComponents.Add(baseComp);
|
||||
|
||||
DefenseTowerItemData tower = new DefenseTowerItemData
|
||||
{
|
||||
InstanceId = 90001,
|
||||
Name = "测试防御塔-A",
|
||||
Rarity = RarityType.Green,
|
||||
Endurance = 92f,
|
||||
MuzzleComponentInstanceId = muzzle.InstanceId,
|
||||
BearingComponentInstanceId = bearing.InstanceId,
|
||||
BaseComponentInstanceId = baseComp.InstanceId,
|
||||
Stats = new DefenseTowerStatsData
|
||||
{
|
||||
AttackDamage = 30,
|
||||
DamageRandomRate = 0.05f,
|
||||
RotateSpeed = 12f,
|
||||
AttackRange = 2f,
|
||||
AttackSpeed = 1.5f,
|
||||
AttackMethodType = AttackMethodType.NormalBullet,
|
||||
AttackPropertyType = AttackPropertyType.Fire,
|
||||
Tags = new[] { TagType.Fire, TagType.BurnSpread }
|
||||
}
|
||||
};
|
||||
inventory.Towers.Add(tower);
|
||||
|
||||
inventory.Towers.Add(new DefenseTowerItemData
|
||||
{
|
||||
InstanceId = 90002,
|
||||
Name = "测试防御塔-B",
|
||||
Rarity = RarityType.Blue,
|
||||
Endurance = 100f,
|
||||
MuzzleComponentInstanceId = 0,
|
||||
BearingComponentInstanceId = 0,
|
||||
BaseComponentInstanceId = 0,
|
||||
Stats = new DefenseTowerStatsData
|
||||
{
|
||||
AttackDamage = 50,
|
||||
DamageRandomRate = 0.03f,
|
||||
RotateSpeed = 20f,
|
||||
AttackRange = 4f,
|
||||
AttackSpeed = 1f,
|
||||
AttackMethodType = AttackMethodType.NormalBullet,
|
||||
AttackPropertyType = AttackPropertyType.Physics,
|
||||
Tags = new[] { TagType.Pierce }
|
||||
}
|
||||
});
|
||||
|
||||
return inventory;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ad54433a032e489f82217d85992a8159
|
||||
timeCreated: 1772106305
|
||||
Reference in New Issue
Block a user