47 lines
1.3 KiB
C#
47 lines
1.3 KiB
C#
using GeometryTD.CustomEvent;
|
|
using GeometryTD.Definition;
|
|
using UnityGameFramework.Runtime;
|
|
|
|
namespace GeometryTD.UI
|
|
{
|
|
public class EventFormUseCase : IUIUseCase
|
|
{
|
|
private EventItem m_CurrentEvent;
|
|
|
|
public void SetCurrentEvent(EventItem eventItem)
|
|
{
|
|
m_CurrentEvent = eventItem;
|
|
}
|
|
|
|
public EventFormRawData CreateInitialModel()
|
|
{
|
|
if (m_CurrentEvent == null)
|
|
{
|
|
return null;
|
|
}
|
|
|
|
return new EventFormRawData
|
|
{
|
|
EventItem = m_CurrentEvent
|
|
};
|
|
}
|
|
|
|
public EventOption SelectOption(int optionIndex)
|
|
{
|
|
if (m_CurrentEvent == null || m_CurrentEvent.Options == null)
|
|
{
|
|
return null;
|
|
}
|
|
|
|
if (optionIndex < 0 || optionIndex >= m_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];
|
|
}
|
|
}
|
|
} |