Exemple #1
0
 void ReadTheme(string fileName)
 {
     string[] lines = File.ReadAllLines(DialogueManager.appPath + "/Themes/" + fileName + ".sstheme");
     for (int i = 0; i < lines.Length; i++)
     {
         lines[i] = lines[i].Replace(" ", "").Replace("\t", "").ToLower();
         string[] arg = lines[i].Substring(lines[i].IndexOf(":") + 1).Split(',');
         if (lines[i].Contains("dialoguetext"))
         {
             dText = constructor.ConstructText(new Color(float.Parse(arg[5]), float.Parse(arg[6]), float.Parse(arg[7]), float.Parse(arg[8])), float.Parse(arg[0]), float.Parse(arg[1]), float.Parse(arg[2]), float.Parse(arg[3]), arg[4], GetAlignment(arg[9]));
         }
         if (lines[i].Contains("dialoguebox"))
         {
             dBox = constructor.ConstructGroup(1, false, new Color(float.Parse(arg[4]), float.Parse(arg[5]), float.Parse(arg[6]), float.Parse(arg[7])), float.Parse(arg[0]), float.Parse(arg[1]), float.Parse(arg[2]), float.Parse(arg[3]));
         }
         if (lines[i].Contains("choicebox"))
         {
             cBox = constructor.ConstructGroup(0, false, new Color(float.Parse(arg[4]), float.Parse(arg[5]), float.Parse(arg[6]), float.Parse(arg[7])), float.Parse(arg[0]), float.Parse(arg[1]), float.Parse(arg[2]), float.Parse(arg[3]));
         }
         if (lines[i].Contains("choicecells"))
         {
             g = constructor.ConstructLayoutGroup(float.Parse(arg[0]), float.Parse(arg[1]), float.Parse(arg[2]), float.Parse(arg[3]), cBox.GetComponent <RectTransform>().sizeDelta.x, cBox.GetComponent <RectTransform>().sizeDelta.y);
         }
         if (lines[i].Contains("choices"))
         {
             b = constructor.ConstructButton(new Color(float.Parse(arg[0]), float.Parse(arg[1]), float.Parse(arg[2]), float.Parse(arg[3])), new Color(float.Parse(arg[6]), float.Parse(arg[7]), float.Parse(arg[8]), float.Parse(arg[9])), int.Parse(arg[4]), g.cellSize.x, g.cellSize.y, arg[5]);
         }
     }
 }
Exemple #2
0
    void Awake()
    {
        System.Globalization.CultureInfo.CurrentCulture = System.Globalization.CultureInfo.GetCultures(System.Globalization.CultureTypes.NeutralCultures)[0];

        appPath = Application.streamingAssetsPath;

        dialogueLine = new List <int>(1)
        {
            0
        };

        parser        = new TextParser(this);
        choiceManager = new ChoiceManager();
        charManager   = new CharacterManager(startingCast);

        themeConstructor = new ThemeConstructor(this);

        uiConstructor = new UIConstructor();
        uiManager     = new UIManager(this, uiConstructor.ConstructText(Color.black), uiConstructor.ConstructGroup(1, false, Color.gray), uiConstructor.ConstructCanvas(), uiConstructor.ConstructButton(Color.black, Color.black), uiConstructor.ConstructGroup(0, false, Color.gray), uiConstructor.ConstructLayoutGroup());

        varManager      = new VariableManager();
        functionManager = new FunctionManager(this);

        //Base starting values
        if (startWithExposition)
        {
            varManager.SetVar(new string[] { "charVisible=0" });
        }
        else
        {
            varManager.SetVar(new string[] { "charVisible=1" });
        }
        varManager.SetVar(new string[] { "typeRate=" + startingTextSpeed });
        varManager.SetVar(new string[] { "buildV=" + version });
        varManager.SetVar(new string[] { "pitch=1" });

        thes      = new Thesaurus("Default");
        uiManager = themeConstructor.ConstructTheme("Default");
    }