- 调整优化了 CombatNodeComponent 相关实体的生命周期管理
- 总结了一份 CombatNodeComponent 文档 CombatNodeArchitecture.md
This commit is contained in:
@@ -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];
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user