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 RecalculateInteractableVisbility() { if (InteractableBase.CanExamineUsesScript) { var scriptResult = new ScriptWrapper(InteractableBase.CanExamineScript).Execute(); if (scriptResult == true) { IsExaminable = true; } else { IsExaminable = false; } } else { IsExaminable = InteractableBase.CanExamine; } if (InteractableBase.CanInteractUsesScript) { var scriptResult = new ScriptWrapper(InteractableBase.CanInteractScript).Execute(); if (scriptResult == true) { IsInteractable = true; } else { IsInteractable = false; } } else { IsInteractable = InteractableBase.CanInteract; } }
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(); } }
public void UseItem() { ScriptWrapper s = new ScriptWrapper(item.OnUse) { ItemBase = this }; s.Execute(); }
public List <object> GetDescription() { ScriptWrapper s = new ScriptWrapper(item.Description) { ItemBase = this }; s.Execute(); return(s.TextResult); }
public bool GetVisibility() { var res = new ScriptWrapper(PlayerStat.DisplayCondition).Execute(); if (res == null) { res = true; } IsVisible = res.Value; return(IsVisible); }
public void RunOnMove() { ScriptWrapper sw = new ScriptWrapper(LinkedEffect.Value.OnMove); foreach (var local in TempVariables) { sw.localVars.Add(local.VariableBase.Id, local); sw.localVarsByName.Add(local.VariableBase.Name, local); } sw.CurrentStatusEffect = this; sw.Execute(true); }
public bool RunCheckIfResolved() { ScriptWrapper sw = new ScriptWrapper(LinkedEffect.Value.CheckIfCleared); foreach (var local in TempVariables) { sw.localVars.Add(local.VariableBase.Id, local); sw.localVarsByName.Add(local.VariableBase.Name, local); } sw.CurrentStatusEffect = this; bool?result = sw.Execute(true); return(result == true); }
public void DupeVars(ScriptWrapper s) { ScriptWrapper parent = s; while (parent != null && parent.localVars.Count() == 0) { parent = parent.parent; } if (parent != null) { foreach (var a in parent.localVars) { VariableWrapper vw = new VariableWrapper(a.Value.VariableBase); vw.CurrentCommonEventValue = a.Value.CurrentCommonEventValue; vw.CurrentDateTimeValue = a.Value.CurrentDateTimeValue; vw.CurrentItemValue = a.Value.CurrentItemValue; vw.CurrentNumberValue = a.Value.CurrentNumberValue; vw.CurrentStringValue = a.Value.CurrentStringValue; localVars.Add(a.Key, vw); localVarsByName.Add(a.Value.VariableBase.Name, vw); } } }
public bool IsVisible() { var visibility = new ScriptWrapper(ExitBase.ExitVisibility).Execute(); return(visibility != false); }