UnityEditor.AssetServer.SetSelectionFromGUID C# (CSharp) Method

SetSelectionFromGUID() private method

private SetSelectionFromGUID ( string guid ) : void
guid string
return void
        public static extern void SetSelectionFromGUID(string guid);
        [MethodImpl(MethodImplOptions.InternalCall)]

Usage Example

示例#1
0
        public void UpdateGUI()
        {
            SplitterGUILayout.BeginHorizontalSplit(this.horSplit, new GUILayoutOption[0]);
            GUILayout.BeginVertical(this.constants.box, new GUILayoutOption[0]);
            GUILayout.Label(this.totalUpdates, this.constants.title, new GUILayoutOption[0]);
            IEnumerator enumerator = ListViewGUILayout.ListView(this.lv, GUIStyle.none, new GUILayoutOption[0]).GetEnumerator();

            try
            {
                while (enumerator.MoveNext())
                {
                    ListViewElement current  = (ListViewElement)enumerator.Current;
                    Rect            position = current.position;
                    position.x++;
                    position.y++;
                    if (Event.current.type == EventType.Repaint)
                    {
                        if ((current.row % 2) == 0)
                        {
                            this.constants.entryEven.Draw(position, false, false, false, false);
                        }
                        else
                        {
                            this.constants.entryOdd.Draw(position, false, false, false, false);
                        }
                    }
                    GUILayout.BeginVertical((current.row != this.lv.row) ? this.constants.entryNormal : this.constants.entrySelected, new GUILayoutOption[0]);
                    GUILayoutOption[] options = new GUILayoutOption[] { GUILayout.MinWidth(50f) };
                    GUILayout.Label(this.messageFirstLines[current.row], this.constants.serverUpdateLog, options);
                    GUILayout.BeginHorizontal(new GUILayoutOption[0]);
                    GUILayoutOption[] optionArray2 = new GUILayoutOption[] { GUILayout.MinWidth(100f) };
                    GUILayout.Label(this.changesets[current.row].changeset.ToString() + " " + this.changesets[current.row].date, this.constants.serverUpdateInfo, optionArray2);
                    GUILayoutOption[] optionArray3 = new GUILayoutOption[] { GUILayout.Width((float)this.maxNickLength) };
                    GUILayout.Label(this.changesets[current.row].owner, this.constants.serverUpdateInfo, optionArray3);
                    GUILayout.EndHorizontal();
                    GUILayout.EndVertical();
                }
            }
            finally
            {
                IDisposable disposable = enumerator as IDisposable;
                if (disposable != null)
                {
                    disposable.Dispose();
                }
            }
            if (this.lv.selectionChanged)
            {
                this.SetSelectedRevisionLine(this.lv.row);
            }
            GUILayout.EndVertical();
            SplitterGUILayout.BeginVerticalSplit(this.vertSplit, new GUILayoutOption[0]);
            GUILayout.BeginVertical(this.constants.box, new GUILayoutOption[0]);
            GUILayout.Label("Changeset", this.constants.title, new GUILayoutOption[0]);
            int         num         = -1;
            int         file        = -1;
            IEnumerator enumerator2 = ListViewGUILayout.ListView(this.pv.lv, GUIStyle.none, new GUILayoutOption[0]).GetEnumerator();

            try
            {
                while (enumerator2.MoveNext())
                {
                    ChangeFlags     changeFlags;
                    ListViewElement element2 = (ListViewElement)enumerator2.Current;
                    if ((num == -1) && !this.pv.IndexToFolderAndFile(element2.row, ref num, ref file))
                    {
                        return;
                    }
                    ParentViewFolder folder = this.pv.folders[num];
                    if (ListViewGUILayout.HasMouseDown(element2.position))
                    {
                        if (Event.current.clickCount == 2)
                        {
                            if (!this.isDirSelected && (this.selectedGUID != string.Empty))
                            {
                                this.DoShowDiff(false);
                                GUIUtility.ExitGUI();
                            }
                        }
                        else
                        {
                            this.pv.lv.scrollPos = ListViewShared.ListViewScrollToRow(this.pv.lv.ilvState, element2.row);
                            this.DoSelect(num, file, element2.row);
                        }
                    }
                    else if (ListViewGUILayout.HasMouseDown(element2.position, 1))
                    {
                        if (this.lv.row != element2.row)
                        {
                            this.DoSelect(num, file, element2.row);
                        }
                        if (!this.isDirSelected && (this.selectedGUID != string.Empty))
                        {
                            GUIUtility.hotControl = 0;
                            Rect rect2 = new Rect(Event.current.mousePosition.x, Event.current.mousePosition.y, 1f, 1f);
                            EditorUtility.DisplayCustomMenu(rect2, this.dropDownMenuItems, null, new EditorUtility.SelectMenuItemFunction(this.ContextMenuClick), null);
                            Event.current.Use();
                        }
                    }
                    if ((element2.row == this.pv.lv.row) && (Event.current.type == EventType.Repaint))
                    {
                        this.constants.entrySelected.Draw(element2.position, false, false, false, false);
                    }
                    if (file != -1)
                    {
                        Texture2D cachedIcon = AssetDatabase.GetCachedIcon(folder.name + "/" + folder.files[file].name) as Texture2D;
                        if (cachedIcon == null)
                        {
                            cachedIcon = InternalEditorUtility.GetIconForFile(folder.files[file].name);
                        }
                        GUILayout.Label(new GUIContent(folder.files[file].name, cachedIcon), this.constants.element, new GUILayoutOption[0]);
                        changeFlags = folder.files[file].changeFlags;
                    }
                    else
                    {
                        GUILayout.Label(folder.name, this.constants.header, new GUILayoutOption[0]);
                        changeFlags = folder.changeFlags;
                    }
                    GUIContent badgeNew = null;
                    if (this.HasFlag(changeFlags, ChangeFlags.Undeleted) || this.HasFlag(changeFlags, ChangeFlags.Created))
                    {
                        badgeNew = ASMainWindow.constants.badgeNew;
                    }
                    else if (this.HasFlag(changeFlags, ChangeFlags.Deleted))
                    {
                        badgeNew = ASMainWindow.constants.badgeDelete;
                    }
                    else if (this.HasFlag(changeFlags, ChangeFlags.Renamed) || this.HasFlag(changeFlags, ChangeFlags.Moved))
                    {
                        badgeNew = ASMainWindow.constants.badgeMove;
                    }
                    if ((badgeNew != null) && (Event.current.type == EventType.Repaint))
                    {
                        Rect rect3 = new Rect(((element2.position.x + element2.position.width) - badgeNew.image.width) - 5f, (element2.position.y + (element2.position.height / 2f)) - (badgeNew.image.height / 2), (float)badgeNew.image.width, (float)badgeNew.image.height);
                        EditorGUIUtility.SetIconSize(Vector2.zero);
                        GUIStyle.none.Draw(rect3, badgeNew, false, false, false, false);
                        EditorGUIUtility.SetIconSize(this.iconSize);
                    }
                    this.pv.NextFileFolder(ref num, ref file);
                }
            }
            finally
            {
                IDisposable disposable2 = enumerator2 as IDisposable;
                if (disposable2 != null)
                {
                    disposable2.Dispose();
                }
            }
            if (this.pv.lv.selectionChanged && (this.selectedGUID != string.Empty))
            {
                if (this.selectedGUID != AssetServer.GetRootGUID())
                {
                    AssetServer.SetSelectionFromGUID(this.selectedGUID);
                }
                else
                {
                    AssetServer.SetSelectionFromGUID(string.Empty);
                }
            }
            if ((GUIUtility.keyboardControl == this.pv.lv.ID) && (((Event.current.type == EventType.KeyDown) && (Event.current.keyCode == KeyCode.Return)) && (!this.isDirSelected && (this.selectedGUID != string.Empty))))
            {
                this.DoShowDiff(false);
                GUIUtility.ExitGUI();
            }
            GUILayout.EndVertical();
            GUILayout.BeginVertical(this.constants.box, new GUILayoutOption[0]);
            GUILayout.Label("Update Message", this.constants.title, new GUILayoutOption[0]);
            GUILayout.TextArea((this.lv.row < 0) ? "" : this.changesets[this.lv.row].message, this.constants.wwText, new GUILayoutOption[0]);
            GUILayout.EndVertical();
            SplitterGUILayout.EndVerticalSplit();
            SplitterGUILayout.EndHorizontalSplit();
        }
All Usage Examples Of UnityEditor.AssetServer::SetSelectionFromGUID
AssetServer