Exemplo n.º 1
0
 public void OnSceneDropButton()
 {
     if (SceneDropDown.IsExpanded)
     {
         SceneDropDown.Contract();
     }
     else
     {
         SceneDropDown.Expand();
     }
 }
Exemplo n.º 2
0
    public void AddOption(string name, IList <string> subOptions, System.Action <int> onSelected, System.Action <int> onDeleted = null)
    {
        if (doCache)
        {
            cachedData.Add(() =>
            {
                AddOption(name, subOptions, onSelected, onDeleted);
            });
            return;
        }

        DropDownOption option = addOption(name);

        option.SublistArrow.enabled = true;

        ScrollingDropDown subList = addSublist();

        option.Delete.gameObject.SetActive(false);

        option.OnHover = () =>
        {
            if (subList.IsExpanded)
            {
                //subList.Contract();
            }
            else
            {
                subList.Expand();
            }
        };

        if (refresh)
        {
            subList.BeginOptions();
        }

        for (int i = 0; i < subOptions.Count; i++)
        {
            string subOption = subOptions[i];
            int    index     = i;
            if (onDeleted == null || subOption[0] == '[')
            {
                subList.AddOption(subOption, (x) =>
                {
                    Contract();
                    onSelected(index);
                });
            }
            else
            {
                subList.AddOption(subOption, (x) =>
                {
                    Contract();
                    onSelected(index);
                }, (x) => {
                    onDeleted(index);
                });
            }
        }

        if (refresh)
        {
            subList.EndOptions();
        }
    }