Ejemplo n.º 1
0
        private int CheckParentViewInFilterAndMarkBoldItems(ASHistoryWindow.GUIHistoryListItem item, string text)
        {
            ParentViewState assets = item.assets;
            int             num    = -1;
            int             num2   = 0;

            for (int i = 0; i < assets.folders.Length; i++)
            {
                ParentViewFolder parentViewFolder = assets.folders[i];
                if (parentViewFolder.name.IndexOf(text, StringComparison.InvariantCultureIgnoreCase) != -1)
                {
                    item.boldAssets[num2] = true;
                    if (num == -1)
                    {
                        num = num2;
                    }
                }
                num2++;
                for (int j = 0; j < parentViewFolder.files.Length; j++)
                {
                    if (parentViewFolder.files[j].name.IndexOf(text, StringComparison.InvariantCultureIgnoreCase) != -1)
                    {
                        item.boldAssets[num2] = true;
                        if (num == -1)
                        {
                            num = num2;
                        }
                    }
                    num2++;
                }
            }
            return(num);
        }
Ejemplo n.º 2
0
 private void MarkBoldItemsByGUID(string guid)
 {
     for (int i = 0; i < this.m_GUIItems.Length; i++)
     {
         ASHistoryWindow.GUIHistoryListItem gUIHistoryListItem = this.m_GUIItems[i];
         ParentViewState assets = gUIHistoryListItem.assets;
         int             num    = 0;
         gUIHistoryListItem.boldAssets = new bool[assets.GetLineCount()];
         for (int j = 0; j < assets.folders.Length; j++)
         {
             ParentViewFolder parentViewFolder = assets.folders[j];
             if (parentViewFolder.guid == guid)
             {
                 gUIHistoryListItem.boldAssets[num] = true;
             }
             num++;
             for (int k = 0; k < parentViewFolder.files.Length; k++)
             {
                 if (parentViewFolder.files[k].guid == guid)
                 {
                     gUIHistoryListItem.boldAssets[num] = true;
                 }
                 num++;
             }
         }
     }
 }
Ejemplo n.º 3
0
        private void UncollapseListItem(ref ASHistoryWindow.GUIHistoryListItem item)
        {
            int num = (item.collapsedItemCount - 1) * this.m_RowHeight;

            item.collapsedItemCount = 0;
            item.startShowingFrom   = 0;
            item.height            += num;
            this.m_TotalHeight     += num;
        }
Ejemplo n.º 4
0
        private int MarkBoldItemsBySelection(ASHistoryWindow.GUIHistoryListItem item)
        {
            List <string>   list   = new List <string>();
            ParentViewState assets = item.assets;
            int             num    = -1;
            int             num2   = 0;

            if (Selection.instanceIDs.Length == 0)
            {
                return(0);
            }
            int[] instanceIDs = Selection.instanceIDs;
            for (int i = 0; i < instanceIDs.Length; i++)
            {
                int instanceID = instanceIDs[i];
                list.Add(AssetDatabase.AssetPathToGUID(AssetDatabase.GetAssetPath(instanceID)));
            }
            for (int j = 0; j < assets.folders.Length; j++)
            {
                ParentViewFolder parentViewFolder = assets.folders[j];
                if (list.Contains(parentViewFolder.guid))
                {
                    item.boldAssets[num2] = true;
                    if (num == -1)
                    {
                        num = num2;
                    }
                }
                num2++;
                for (int k = 0; k < parentViewFolder.files.Length; k++)
                {
                    if (list.Contains(parentViewFolder.files[k].guid))
                    {
                        item.boldAssets[num2] = true;
                        if (num == -1)
                        {
                            num = num2;
                        }
                    }
                    num2++;
                }
            }
            return(num);
        }
