Esempio n. 1
0
        public void Select(LeanFinger finger, LeanSelectable selectable)
        {
            // Something was selected?
            if (selectable != null && selectable.isActiveAndEnabled == true)
            {
                if (selectable.HideWithFinger == true)
                {
                    for (var i = LeanSelectable.Instances.Count - 1; i >= 0; i--)
                    {
                        var instance = LeanSelectable.Instances[i];

                        if (instance.HideWithFinger == true && instance.IsSelected == true)
                        {
                            return;
                        }
                    }
                }

                // Did we select a new LeanSelectable?
                if (selectable.IsSelected == false)
                {
                    // Deselect some if we have too many
                    if (MaxSelectables > 0)
                    {
                        LeanSelectable.Cull(MaxSelectables - 1);
                    }

                    // Select
                    selectable.Select(finger);
                    selectable.GetComponent <colorchanger>().ChangeColor(1, 0, 1);
                }
                // Did we reselect the current LeanSelectable?
                else
                {
                    switch (Reselect)
                    {
                    case ReselectType.Deselect:
                    {
                        selectable.Deselect();
                    }
                    break;

                    case ReselectType.DeselectAndSelect:
                    {
                        selectable.Deselect();
                        selectable.Select(finger);
                    }
                    break;

                    case ReselectType.SelectAgain:
                    {
                        selectable.Select(finger);
                    }
                    break;
                    }
                }
            }
            // Nothing was selected?
            else
            {
                // Deselect?
                if (AutoDeselect == true)
                {
                    DeselectAll();
                }
            }
        }