If It needs to chain out to a different method that's fine, but I need to support triggering the 'option' parameter from a single call from the dialogue event system or it's going to spaghettify.
If Possible, please explain in context of what I need to do differently from what is shown in the following tutorial:
my current c#:
Code: Select all
public List<(string, double)> GetDialogue(double option) {
Dictionary<string, double> storyFlagsIn = new();
if (availableDialogueOptions.Count > option) {
storyFlagsIn = availableDialogueOptions[(int)option].soruce?.storyVariables;
}
else {
storyFlagsIn = new Dictionary<string, double>();
}
List<(string, double)> flags = storyFlagsIn?.Select(item => (item.Key, item.Value)).ToList() ?? new();
flags.Add((availableDialogueOptions[(int)option].flag, 1));
return flags;
}
public bool unregisterOnDisable = false;
void OnEnable() {
// Make the functions available to Lua
Lua.RegisterFunction("GetDialogue", this, SymbolExtensions.GetMethodInfo(() => GetDialogue((double) 0)));
}
void OnDisable() {
if (unregisterOnDisable) {
// Remove the functions from Lua
Lua.UnregisterFunction("GetDialogue");
}
}