Ejemplo n.º 1
0
    // Update is called once per frame

    // FIX: keep the "selected" option in the list and check for all the others
    public void UpdateDropdownOptions()
    {
        UpdateSupportAssignementStatuses();

        Support[] allSupports = supportController.GetAllSupports();
        List <Dropdown.OptionData> options;

        foreach (Dropdown dropdown in missionAssignmentDropdowns)
        {
            var currentSelection = new Dropdown.OptionData(dropdown.captionText.text);
            int currentValue     = dropdown.value;
            dropdown.ClearOptions();
            options = new List <Dropdown.OptionData>();
            options.Add(new Dropdown.OptionData("Unassigned"));

            foreach (Support supp in allSupports)
            {
                if (!supp.Assigned || supp.Name == currentSelection.text)
                {
                    options.Add(new Dropdown.OptionData(supp.Name));

                    if (supp.Name == currentSelection.text)
                    {
                        currentValue = options.Count - 1;
                    }
                }
            }

            dropdown.AddOptions(options);
            dropdown.value = currentValue;
        }
    }
Ejemplo n.º 2
0
    // Use this for initialization
    void Start()
    {
        supportController = GameObject.FindObjectOfType <SupportController>();
        allSupports       = supportController.GetAllSupports();


        ResetLoadingBarUI();

        UpdateMissionData();

        UpdateMissionUI();
    }