Ejemplo n.º 1
0
    public void SetValues()
    {
        fileIO = FindObjectOfType <JsonFileIO>();
        List <string> options = new List <string>();

        options.Add("None");
        options.AddRange(fileIO.ReturnAllChapters().ToArray());

        int tmp = NextChapter + 1;

        Debug.Log(options.Count);

        if (options.Count != NextChapterList.options.Count)
        {
            NextChapterList.ClearOptions();
            NextChapterList.AddOptions(options);
        }

        for (int i = 0; i < NextChapterList.options.Count; i++)
        {
            if (i >= options.Count)
            {
                NextChapterList.ClearOptions();
                NextChapterList.AddOptions(options);
                break;
            }
            if (options[i] != NextChapterList.options[i].text)
            {
                NextChapterList.ClearOptions();
                NextChapterList.AddOptions(options);
            }
        }

        NextChapterList.value = tmp;

        if (NextChapterList.value >= NextChapterList.options.Count)
        {
            NextChapterList.value = 0;
        }
    }
Ejemplo n.º 2
0
    public void UpdateLists()
    {
        fileIO = FindObjectOfType <JsonFileIO>();
        List <string> options = fileIO.ReturnAllChapters();

        options.RemoveAt(0);

        int tmp = ChoiceChapter;

        if (options.Count != ChoiceChapterInput.options.Count)
        {
            ChoiceChapterInput.ClearOptions();
            ChoiceChapterInput.AddOptions(options);
        }

        for (int i = 0; i < ChoiceChapterInput.options.Count; i++)
        {
            if (i >= options.Count)
            {
                ChoiceChapterInput.ClearOptions();
                ChoiceChapterInput.AddOptions(options);
                break;
            }
            if (options[i] != ChoiceChapterInput.options[i].text)
            {
                ChoiceChapterInput.ClearOptions();
                ChoiceChapterInput.AddOptions(options);
            }
        }

        ChoiceChapterInput.value = tmp;

        if (ChoiceChapterInput.value >= ChoiceChapterInput.options.Count)
        {
            ChoiceChapterInput.value = 0;
        }
    }