48 lines
1.3 KiB
C#
48 lines
1.3 KiB
C#
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];
|
|
}
|
|
}
|
|
} |