Ejemplo n.º 5
0
        private void DrawParentView(Rect r, ref ASHistoryWindow.GUIHistoryListItem item, int changesetIndex, bool hasFocus)
        {
            ParentViewState assets     = item.assets;
            GUIContent      gUIContent = new GUIContent();
            Texture2D       image      = EditorGUIUtility.FindTexture(EditorResourcesUtility.folderIconName);
            Event           current    = Event.current;

            hasFocus &= (this.m_HistoryControlID == GUIUtility.keyboardControl);
            r.height  = (float)this.m_RowHeight;
            r.y      += 3f;
            int num  = -1;
            int num2 = (item.collapsedItemCount == 0) ? item.totalLineCount : 4;

            num2 += item.startShowingFrom;
            for (int i = 0; i < assets.folders.Length; i++)
            {
                ParentViewFolder parentViewFolder = assets.folders[i];
                gUIContent.text  = parentViewFolder.name;
                gUIContent.image = image;
                num++;
                if (num == num2)
                {
                    break;
                }
                if (num >= item.startShowingFrom)
                {
                    GUIStyle label = ASHistoryWindow.ms_Style.label;
                    if (current.type == EventType.MouseDown && r.Contains(current.mousePosition))
                    {
                        if (this.ChangeLogSelectionRev == this.m_Changesets[changesetIndex].changeset && this.m_ChangeLogSelectionGUID == parentViewFolder.guid && EditorGUI.actionKey)
                        {
                            this.ClearItemSelection();
                        }
                        else
                        {
                            this.ChangeLogSelectionRev         = this.m_Changesets[changesetIndex].changeset;
                            this.m_ChangeLogSelectionGUID      = parentViewFolder.guid;
                            this.m_ChangeLogSelectionAssetName = parentViewFolder.name;
                            this.m_FolderSelected      = true;
                            this.m_AssetSelectionIndex = num;
                        }
                        this.m_ChangesetSelectionIndex = changesetIndex;
                        GUIUtility.keyboardControl     = this.m_HistoryControlID;
                        ((ASMainWindow)this.m_ParentWindow).m_SearchToShow = ASMainWindow.ShowSearchField.HistoryList;
                        if (current.clickCount == 2)
                        {
                            this.ShowAssetsHistory();
                            GUIUtility.ExitGUI();
                        }
                        else
                        {
                            if (current.button == 1)
                            {
                                GUIUtility.hotControl = 0;
                                r = new Rect(current.mousePosition.x, current.mousePosition.y, 1f, 1f);
                                EditorUtility.DisplayCustomMenu(r, this.m_DropDownMenuItems, -1, new EditorUtility.SelectMenuItemFunction(this.ContextMenuClick), null);
                            }
                        }
                        this.DoScroll();
                        current.Use();
                    }
                    bool flag = this.ChangeLogSelectionRev == this.m_Changesets[changesetIndex].changeset && this.m_ChangeLogSelectionGUID == parentViewFolder.guid;
                    if (item.boldAssets[num] && !flag)
                    {
                        GUI.Label(r, string.Empty, ASHistoryWindow.ms_Style.ping);
                    }
                    if (Event.current.type == EventType.Repaint)
                    {
                        label.Draw(r, gUIContent, false, false, flag, hasFocus);
                        this.DrawBadge(r, parentViewFolder.changeFlags, label, gUIContent, GUIClip.visibleRect.width - 150f);
                    }
                    r.y += (float)this.m_RowHeight;
                }
                ASHistoryWindow.ms_Style.label.padding.left     += 16;
                ASHistoryWindow.ms_Style.boldLabel.padding.left += 16;
                try
                {
                    for (int j = 0; j < parentViewFolder.files.Length; j++)
                    {
                        num++;
                        if (num == num2)
                        {
                            break;
                        }
                        if (num >= item.startShowingFrom)
                        {
                            GUIStyle label = ASHistoryWindow.ms_Style.label;
                            if (current.type == EventType.MouseDown && r.Contains(current.mousePosition))
                            {
                                if (this.ChangeLogSelectionRev == this.m_Changesets[changesetIndex].changeset && this.m_ChangeLogSelectionGUID == parentViewFolder.files[j].guid && EditorGUI.actionKey)
                                {
                                    this.ClearItemSelection();
                                }
                                else
                                {
                                    this.ChangeLogSelectionRev         = this.m_Changesets[changesetIndex].changeset;
                                    this.m_ChangeLogSelectionGUID      = parentViewFolder.files[j].guid;
                                    this.m_ChangeLogSelectionAssetName = parentViewFolder.files[j].name;
                                    this.m_FolderSelected      = false;
                                    this.m_AssetSelectionIndex = num;
                                }
                                this.m_ChangesetSelectionIndex = changesetIndex;
                                GUIUtility.keyboardControl     = this.m_HistoryControlID;
                                ((ASMainWindow)this.m_ParentWindow).m_SearchToShow = ASMainWindow.ShowSearchField.HistoryList;
                                if (current.clickCount == 2)
                                {
                                    if (this.IsComparableAssetSelected() && this.m_SelectedGUID == this.m_ChangeLogSelectionGUID)
                                    {
                                        this.DoShowDiff(false, this.ChangeLogSelectionRev, -1);
                                    }
                                    else
                                    {
                                        this.ShowAssetsHistory();
                                        GUIUtility.ExitGUI();
                                    }
                                }
                                else
                                {
                                    if (current.button == 1)
                                    {
                                        GUIUtility.hotControl = 0;
                                        r = new Rect(current.mousePosition.x, current.mousePosition.y, 1f, 1f);
                                        EditorUtility.DisplayCustomMenu(r, this.m_DropDownMenuItems, -1, new EditorUtility.SelectMenuItemFunction(this.ContextMenuClick), null);
                                    }
                                }
                                this.DoScroll();
                                current.Use();
                            }
                            gUIContent.text  = parentViewFolder.files[j].name;
                            gUIContent.image = InternalEditorUtility.GetIconForFile(parentViewFolder.files[j].name);
                            bool flag2 = this.ChangeLogSelectionRev == this.m_Changesets[changesetIndex].changeset && this.m_ChangeLogSelectionGUID == parentViewFolder.files[j].guid;
                            if (item.boldAssets[num] && !flag2)
                            {
                                GUI.Label(r, string.Empty, ASHistoryWindow.ms_Style.ping);
                            }
                            if (Event.current.type == EventType.Repaint)
                            {
                                label.Draw(r, gUIContent, false, false, flag2, hasFocus);
                                this.DrawBadge(r, parentViewFolder.files[j].changeFlags, label, gUIContent, GUIClip.visibleRect.width - 150f);
                            }
                            r.y += (float)this.m_RowHeight;
                        }
                    }
                    if (num == num2)
                    {
                        break;
                    }
                }
                finally
                {
                    ASHistoryWindow.ms_Style.label.padding.left     -= 16;
                    ASHistoryWindow.ms_Style.boldLabel.padding.left -= 16;
                }
            }
            if ((num == num2 || num2 >= item.totalLineCount) && item.collapsedItemCount != 0)
            {
                r.x += 19f;
                if (GUI.Button(r, item.collapsedItemCount.ToString() + " more...", ASHistoryWindow.ms_Style.foldout))
                {
                    GUIUtility.keyboardControl = this.m_HistoryControlID;
                    this.UncollapseListItem(ref item);
                }
            }
        }