补全部分 EventComponent 设计
This commit is contained in:
@@ -73,7 +73,7 @@ namespace GeometryTD.UI
|
||||
|
||||
private static EventFormContext BuildContext(EventFormRawData rawData)
|
||||
{
|
||||
if (rawData?.EventItem == null)
|
||||
if (rawData == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
@@ -82,24 +82,30 @@ namespace GeometryTD.UI
|
||||
for (int i = 0; i < options.Length; i++)
|
||||
{
|
||||
string optionText = string.Empty;
|
||||
if (rawData.EventItem.Options != null && i < rawData.EventItem.Options.Length &&
|
||||
rawData.EventItem.Options[i] != null)
|
||||
bool isSelectable = false;
|
||||
string blockedReason = string.Empty;
|
||||
if (rawData.OptionItems != null && i < rawData.OptionItems.Length &&
|
||||
rawData.OptionItems[i] != null)
|
||||
{
|
||||
optionText = rawData.EventItem.Options[i].OptionText;
|
||||
optionText = rawData.OptionItems[i].OptionText;
|
||||
isSelectable = rawData.OptionItems[i].IsSelectable;
|
||||
blockedReason = rawData.OptionItems[i].BlockedReason;
|
||||
}
|
||||
|
||||
options[i] = new EventOptionItemContext
|
||||
{
|
||||
OptionIndex = i,
|
||||
OptionText = optionText
|
||||
OptionText = optionText,
|
||||
IsSelectable = isSelectable,
|
||||
BlockedReason = blockedReason
|
||||
};
|
||||
}
|
||||
|
||||
return new EventFormContext
|
||||
{
|
||||
EventId = rawData.EventItem.Id,
|
||||
Title = rawData.EventItem.Title,
|
||||
Description = rawData.EventItem.Description,
|
||||
EventId = rawData.EventId,
|
||||
Title = rawData.Title,
|
||||
Description = rawData.Description,
|
||||
OptionItems = options
|
||||
};
|
||||
}
|
||||
@@ -117,7 +123,7 @@ namespace GeometryTD.UI
|
||||
return;
|
||||
}
|
||||
|
||||
m_UseCase.SelectOption(args.SelectedItemId);
|
||||
m_UseCase.TrySelectOption(args.SelectedItemId);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -245,8 +245,8 @@ namespace GeometryTD.UI
|
||||
RepoFormContext latestContext = BuildContext(latestRawData);
|
||||
if (latestContext != null)
|
||||
{
|
||||
Form.RefreshUI(latestContext);
|
||||
ApplyParticipantSelection();
|
||||
SetContext(latestContext);
|
||||
RefreshCurrentUI();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user