Esempio n. 1
0
    public void SetDropdownValues()
    {
        if (fileIO == null)
        {
            fileIO = FindObjectOfType <JsonFileIO>();
        }

        TMP_Dropdown.DropdownEvent tmp1 = CharacterNameDropdown.onValueChanged;
        TMP_Dropdown.DropdownEvent tmp2 = StateNameDropdown.onValueChanged;
        TMP_Dropdown.DropdownEvent tmp3 = BGMNameDropdown.onValueChanged;
        TMP_Dropdown.DropdownEvent tmp4 = CGDropdown.onValueChanged;
        TMP_Dropdown.DropdownEvent tmp5 = BGDropdown.onValueChanged;

        CharacterNameDropdown.onValueChanged = new TMP_Dropdown.DropdownEvent();
        StateNameDropdown.onValueChanged     = new TMP_Dropdown.DropdownEvent();
        BGMNameDropdown.onValueChanged       = new TMP_Dropdown.DropdownEvent();
        CGDropdown.onValueChanged            = new TMP_Dropdown.DropdownEvent();
        BGDropdown.onValueChanged            = new TMP_Dropdown.DropdownEvent();

        List <string> options = fileIO.GetCharacterList();

        int tmp = fileIO.ReturnCharacterIndex(CharacterName);

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

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

        CharacterNameDropdown.value = tmp;

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

        options = fileIO.GetCharacterStates(CharacterName);

        tmp = fileIO.ReturnCharacterStateIndex(CharacterName, StateName);

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

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

        StateNameDropdown.value = tmp;

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

        options = fileIO.GetBGMList();

        tmp = BGMName;

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

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

        BGMNameDropdown.value = tmp;

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

        options = fileIO.GetArtworkList(0);

        tmp = CG;

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

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

        CGDropdown.value = tmp;

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

        options = fileIO.GetArtworkList(1);

        tmp = BG;

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

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

        BGDropdown.value = tmp;

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

        CharacterNameDropdown.onValueChanged = tmp1;
        StateNameDropdown.onValueChanged     = tmp2;
        BGMNameDropdown.onValueChanged       = tmp3;
        CGDropdown.onValueChanged            = tmp4;
        BGDropdown.onValueChanged            = tmp5;
    }
Esempio n. 2
0
 private void Start()
 {
     this.gameObject.SetActive(true);
     OnDropDownValueChanged = new TMP_Dropdown.DropdownEvent();
     InputManager.Instance.ActivateInput(false);
 }