public void CalculateChoices(ConversationStage s) { ChoicesColumn1.Clear(); ChoicesColumn2.Clear(); ChoicesColumn3.Clear(); int current = 0; foreach (var choice in s.Choices) { var script = new ScriptWrapper(choice.ChoiceVisibility); var result = script.Execute(); if (result == null || result == true) { if (current == 0) { ChoicesColumn1.Add(new KeyValuePair <int, string>(choice.Target, choice.ChoiceText)); } if (current == 1) { ChoicesColumn2.Add(new KeyValuePair <int, string>(choice.Target, choice.ChoiceText)); } if (current == 2) { ChoicesColumn3.Add(new KeyValuePair <int, string>(choice.Target, choice.ChoiceText)); } current = (current + 1) % 3; } } }
public void GoToStage(int stage) { var stageInstance = Convo.Stages.Where(a => a.StageId == stage).FirstOrDefault(); if (stageInstance != null) { var script = new ScriptWrapper(stageInstance.StageAction); var result = script.Execute(); if (result != true) { CalculateChoices(stageInstance); if (ChoicesColumn1.Count() == 0) { ConversationFinished = true; } } } else { ConversationFinished = true; } MainViewModel.GetMainViewModelStatic().CurrentGame.RefreshAll(); if (ConversationFinished && MainViewModel.GetMainViewModelStatic().CurrentConversation == this) { MainViewModel.GetMainViewModelStatic().SetExploreMode(); } }