public void AskForMultipleChoice(Prompt prompt, List<OptionPrompt> choices, int timeOutSeconds)
{
if (ViewModelBase.IsDetached) return;
Trace.Assert(!Player.IsDead);
Application.Current.Dispatcher.Invoke((ThreadStart)delegate()
{
GameModel.CurrentActivePlayer = this;
CurrentPrompt = prompt;
CurrentPromptString = LogFormatter.Translate(prompt);
_currentMultiChoices = choices;
if (!IsPlayable)
{
Trace.Assert(currentUsageVerifier == null);
TimeOutSeconds = timeOutSeconds;
MultipleChoiceAnsweredEvent(0);
return;
}
if (prompt.ResourceKey == Prompt.MultipleChoicePromptPrefix + Prompt.SkillUseYewNoPrompt)
{
Trace.Assert(prompt.Values.Count != 0);
var targetSkill = prompt.Values[0] as TriggerSkill;
Trace.Assert(targetSkill != null);
foreach (var skill in SkillCommands)
{
if (skill.Skill == targetSkill)
{
skill.IsHighlighted = true;
if (skill.IsSelected)
{
int answer = choices.IndexOf(Prompt.YesChoice);
Trace.Assert(answer != -1);
MultipleChoiceAnsweredEvent(answer);
return;
}
else
{
break;
}
}
}
}
for (int i = 0; i < choices.Count; i++)
{
MultiChoiceCommand command = new MultiChoiceCommand(ExecuteMultiChoiceCommand)
{
CanExecuteStatus = true,
ChoiceKey = choices[i],
ChoiceIndex = i
};
if (choices[i] == Prompt.YesChoice)
{
SubmitAnswerCommand = command;
}
else if (choices[i] == Prompt.NoChoice)
{
CancelAnswerCommand = command;
}
else
{
MultiChoiceCommands.Add(command);
}
}
IsMultiChoiceQuestionShown = true;
TimeOutSeconds = timeOutSeconds;
});
}