- 调整优化了 CombatNodeComponent 相关实体的生命周期管理

- 总结了一份 CombatNodeComponent 文档 CombatNodeArchitecture.md
This commit is contained in:
SepComet
2026-02-28 20:20:02 +08:00
parent dfd37778b6
commit 26dc1a5600
10 changed files with 364 additions and 73 deletions
@@ -1,3 +1,4 @@
using GeometryTD.CustomComponent;
using GeometryTD.CustomEvent;
using GeometryTD.Definition;
using UnityGameFramework.Runtime;
@@ -6,42 +7,42 @@ namespace GeometryTD.UI
{
public class EventFormUseCase : IUIUseCase
{
private EventItem m_CurrentEvent;
private EventItem _currentEvent;
public void SetCurrentEvent(EventItem eventItem)
{
m_CurrentEvent = eventItem;
_currentEvent = eventItem;
}
public EventFormRawData CreateInitialModel()
{
if (m_CurrentEvent == null)
if (_currentEvent == null)
{
return null;
}
return new EventFormRawData
{
EventItem = m_CurrentEvent
EventItem = _currentEvent
};
}
public EventOption SelectOption(int optionIndex)
{
if (m_CurrentEvent == null || m_CurrentEvent.Options == null)
if (_currentEvent == null || _currentEvent.Options == null)
{
return null;
}
if (optionIndex < 0 || optionIndex >= m_CurrentEvent.Options.Length)
if (optionIndex < 0 || optionIndex >= _currentEvent.Options.Length)
{
Log.Warning("EventFormUseCase.SelectOption() option index is invalid: {0}", optionIndex);
return null;
}
// TODO: 执行 Requirements 校验、CostEffects/RewardEffects 结算与后续节点推进。
GameEntry.Event.Fire(this, NodeCompleteEventArgs.Create());
return m_CurrentEvent.Options[optionIndex];
GameEntry.EventNode.EndEvent();
return _currentEvent.Options[optionIndex];
}
}
}