示例#1
0
 private void variableChanged(string name, Ink.Runtime.Object value)
 {
     if (variables.ContainsKey(name))
     {
         variables.Remove(name);
         variables.Add(name, value);
     }
 }
示例#2
0
 public Ink.Runtime.Object GetVariableState(string variableName)
 {
     Ink.Runtime.Object variableValue = null;
     dialogueVaribles.variables.TryGetValue(variableName, out variableValue);
     if (variableValue == null)
     {
         Debug.LogWarning("Ink variable was found to be null: " + variableName);
     }
     return(variableValue);
 }
示例#3
0
    public DialogueVariables(string globalFilePath)
    {
        string inkFileContents = File.ReadAllText(globalFilePath);

        Ink.Compiler compiler            = new Ink.Compiler(inkFileContents);
        Story        globalVariblesStory = compiler.Compile();

        variables = new Dictionary <string, Ink.Runtime.Object>();
        foreach (string name in globalVariblesStory.variablesState)
        {
            Ink.Runtime.Object value = globalVariblesStory.variablesState.GetVariableWithName(name);
            variables.Add(name, value);
            Debug.Log("initialize global dialogue variable: " + name + "=" + value);
        }
    }