Пример #1
0
    private void sidebarControl_SelectRequest(object sender, SidebarControlEventArgs e)
    {
        Behaviour behaviour = e.Behaviour;

        if (behaviour != null)
        {
            if (Event.current.control)
            {
                if (Selection.Contains(behaviour.gameObject))
                {
                    GameObject[] objArray = Selection.gameObjects;
                    ArrayUtility.Remove <GameObject>(ref objArray, behaviour.gameObject);
                    Selection.objects = (objArray);
                }
                else
                {
                    GameObject[] objArray2 = Selection.gameObjects;
                    ArrayUtility.Add <GameObject>(ref objArray2, behaviour.gameObject);
                    Selection.objects = (objArray2);
                }
            }
            else if (Event.current.shift)
            {
                List <SidebarControl> list = new List <SidebarControl>();
                foreach (TrackGroupWrapper wrapper in this.trackGroupBinding.Keys)
                {
                    TrackGroupControl item = this.trackGroupBinding[wrapper];
                    list.Add(item);
                    list.AddRange(item.GetSidebarControlChildren(true));
                }
                SidebarControl sidebarControl = e.SidebarControl;
                SidebarControl control2       = e.SidebarControl;
                foreach (SidebarControl control4 in list)
                {
                    if (control4.IsSelected)
                    {
                        if (sidebarControl.CompareTo(control4) > 0)
                        {
                            sidebarControl = control4;
                        }
                        if (control2.CompareTo(control4) < 0)
                        {
                            control2 = control4;
                        }
                    }
                }
                foreach (SidebarControl control5 in list)
                {
                    if ((!control5.IsSelected && (sidebarControl.CompareTo(control5) <= 0)) && (control2.CompareTo(control5) >= 0))
                    {
                        control5.Select();
                    }
                }
            }
            else
            {
                Selection.activeObject = (behaviour);
            }
            Event.current.Use();
        }
    }
Пример #2
0
    private void sidebarControl_SelectRequest(object sender, SidebarControlEventArgs e)
    {
        Behaviour behaviour = e.Behaviour;

        if (behaviour == null)
        {
            return;
        }
        if (Event.current.control)
        {
            if (Selection.Contains(behaviour.gameObject))
            {
                GameObject[] gameObjects = Selection.gameObjects;
                ArrayUtility.Remove(ref gameObjects, behaviour.gameObject);
                Selection.objects = (gameObjects);
            }
            else
            {
                GameObject[] gameObjects2 = Selection.gameObjects;
                ArrayUtility.Add(ref gameObjects2, behaviour.gameObject);
                Selection.objects = (gameObjects2);
            }
        }
        else
        {
            if (Event.current.shift)
            {
                List <SidebarControl> list = new List <SidebarControl>();
                foreach (TrackGroupWrapper current in trackGroupBinding.Keys)
                {
                    TrackGroupControl trackGroupControl = this.trackGroupBinding[current];
                    list.Add(trackGroupControl);
                    list.AddRange(trackGroupControl.GetSidebarControlChildren(true));
                }
                SidebarControl sidebarControl  = e.SidebarControl;
                SidebarControl sidebarControl2 = e.SidebarControl;
                foreach (SidebarControl current2 in list)
                {
                    if (current2.IsSelected)
                    {
                        if (sidebarControl.CompareTo(current2) > 0)
                        {
                            sidebarControl = current2;
                        }
                        if (sidebarControl2.CompareTo(current2) < 0)
                        {
                            sidebarControl2 = current2;
                        }
                    }
                }
                using (List <SidebarControl> .Enumerator enumerator2 = list.GetEnumerator())
                {
                    while (enumerator2.MoveNext())
                    {
                        SidebarControl current3 = enumerator2.Current;
                        if (!current3.IsSelected && sidebarControl.CompareTo(current3) <= 0 && sidebarControl2.CompareTo(current3) >= 0)
                        {
                            current3.Select();
                        }
                    }
                    goto IL_195;
                }
            }
            Selection.activeObject = (behaviour);
        }
IL_195:
        Event.current.Use();
    }