コード例 #1
0
        private void KeyboardGUI(ASHistoryWindow parentWin)
        {
            if (Event.current.GetTypeForControl(this.m_FileViewControlID) != EventType.KeyDown || this.m_FileViewControlID != GUIUtility.keyboardControl)
            {
                return;
            }
            switch (this.SelType)
            {
            case ASHistoryFileView.SelectionType.All:
                this.AllProjectKeyboard();
                break;

            case ASHistoryFileView.SelectionType.Items:
                this.AssetViewKeyboard();
                break;

            case ASHistoryFileView.SelectionType.DeletedItemsRoot:
                this.DeletedItemsRootKeyboard(parentWin);
                break;

            case ASHistoryFileView.SelectionType.DeletedItems:
                this.DeletedItemsKeyboard(parentWin);
                break;
            }
        }
コード例 #2
0
        private void DeletedItemsRootKeyboard(ASHistoryWindow parentWin)
        {
            switch (Event.current.keyCode)
            {
            case KeyCode.UpArrow:
                this.SelType = ASHistoryFileView.SelectionType.Items;
                if (this.GetLast() != null)
                {
                    Selection.activeObject = this.GetLast().pptrValue;
                    this.FrameObject(Selection.activeObject);
                    break;
                }
                break;

            case KeyCode.DownArrow:
                if (this.m_DelPVstate.selectedItems.Length > 0 && this.DeletedItemsToggle)
                {
                    this.SelType = ASHistoryFileView.SelectionType.DeletedItems;
                    this.m_DelPVstate.selectedItems[0] = true;
                    this.m_DelPVstate.lv.row           = 0;
                    this.ScrollToDeletedItem(0);
                    break;
                }
                break;

            case KeyCode.RightArrow:
                this.DeletedItemsToggle = true;
                break;

            case KeyCode.LeftArrow:
                this.DeletedItemsToggle = false;
                break;

            default:
                return;
            }
            if (this.SelType != ASHistoryFileView.SelectionType.Items)
            {
                parentWin.DoLocalSelectionChange();
            }
            Event.current.Use();
        }
コード例 #3
0
 public void DoDeletedItemsGUI(ASHistoryWindow parentWin, Rect theRect, GUIStyle s, float offset, float endOffset, bool focused)
 {
   Event current = Event.current;
   Texture2D texture = EditorGUIUtility.FindTexture(EditorResourcesUtility.folderIconName);
   offset += 3f;
   Rect position1 = new Rect(this.m_Indent, offset, theRect.width - this.m_Indent, ASHistoryFileView.m_RowHeight);
   if (current.type == EventType.MouseDown && position1.Contains(current.mousePosition))
   {
     GUIUtility.keyboardControl = this.m_FileViewControlID;
     this.SelType = ASHistoryFileView.SelectionType.DeletedItemsRoot;
     this.ScrollToDeletedItem(-1);
     parentWin.DoLocalSelectionChange();
   }
   position1.width -= position1.x;
   position1.x = 0.0f;
   GUIContent content = new GUIContent("Deleted Assets");
   content.image = (Texture) texture;
   int baseIndent = (int) this.m_BaseIndent;
   s.padding.left = baseIndent;
   if (current.type == EventType.Repaint)
     s.Draw(position1, content, false, false, this.SelType == ASHistoryFileView.SelectionType.DeletedItemsRoot, focused);
   Rect position2 = new Rect(this.m_BaseIndent - this.m_FoldoutSize, offset, this.m_FoldoutSize, ASHistoryFileView.m_RowHeight);
   if (!this.m_DeletedItemsInitialized || this.m_DelPVstate.lv.totalRows != 0)
     this.DeletedItemsToggle = GUI.Toggle(position2, this.DeletedItemsToggle, GUIContent.none, ASHistoryFileView.ms_Styles.foldout);
   offset += ASHistoryFileView.m_RowHeight;
   if (!this.DeletedItemsToggle)
     return;
   int row = this.m_DelPVstate.lv.row;
   int index1 = 0;
   int folder1 = -1;
   int file = -1;
   int index2 = 0;
   while ((double) offset <= (double) endOffset && index2 < this.m_DelPVstate.lv.totalRows)
   {
     if ((double) offset + (double) ASHistoryFileView.m_RowHeight >= 0.0)
     {
       if (folder1 == -1)
         this.m_DelPVstate.IndexToFolderAndFile(index2, ref folder1, ref file);
       position1 = new Rect(0.0f, offset, (float) Screen.width, ASHistoryFileView.m_RowHeight);
       ParentViewFolder folder2 = this.m_DelPVstate.folders[folder1];
       if (current.type == EventType.MouseDown && position1.Contains(current.mousePosition))
       {
         if (current.button != 1 || this.SelType != ASHistoryFileView.SelectionType.DeletedItems || !this.m_DelPVstate.selectedItems[index1])
         {
           GUIUtility.keyboardControl = this.m_FileViewControlID;
           this.SelType = ASHistoryFileView.SelectionType.DeletedItems;
           this.m_DelPVstate.lv.row = index1;
           ListViewShared.MultiSelection((ListViewShared.InternalListViewState) null, row, this.m_DelPVstate.lv.row, ref this.m_DelPVstate.initialSelectedItem, ref this.m_DelPVstate.selectedItems);
           this.ScrollToDeletedItem(index1);
           parentWin.DoLocalSelectionChange();
         }
         if (current.button == 1 && this.SelType == ASHistoryFileView.SelectionType.DeletedItems)
         {
           GUIUtility.hotControl = 0;
           EditorUtility.DisplayCustomMenu(new Rect(current.mousePosition.x, current.mousePosition.y, 1f, 1f), this.dropDownMenuItems, -1, new EditorUtility.SelectMenuItemFunction(this.ContextMenuClick), (object) null);
         }
         Event.current.Use();
       }
       int num;
       if (file != -1)
       {
         content.text = folder2.files[file].name;
         content.image = (Texture) InternalEditorUtility.GetIconForFile(folder2.files[file].name);
         num = (int) ((double) this.m_BaseIndent + (double) this.m_Indent * 2.0);
       }
       else
       {
         content.text = folder2.name;
         content.image = (Texture) texture;
         num = (int) ((double) this.m_BaseIndent + (double) this.m_Indent);
       }
       s.padding.left = num;
       if (Event.current.type == EventType.Repaint)
         s.Draw(position1, content, false, false, this.m_DelPVstate.selectedItems[index1], focused);
       this.m_DelPVstate.NextFileFolder(ref folder1, ref file);
       ++index1;
     }
     ++index2;
     offset += ASHistoryFileView.m_RowHeight;
   }
 }
コード例 #4
0
        public void DoGUI(ASHistoryWindow parentWin, Rect theRect, bool focused)
        {
            if (ms_Styles == null)
            {
                ms_Styles = new Styles();
            }
            this.m_ScreenRect = theRect;
            Hashtable hashtable = new Hashtable();
            foreach (UnityEngine.Object obj2 in Selection.objects)
            {
                hashtable.Add(obj2.GetInstanceID(), null);
            }
            this.m_FileViewControlID = GUIUtility.GetControlID(ms_FileViewHash, FocusType.Native);
            this.KeyboardGUI(parentWin);
            focused &= GUIUtility.keyboardControl == this.m_FileViewControlID;
            HierarchyProperty property = new HierarchyProperty(HierarchyType.Assets);
            int num2 = property.CountRemaining(this.m_ExpandedArray);
            int num3 = !this.DeletedItemsToggle ? 0 : this.m_DelPVstate.lv.totalRows;
            Rect viewRect = new Rect(0f, 0f, 1f, (((num2 + 2) + num3) * m_RowHeight) + 16f);
            this.m_ScrollPosition = GUI.BeginScrollView(this.m_ScreenRect, this.m_ScrollPosition, viewRect);
            theRect.width = (viewRect.height <= this.m_ScreenRect.height) ? theRect.width : (theRect.width - 18f);
            int count = Mathf.RoundToInt((this.m_ScrollPosition.y - 6f) - m_RowHeight) / Mathf.RoundToInt(m_RowHeight);
            if (count > num2)
            {
                count = num2;
            }
            else if (count < 0)
            {
                count = 0;
                this.m_ScrollPosition.y = 0f;
            }
            float y = 0f;
            GUIContent content = new GUIContent();
            Event current = Event.current;
            GUIStyle s = new GUIStyle(ms_Styles.label);
            Texture2D textured = EditorGUIUtility.FindTexture(EditorResourcesUtility.folderIconName);
            y = (count * m_RowHeight) + 3f;
            float endOffset = this.m_ScreenRect.height + this.m_ScrollPosition.y;
            Rect position = new Rect(0f, y, theRect.width, m_RowHeight);
            if ((current.type == EventType.MouseDown) && position.Contains(current.mousePosition))
            {
                this.SelType = SelectionType.All;
                GUIUtility.keyboardControl = this.m_FileViewControlID;
                this.ScrollTo(0f);
                parentWin.DoLocalSelectionChange();
                current.Use();
            }
            content = new GUIContent("Entire Project") {
                image = textured
            };
            int baseIndent = (int) this.m_BaseIndent;
            s.padding.left = 3;
            if (Event.current.type == EventType.Repaint)
            {
                s.Draw(position, content, false, false, this.SelType == SelectionType.All, focused);
            }
            y += m_RowHeight + 3f;
            property.Reset();
            property.Skip(count, this.m_ExpandedArray);
            while (property.Next(this.m_ExpandedArray) && (y <= endOffset))
            {
                int instanceID = property.instanceID;
                position = new Rect(0f, y, theRect.width, m_RowHeight);
                if (Event.current.type == EventType.Repaint)
                {
                    content.text = property.name;
                    content.image = property.icon;
                    baseIndent = (int) (this.m_BaseIndent + (this.m_Indent * property.depth));
                    s.padding.left = baseIndent;
                    bool on = hashtable.Contains(instanceID);
                    s.Draw(position, content, false, false, on, focused);
                }
                if (property.hasChildren)
                {
                    bool flag2 = property.IsExpanded(this.m_ExpandedArray);
                    GUI.changed = false;
                    Rect rect3 = new Rect((this.m_BaseIndent + (this.m_Indent * property.depth)) - this.m_FoldoutSize, y, this.m_FoldoutSize, m_RowHeight);
                    flag2 = GUI.Toggle(rect3, flag2, GUIContent.none, ms_Styles.foldout);
                    if (GUI.changed)
                    {
                        if (Event.current.alt)
                        {
                            this.SetExpandedRecurse(instanceID, flag2);
                        }
                        else
                        {
                            this.SetExpanded(instanceID, flag2);
                        }
                    }
                }
                if (((current.type == EventType.MouseDown) && (Event.current.button == 0)) && position.Contains(Event.current.mousePosition))
                {
                    GUIUtility.keyboardControl = this.m_FileViewControlID;
                    if (Event.current.clickCount == 2)
                    {
                        AssetDatabase.OpenAsset(instanceID);
                        GUIUtility.ExitGUI();
                    }
                    else if (position.Contains(current.mousePosition))
                    {
                        this.SelectionClick(property);
                    }
                    current.Use();
                }
                y += m_RowHeight;
            }
            y += 3f;
            this.DoDeletedItemsGUI(parentWin, theRect, s, y, endOffset, focused);
            GUI.EndScrollView();
            switch (current.type)
            {
                case EventType.MouseDown:
                    if ((current.button == 0) && this.m_ScreenRect.Contains(current.mousePosition))
                    {
                        GUIUtility.hotControl = this.m_FileViewControlID;
                        current.Use();
                    }
                    break;

                case EventType.MouseUp:
                    if (GUIUtility.hotControl == this.m_FileViewControlID)
                    {
                        if (this.m_ScreenRect.Contains(current.mousePosition))
                        {
                            Selection.activeObject = null;
                        }
                        GUIUtility.hotControl = 0;
                        current.Use();
                    }
                    break;
            }
            this.HandleFraming();
        }
コード例 #5
0
 public void InitHistoryPage(bool lastActionsResult)
 {
   if (!lastActionsResult)
   {
     this.Reinit();
   }
   else
   {
     this.asHistoryWin = new ASHistoryWindow((EditorWindow) this);
     if (this.asHistoryWin != null)
       return;
     this.Reinit();
   }
 }
コード例 #6
0
        public void DoDeletedItemsGUI(ASHistoryWindow parentWin, Rect theRect, GUIStyle s, float offset, float endOffset, bool focused)
        {
            Event     current  = Event.current;
            Texture2D textured = EditorGUIUtility.FindTexture(EditorResourcesUtility.folderIconName);

            offset += 3f;
            Rect position = new Rect(this.m_Indent, offset, theRect.width - this.m_Indent, m_RowHeight);

            if ((current.type == EventType.MouseDown) && position.Contains(current.mousePosition))
            {
                GUIUtility.keyboardControl = this.m_FileViewControlID;
                this.SelType = SelectionType.DeletedItemsRoot;
                this.ScrollToDeletedItem(-1);
                parentWin.DoLocalSelectionChange();
            }
            position.width -= position.x;
            position.x      = 0f;
            GUIContent content = new GUIContent("Deleted Assets")
            {
                image = textured
            };
            int baseIndent = (int)this.m_BaseIndent;

            s.padding.left = baseIndent;
            if (current.type == EventType.Repaint)
            {
                s.Draw(position, content, false, false, this.SelType == SelectionType.DeletedItemsRoot, focused);
            }
            Rect rect2 = new Rect(this.m_BaseIndent - this.m_FoldoutSize, offset, this.m_FoldoutSize, m_RowHeight);

            if (!this.m_DeletedItemsInitialized || (this.m_DelPVstate.lv.totalRows != 0))
            {
                this.DeletedItemsToggle = GUI.Toggle(rect2, this.DeletedItemsToggle, GUIContent.none, ms_Styles.foldout);
            }
            offset += m_RowHeight;
            if (this.DeletedItemsToggle)
            {
                int row   = this.m_DelPVstate.lv.row;
                int index = 0;
                int num4  = -1;
                int file  = -1;
                int num6  = 0;
                while ((offset <= endOffset) && (num6 < this.m_DelPVstate.lv.totalRows))
                {
                    if ((offset + m_RowHeight) >= 0f)
                    {
                        if (num4 == -1)
                        {
                            this.m_DelPVstate.IndexToFolderAndFile(num6, ref num4, ref file);
                        }
                        position = new Rect(0f, offset, (float)Screen.width, m_RowHeight);
                        ParentViewFolder folder = this.m_DelPVstate.folders[num4];
                        if ((current.type == EventType.MouseDown) && position.Contains(current.mousePosition))
                        {
                            if (!(((current.button == 1) && (this.SelType == SelectionType.DeletedItems)) && this.m_DelPVstate.selectedItems[index]))
                            {
                                GUIUtility.keyboardControl = this.m_FileViewControlID;
                                this.SelType             = SelectionType.DeletedItems;
                                this.m_DelPVstate.lv.row = index;
                                ListViewShared.MultiSelection(null, row, this.m_DelPVstate.lv.row, ref this.m_DelPVstate.initialSelectedItem, ref this.m_DelPVstate.selectedItems);
                                this.ScrollToDeletedItem(index);
                                parentWin.DoLocalSelectionChange();
                            }
                            if ((current.button == 1) && (this.SelType == SelectionType.DeletedItems))
                            {
                                GUIUtility.hotControl = 0;
                                Rect rect3 = new Rect(current.mousePosition.x, current.mousePosition.y, 1f, 1f);
                                EditorUtility.DisplayCustomMenu(rect3, this.dropDownMenuItems, -1, new EditorUtility.SelectMenuItemFunction(this.ContextMenuClick), null);
                            }
                            Event.current.Use();
                        }
                        if (file != -1)
                        {
                            content.text  = folder.files[file].name;
                            content.image = InternalEditorUtility.GetIconForFile(folder.files[file].name);
                            baseIndent    = (int)(this.m_BaseIndent + (this.m_Indent * 2f));
                        }
                        else
                        {
                            content.text  = folder.name;
                            content.image = textured;
                            baseIndent    = (int)(this.m_BaseIndent + this.m_Indent);
                        }
                        s.padding.left = baseIndent;
                        if (Event.current.type == EventType.Repaint)
                        {
                            s.Draw(position, content, false, false, this.m_DelPVstate.selectedItems[index], focused);
                        }
                        this.m_DelPVstate.NextFileFolder(ref num4, ref file);
                        index++;
                    }
                    num6++;
                    offset += m_RowHeight;
                }
            }
        }
コード例 #7
0
		public void DoGUI(ASHistoryWindow parentWin, Rect theRect, bool focused)
		{
			if (ASHistoryFileView.ms_Styles == null)
			{
				ASHistoryFileView.ms_Styles = new ASHistoryFileView.Styles();
			}
			this.m_ScreenRect = theRect;
			Hashtable hashtable = new Hashtable();
			UnityEngine.Object[] objects = Selection.objects;
			for (int i = 0; i < objects.Length; i++)
			{
				UnityEngine.Object @object = objects[i];
				hashtable.Add(@object.GetInstanceID(), null);
			}
			this.m_FileViewControlID = GUIUtility.GetControlID(ASHistoryFileView.ms_FileViewHash, FocusType.Native);
			this.KeyboardGUI(parentWin);
			focused &= (GUIUtility.keyboardControl == this.m_FileViewControlID);
			HierarchyProperty hierarchyProperty = new HierarchyProperty(HierarchyType.Assets);
			int num = hierarchyProperty.CountRemaining(this.m_ExpandedArray);
			int num2 = (!this.DeletedItemsToggle) ? 0 : this.m_DelPVstate.lv.totalRows;
			Rect viewRect = new Rect(0f, 0f, 1f, (float)(num + 2 + num2) * ASHistoryFileView.m_RowHeight + 16f);
			this.m_ScrollPosition = GUI.BeginScrollView(this.m_ScreenRect, this.m_ScrollPosition, viewRect);
			theRect.width = ((viewRect.height <= this.m_ScreenRect.height) ? theRect.width : (theRect.width - 18f));
			int num3 = Mathf.RoundToInt(this.m_ScrollPosition.y - 6f - ASHistoryFileView.m_RowHeight) / Mathf.RoundToInt(ASHistoryFileView.m_RowHeight);
			if (num3 > num)
			{
				num3 = num;
			}
			else
			{
				if (num3 < 0)
				{
					num3 = 0;
					this.m_ScrollPosition.y = 0f;
				}
			}
			GUIContent gUIContent = new GUIContent();
			Event current = Event.current;
			GUIStyle gUIStyle = new GUIStyle(ASHistoryFileView.ms_Styles.label);
			Texture2D image = EditorGUIUtility.FindTexture(EditorResourcesUtility.folderIconName);
			float num4 = (float)num3 * ASHistoryFileView.m_RowHeight + 3f;
			float num5 = this.m_ScreenRect.height + this.m_ScrollPosition.y;
			Rect position = new Rect(0f, num4, theRect.width, ASHistoryFileView.m_RowHeight);
			if (current.type == EventType.MouseDown && position.Contains(current.mousePosition))
			{
				this.SelType = ASHistoryFileView.SelectionType.All;
				GUIUtility.keyboardControl = this.m_FileViewControlID;
				this.ScrollTo(0f);
				parentWin.DoLocalSelectionChange();
				current.Use();
			}
			gUIContent = new GUIContent("Entire Project");
			gUIContent.image = image;
			int left = (int)this.m_BaseIndent;
			gUIStyle.padding.left = 3;
			if (Event.current.type == EventType.Repaint)
			{
				gUIStyle.Draw(position, gUIContent, false, false, this.SelType == ASHistoryFileView.SelectionType.All, focused);
			}
			num4 += ASHistoryFileView.m_RowHeight + 3f;
			hierarchyProperty.Reset();
			hierarchyProperty.Skip(num3, this.m_ExpandedArray);
			while (hierarchyProperty.Next(this.m_ExpandedArray) && num4 <= num5)
			{
				int instanceID = hierarchyProperty.instanceID;
				position = new Rect(0f, num4, theRect.width, ASHistoryFileView.m_RowHeight);
				if (Event.current.type == EventType.Repaint)
				{
					gUIContent.text = hierarchyProperty.name;
					gUIContent.image = hierarchyProperty.icon;
					left = (int)(this.m_BaseIndent + this.m_Indent * (float)hierarchyProperty.depth);
					gUIStyle.padding.left = left;
					bool on = hashtable.Contains(instanceID);
					gUIStyle.Draw(position, gUIContent, false, false, on, focused);
				}
				if (hierarchyProperty.hasChildren)
				{
					bool flag = hierarchyProperty.IsExpanded(this.m_ExpandedArray);
					GUI.changed = false;
					Rect position2 = new Rect(this.m_BaseIndent + this.m_Indent * (float)hierarchyProperty.depth - this.m_FoldoutSize, num4, this.m_FoldoutSize, ASHistoryFileView.m_RowHeight);
					flag = GUI.Toggle(position2, flag, GUIContent.none, ASHistoryFileView.ms_Styles.foldout);
					if (GUI.changed)
					{
						if (Event.current.alt)
						{
							this.SetExpandedRecurse(instanceID, flag);
						}
						else
						{
							this.SetExpanded(instanceID, flag);
						}
					}
				}
				if (current.type == EventType.MouseDown && Event.current.button == 0 && position.Contains(Event.current.mousePosition))
				{
					GUIUtility.keyboardControl = this.m_FileViewControlID;
					if (Event.current.clickCount == 2)
					{
						AssetDatabase.OpenAsset(instanceID);
						GUIUtility.ExitGUI();
					}
					else
					{
						if (position.Contains(current.mousePosition))
						{
							this.SelectionClick(hierarchyProperty);
						}
					}
					current.Use();
				}
				num4 += ASHistoryFileView.m_RowHeight;
			}
			num4 += 3f;
			this.DoDeletedItemsGUI(parentWin, theRect, gUIStyle, num4, num5, focused);
			GUI.EndScrollView();
			EventType type = current.type;
			if (type != EventType.MouseDown)
			{
				if (type == EventType.MouseUp)
				{
					if (GUIUtility.hotControl == this.m_FileViewControlID)
					{
						if (this.m_ScreenRect.Contains(current.mousePosition))
						{
							Selection.activeObject = null;
						}
						GUIUtility.hotControl = 0;
						current.Use();
					}
				}
			}
			else
			{
				if (current.button == 0 && this.m_ScreenRect.Contains(current.mousePosition))
				{
					GUIUtility.hotControl = this.m_FileViewControlID;
					current.Use();
				}
			}
			this.HandleFraming();
		}
コード例 #8
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;
		}
コード例 #9
0
 private int MarkBoldItemsBySelection(ASHistoryWindow.GUIHistoryListItem item)
 {
   List<string> stringList = new List<string>();
   ParentViewState assets = item.assets;
   int num = -1;
   int index1 = 0;
   if (Selection.instanceIDs.Length == 0)
     return 0;
   foreach (int instanceId in Selection.instanceIDs)
     stringList.Add(AssetDatabase.AssetPathToGUID(AssetDatabase.GetAssetPath(instanceId)));
   for (int index2 = 0; index2 < assets.folders.Length; ++index2)
   {
     ParentViewFolder folder = assets.folders[index2];
     if (stringList.Contains(folder.guid))
     {
       item.boldAssets[index1] = true;
       if (num == -1)
         num = index1;
     }
     ++index1;
     for (int index3 = 0; index3 < folder.files.Length; ++index3)
     {
       if (stringList.Contains(folder.files[index3].guid))
       {
         item.boldAssets[index1] = true;
         if (num == -1)
           num = index1;
       }
       ++index1;
     }
   }
   return num;
 }
コード例 #10
0
		private void KeyboardGUI(ASHistoryWindow parentWin)
		{
			if (Event.current.GetTypeForControl(this.m_FileViewControlID) != EventType.KeyDown || this.m_FileViewControlID != GUIUtility.keyboardControl)
			{
				return;
			}
			switch (this.SelType)
			{
			case ASHistoryFileView.SelectionType.All:
				this.AllProjectKeyboard();
				break;
			case ASHistoryFileView.SelectionType.Items:
				this.AssetViewKeyboard();
				break;
			case ASHistoryFileView.SelectionType.DeletedItemsRoot:
				this.DeletedItemsRootKeyboard(parentWin);
				break;
			case ASHistoryFileView.SelectionType.DeletedItems:
				this.DeletedItemsKeyboard(parentWin);
				break;
			}
		}
コード例 #11
0
        public void DoDeletedItemsGUI(ASHistoryWindow parentWin, Rect theRect, GUIStyle s, float offset, float endOffset, bool focused)
        {
            Event     current = Event.current;
            Texture2D image   = EditorGUIUtility.FindTexture(EditorResourcesUtility.folderIconName);

            offset += 3f;
            Rect position = new Rect(this.m_Indent, offset, theRect.width - this.m_Indent, ASHistoryFileView.m_RowHeight);

            if (current.type == EventType.MouseDown && position.Contains(current.mousePosition))
            {
                GUIUtility.keyboardControl = this.m_FileViewControlID;
                this.SelType = ASHistoryFileView.SelectionType.DeletedItemsRoot;
                this.ScrollToDeletedItem(-1);
                parentWin.DoLocalSelectionChange();
            }
            position.width -= position.x;
            position.x      = 0f;
            GUIContent gUIContent = new GUIContent("Deleted Assets");

            gUIContent.image = image;
            int left = (int)this.m_BaseIndent;

            s.padding.left = left;
            if (current.type == EventType.Repaint)
            {
                s.Draw(position, gUIContent, false, false, this.SelType == ASHistoryFileView.SelectionType.DeletedItemsRoot, focused);
            }
            Rect position2 = new Rect(this.m_BaseIndent - this.m_FoldoutSize, offset, this.m_FoldoutSize, ASHistoryFileView.m_RowHeight);

            if (!this.m_DeletedItemsInitialized || this.m_DelPVstate.lv.totalRows != 0)
            {
                this.DeletedItemsToggle = GUI.Toggle(position2, this.DeletedItemsToggle, GUIContent.none, ASHistoryFileView.ms_Styles.foldout);
            }
            offset += ASHistoryFileView.m_RowHeight;
            if (this.DeletedItemsToggle)
            {
                int row  = this.m_DelPVstate.lv.row;
                int num  = 0;
                int num2 = -1;
                int num3 = -1;
                int num4 = 0;
                while (offset <= endOffset && num4 < this.m_DelPVstate.lv.totalRows)
                {
                    if (offset + ASHistoryFileView.m_RowHeight >= 0f)
                    {
                        if (num2 == -1)
                        {
                            this.m_DelPVstate.IndexToFolderAndFile(num4, ref num2, ref num3);
                        }
                        position = new Rect(0f, offset, (float)Screen.width, ASHistoryFileView.m_RowHeight);
                        ParentViewFolder parentViewFolder = this.m_DelPVstate.folders[num2];
                        if (current.type == EventType.MouseDown && position.Contains(current.mousePosition))
                        {
                            if (current.button != 1 || this.SelType != ASHistoryFileView.SelectionType.DeletedItems || !this.m_DelPVstate.selectedItems[num])
                            {
                                GUIUtility.keyboardControl = this.m_FileViewControlID;
                                this.SelType             = ASHistoryFileView.SelectionType.DeletedItems;
                                this.m_DelPVstate.lv.row = num;
                                ListViewShared.MultiSelection(null, row, this.m_DelPVstate.lv.row, ref this.m_DelPVstate.initialSelectedItem, ref this.m_DelPVstate.selectedItems);
                                this.ScrollToDeletedItem(num);
                                parentWin.DoLocalSelectionChange();
                            }
                            if (current.button == 1 && this.SelType == ASHistoryFileView.SelectionType.DeletedItems)
                            {
                                GUIUtility.hotControl = 0;
                                Rect position3 = new Rect(current.mousePosition.x, current.mousePosition.y, 1f, 1f);
                                EditorUtility.DisplayCustomMenu(position3, this.dropDownMenuItems, -1, new EditorUtility.SelectMenuItemFunction(this.ContextMenuClick), null);
                            }
                            Event.current.Use();
                        }
                        if (num3 != -1)
                        {
                            gUIContent.text  = parentViewFolder.files[num3].name;
                            gUIContent.image = InternalEditorUtility.GetIconForFile(parentViewFolder.files[num3].name);
                            left             = (int)(this.m_BaseIndent + this.m_Indent * 2f);
                        }
                        else
                        {
                            gUIContent.text  = parentViewFolder.name;
                            gUIContent.image = image;
                            left             = (int)(this.m_BaseIndent + this.m_Indent);
                        }
                        s.padding.left = left;
                        if (Event.current.type == EventType.Repaint)
                        {
                            s.Draw(position, gUIContent, false, false, this.m_DelPVstate.selectedItems[num], focused);
                        }
                        this.m_DelPVstate.NextFileFolder(ref num2, ref num3);
                        num++;
                    }
                    num4++;
                    offset += ASHistoryFileView.m_RowHeight;
                }
            }
        }
コード例 #12
0
        public void DoGUI(ASHistoryWindow parentWin, Rect theRect, bool focused)
        {
            if (ASHistoryFileView.ms_Styles == null)
            {
                ASHistoryFileView.ms_Styles = new ASHistoryFileView.Styles();
            }
            this.m_ScreenRect = theRect;
            Hashtable hashtable = new Hashtable();

            UnityEngine.Object[] objects = Selection.objects;
            for (int i = 0; i < objects.Length; i++)
            {
                UnityEngine.Object @object = objects[i];
                hashtable.Add(@object.GetInstanceID(), null);
            }
            this.m_FileViewControlID = GUIUtility.GetControlID(ASHistoryFileView.ms_FileViewHash, FocusType.Passive);
            this.KeyboardGUI(parentWin);
            focused &= (GUIUtility.keyboardControl == this.m_FileViewControlID);
            HierarchyProperty hierarchyProperty = new HierarchyProperty(HierarchyType.Assets);
            int  num      = hierarchyProperty.CountRemaining(this.m_ExpandedArray);
            int  num2     = (!this.DeletedItemsToggle) ? 0 : this.m_DelPVstate.lv.totalRows;
            Rect viewRect = new Rect(0f, 0f, 1f, (float)(num + 2 + num2) * ASHistoryFileView.m_RowHeight + 16f);

            this.m_ScrollPosition = GUI.BeginScrollView(this.m_ScreenRect, this.m_ScrollPosition, viewRect);
            theRect.width         = ((viewRect.height <= this.m_ScreenRect.height) ? theRect.width : (theRect.width - 18f));
            int num3 = Mathf.RoundToInt(this.m_ScrollPosition.y - 6f - ASHistoryFileView.m_RowHeight) / Mathf.RoundToInt(ASHistoryFileView.m_RowHeight);

            if (num3 > num)
            {
                num3 = num;
            }
            else if (num3 < 0)
            {
                num3 = 0;
                this.m_ScrollPosition.y = 0f;
            }
            GUIContent gUIContent = new GUIContent();
            Event      current    = Event.current;
            GUIStyle   gUIStyle   = new GUIStyle(ASHistoryFileView.ms_Styles.label);
            Texture2D  image      = EditorGUIUtility.FindTexture(EditorResourcesUtility.folderIconName);
            float      num4       = (float)num3 * ASHistoryFileView.m_RowHeight + 3f;
            float      num5       = this.m_ScreenRect.height + this.m_ScrollPosition.y;
            Rect       position   = new Rect(0f, num4, theRect.width, ASHistoryFileView.m_RowHeight);

            if (current.type == EventType.MouseDown && position.Contains(current.mousePosition))
            {
                this.SelType = ASHistoryFileView.SelectionType.All;
                GUIUtility.keyboardControl = this.m_FileViewControlID;
                this.ScrollTo(0f);
                parentWin.DoLocalSelectionChange();
                current.Use();
            }
            gUIContent       = new GUIContent("Entire Project");
            gUIContent.image = image;
            int left = (int)this.m_BaseIndent;

            gUIStyle.padding.left = 3;
            if (Event.current.type == EventType.Repaint)
            {
                gUIStyle.Draw(position, gUIContent, false, false, this.SelType == ASHistoryFileView.SelectionType.All, focused);
            }
            num4 += ASHistoryFileView.m_RowHeight + 3f;
            hierarchyProperty.Reset();
            hierarchyProperty.Skip(num3, this.m_ExpandedArray);
            while (hierarchyProperty.Next(this.m_ExpandedArray) && num4 <= num5)
            {
                int instanceID = hierarchyProperty.instanceID;
                position = new Rect(0f, num4, theRect.width, ASHistoryFileView.m_RowHeight);
                if (Event.current.type == EventType.Repaint)
                {
                    gUIContent.text       = hierarchyProperty.name;
                    gUIContent.image      = hierarchyProperty.icon;
                    left                  = (int)(this.m_BaseIndent + this.m_Indent * (float)hierarchyProperty.depth);
                    gUIStyle.padding.left = left;
                    bool on = hashtable.Contains(instanceID);
                    gUIStyle.Draw(position, gUIContent, false, false, on, focused);
                }
                if (hierarchyProperty.hasChildren)
                {
                    bool flag = hierarchyProperty.IsExpanded(this.m_ExpandedArray);
                    GUI.changed = false;
                    Rect position2 = new Rect(this.m_BaseIndent + this.m_Indent * (float)hierarchyProperty.depth - this.m_FoldoutSize, num4, this.m_FoldoutSize, ASHistoryFileView.m_RowHeight);
                    flag = GUI.Toggle(position2, flag, GUIContent.none, ASHistoryFileView.ms_Styles.foldout);
                    if (GUI.changed)
                    {
                        if (Event.current.alt)
                        {
                            this.SetExpandedRecurse(instanceID, flag);
                        }
                        else
                        {
                            this.SetExpanded(instanceID, flag);
                        }
                    }
                }
                if (current.type == EventType.MouseDown && Event.current.button == 0 && position.Contains(Event.current.mousePosition))
                {
                    GUIUtility.keyboardControl = this.m_FileViewControlID;
                    if (Event.current.clickCount == 2)
                    {
                        AssetDatabase.OpenAsset(instanceID);
                        GUIUtility.ExitGUI();
                    }
                    else if (position.Contains(current.mousePosition))
                    {
                        this.SelectionClick(hierarchyProperty);
                    }
                    current.Use();
                }
                num4 += ASHistoryFileView.m_RowHeight;
            }
            num4 += 3f;
            this.DoDeletedItemsGUI(parentWin, theRect, gUIStyle, num4, num5, focused);
            GUI.EndScrollView();
            EventType type = current.type;

            if (type != EventType.MouseDown)
            {
                if (type == EventType.MouseUp)
                {
                    if (GUIUtility.hotControl == this.m_FileViewControlID)
                    {
                        if (this.m_ScreenRect.Contains(current.mousePosition))
                        {
                            Selection.activeObject = null;
                        }
                        GUIUtility.hotControl = 0;
                        current.Use();
                    }
                }
            }
            else if (current.button == 0 && this.m_ScreenRect.Contains(current.mousePosition))
            {
                GUIUtility.hotControl = this.m_FileViewControlID;
                current.Use();
            }
            this.HandleFraming();
        }
コード例 #13
0
        private void DeletedItemsKeyboard(ASHistoryWindow parentWin)
        {
            int row = this.m_DelPVstate.lv.row;
            int num = row;

            if (this.DeletedItemsToggle)
            {
                switch (Event.current.keyCode)
                {
                case KeyCode.UpArrow:
                    if (num > 0)
                    {
                        num--;
                    }
                    else
                    {
                        this.SelType = ASHistoryFileView.SelectionType.DeletedItemsRoot;
                        this.ScrollToDeletedItem(-1);
                        parentWin.DoLocalSelectionChange();
                    }
                    goto IL_1C9;

                case KeyCode.DownArrow:
                    if (num < this.m_DelPVstate.lv.totalRows - 1)
                    {
                        num++;
                    }
                    goto IL_1C9;

                case KeyCode.Home:
                    num = 0;
                    goto IL_1C9;

                case KeyCode.End:
                    num = this.m_DelPVstate.lv.totalRows - 1;
                    goto IL_1C9;

                case KeyCode.PageUp:
                    if (ASHistoryFileView.OSX)
                    {
                        this.m_ScrollPosition.y = this.m_ScrollPosition.y - this.m_ScreenRect.height;
                        if (this.m_ScrollPosition.y < 0f)
                        {
                            this.m_ScrollPosition.y = 0f;
                        }
                    }
                    else
                    {
                        num -= (int)(this.m_ScreenRect.height / ASHistoryFileView.m_RowHeight);
                        if (num < 0)
                        {
                            num = 0;
                        }
                    }
                    goto IL_1C9;

                case KeyCode.PageDown:
                    if (ASHistoryFileView.OSX)
                    {
                        this.m_ScrollPosition.y = this.m_ScrollPosition.y + this.m_ScreenRect.height;
                    }
                    else
                    {
                        num += (int)(this.m_ScreenRect.height / ASHistoryFileView.m_RowHeight);
                        if (num > this.m_DelPVstate.lv.totalRows - 1)
                        {
                            num = this.m_DelPVstate.lv.totalRows - 1;
                        }
                    }
                    goto IL_1C9;
                }
                return;

IL_1C9:
                Event.current.Use();
                if (num != row)
                {
                    this.m_DelPVstate.lv.row = num;
                    ListViewShared.MultiSelection(null, row, num, ref this.m_DelPVstate.initialSelectedItem, ref this.m_DelPVstate.selectedItems);
                    this.ScrollToDeletedItem(num);
                    parentWin.DoLocalSelectionChange();
                }
            }
        }
コード例 #14
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);
				}
			}
		}
コード例 #15
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;
		}
コード例 #16
0
		private void DeletedItemsRootKeyboard(ASHistoryWindow parentWin)
		{
			switch (Event.current.keyCode)
			{
			case KeyCode.UpArrow:
				this.SelType = ASHistoryFileView.SelectionType.Items;
				if (this.GetLast() != null)
				{
					Selection.activeObject = this.GetLast().pptrValue;
					this.FrameObject(Selection.activeObject);
				}
				break;
			case KeyCode.DownArrow:
				if (this.m_DelPVstate.selectedItems.Length > 0 && this.DeletedItemsToggle)
				{
					this.SelType = ASHistoryFileView.SelectionType.DeletedItems;
					this.m_DelPVstate.selectedItems[0] = true;
					this.m_DelPVstate.lv.row = 0;
					this.ScrollToDeletedItem(0);
				}
				break;
			case KeyCode.RightArrow:
				this.DeletedItemsToggle = true;
				break;
			case KeyCode.LeftArrow:
				this.DeletedItemsToggle = false;
				break;
			default:
				return;
			}
			if (this.SelType != ASHistoryFileView.SelectionType.Items)
			{
				parentWin.DoLocalSelectionChange();
			}
			Event.current.Use();
		}
コード例 #17
0
 private int CheckParentViewInFilterAndMarkBoldItems(ASHistoryWindow.GUIHistoryListItem item, string text)
 {
   ParentViewState assets = item.assets;
   int num = -1;
   int index1 = 0;
   for (int index2 = 0; index2 < assets.folders.Length; ++index2)
   {
     ParentViewFolder folder = assets.folders[index2];
     if (folder.name.IndexOf(text, StringComparison.InvariantCultureIgnoreCase) != -1)
     {
       item.boldAssets[index1] = true;
       if (num == -1)
         num = index1;
     }
     ++index1;
     for (int index3 = 0; index3 < folder.files.Length; ++index3)
     {
       if (folder.files[index3].name.IndexOf(text, StringComparison.InvariantCultureIgnoreCase) != -1)
       {
         item.boldAssets[index1] = true;
         if (num == -1)
           num = index1;
       }
       ++index1;
     }
   }
   return num;
 }
コード例 #18
0
		private void DeletedItemsKeyboard(ASHistoryWindow parentWin)
		{
			int row = this.m_DelPVstate.lv.row;
			int num = row;
			if (!this.DeletedItemsToggle)
			{
				return;
			}
			switch (Event.current.keyCode)
			{
			case KeyCode.UpArrow:
				if (num > 0)
				{
					num--;
				}
				else
				{
					this.SelType = ASHistoryFileView.SelectionType.DeletedItemsRoot;
					this.ScrollToDeletedItem(-1);
					parentWin.DoLocalSelectionChange();
				}
				goto IL_1AE;
			case KeyCode.DownArrow:
				if (num < this.m_DelPVstate.lv.totalRows - 1)
				{
					num++;
				}
				goto IL_1AE;
			case KeyCode.Home:
				num = 0;
				goto IL_1AE;
			case KeyCode.End:
				num = this.m_DelPVstate.lv.totalRows - 1;
				goto IL_1AE;
			case KeyCode.PageUp:
				if (ASHistoryFileView.OSX)
				{
					this.m_ScrollPosition.y = this.m_ScrollPosition.y - this.m_ScreenRect.height;
					if (this.m_ScrollPosition.y < 0f)
					{
						this.m_ScrollPosition.y = 0f;
					}
				}
				else
				{
					num -= (int)(this.m_ScreenRect.height / ASHistoryFileView.m_RowHeight);
					if (num < 0)
					{
						num = 0;
					}
				}
				goto IL_1AE;
			case KeyCode.PageDown:
				if (ASHistoryFileView.OSX)
				{
					this.m_ScrollPosition.y = this.m_ScrollPosition.y + this.m_ScreenRect.height;
				}
				else
				{
					num += (int)(this.m_ScreenRect.height / ASHistoryFileView.m_RowHeight);
					if (num > this.m_DelPVstate.lv.totalRows - 1)
					{
						num = this.m_DelPVstate.lv.totalRows - 1;
					}
				}
				goto IL_1AE;
			}
			return;
			IL_1AE:
			Event.current.Use();
			if (num != row)
			{
				this.m_DelPVstate.lv.row = num;
				ListViewShared.MultiSelection(null, row, num, ref this.m_DelPVstate.initialSelectedItem, ref this.m_DelPVstate.selectedItems);
				this.ScrollToDeletedItem(num);
				parentWin.DoLocalSelectionChange();
			}
		}
コード例 #19
0
        private void DeletedItemsKeyboard(ASHistoryWindow parentWin)
        {
            int row = this.m_DelPVstate.lv.row;
            int num = row;

            if (!this.DeletedItemsToggle)
            {
                return;
            }
            switch (Event.current.keyCode)
            {
            case KeyCode.UpArrow:
                if (num > 0)
                {
                    --num;
                    break;
                }
                this.SelType = ASHistoryFileView.SelectionType.DeletedItemsRoot;
                this.ScrollToDeletedItem(-1);
                parentWin.DoLocalSelectionChange();
                break;

            case KeyCode.DownArrow:
                if (num < this.m_DelPVstate.lv.totalRows - 1)
                {
                    ++num;
                    break;
                }
                break;

            case KeyCode.RightArrow:
                return;

            case KeyCode.LeftArrow:
                return;

            case KeyCode.Insert:
                return;

            case KeyCode.Home:
                num = 0;
                break;

            case KeyCode.End:
                num = this.m_DelPVstate.lv.totalRows - 1;
                break;

            case KeyCode.PageUp:
                if (ASHistoryFileView.OSX)
                {
                    this.m_ScrollPosition.y -= this.m_ScreenRect.height;
                    if ((double)this.m_ScrollPosition.y < 0.0)
                    {
                        this.m_ScrollPosition.y = 0.0f;
                        break;
                    }
                    break;
                }
                num -= (int)((double)this.m_ScreenRect.height / (double)ASHistoryFileView.m_RowHeight);
                if (num < 0)
                {
                    num = 0;
                    break;
                }
                break;

            case KeyCode.PageDown:
                if (ASHistoryFileView.OSX)
                {
                    this.m_ScrollPosition.y += this.m_ScreenRect.height;
                    break;
                }
                num += (int)((double)this.m_ScreenRect.height / (double)ASHistoryFileView.m_RowHeight);
                if (num > this.m_DelPVstate.lv.totalRows - 1)
                {
                    num = this.m_DelPVstate.lv.totalRows - 1;
                    break;
                }
                break;

            default:
                return;
            }
            Event.current.Use();
            if (num == row)
            {
                return;
            }
            this.m_DelPVstate.lv.row = num;
            ListViewShared.MultiSelection((ListViewShared.InternalListViewState)null, row, num, ref this.m_DelPVstate.initialSelectedItem, ref this.m_DelPVstate.selectedItems);
            this.ScrollToDeletedItem(num);
            parentWin.DoLocalSelectionChange();
        }
コード例 #20
0
		public void DoDeletedItemsGUI(ASHistoryWindow parentWin, Rect theRect, GUIStyle s, float offset, float endOffset, bool focused)
		{
			Event current = Event.current;
			Texture2D image = EditorGUIUtility.FindTexture(EditorResourcesUtility.folderIconName);
			offset += 3f;
			Rect position = new Rect(this.m_Indent, offset, theRect.width - this.m_Indent, ASHistoryFileView.m_RowHeight);
			if (current.type == EventType.MouseDown && position.Contains(current.mousePosition))
			{
				GUIUtility.keyboardControl = this.m_FileViewControlID;
				this.SelType = ASHistoryFileView.SelectionType.DeletedItemsRoot;
				this.ScrollToDeletedItem(-1);
				parentWin.DoLocalSelectionChange();
			}
			position.width -= position.x;
			position.x = 0f;
			GUIContent gUIContent = new GUIContent("Deleted Assets");
			gUIContent.image = image;
			int left = (int)this.m_BaseIndent;
			s.padding.left = left;
			if (current.type == EventType.Repaint)
			{
				s.Draw(position, gUIContent, false, false, this.SelType == ASHistoryFileView.SelectionType.DeletedItemsRoot, focused);
			}
			Rect position2 = new Rect(this.m_BaseIndent - this.m_FoldoutSize, offset, this.m_FoldoutSize, ASHistoryFileView.m_RowHeight);
			if (!this.m_DeletedItemsInitialized || this.m_DelPVstate.lv.totalRows != 0)
			{
				this.DeletedItemsToggle = GUI.Toggle(position2, this.DeletedItemsToggle, GUIContent.none, ASHistoryFileView.ms_Styles.foldout);
			}
			offset += ASHistoryFileView.m_RowHeight;
			if (!this.DeletedItemsToggle)
			{
				return;
			}
			int row = this.m_DelPVstate.lv.row;
			int num = 0;
			int num2 = -1;
			int num3 = -1;
			int num4 = 0;
			while (offset <= endOffset && num4 < this.m_DelPVstate.lv.totalRows)
			{
				if (offset + ASHistoryFileView.m_RowHeight >= 0f)
				{
					if (num2 == -1)
					{
						this.m_DelPVstate.IndexToFolderAndFile(num4, ref num2, ref num3);
					}
					position = new Rect(0f, offset, (float)Screen.width, ASHistoryFileView.m_RowHeight);
					ParentViewFolder parentViewFolder = this.m_DelPVstate.folders[num2];
					if (current.type == EventType.MouseDown && position.Contains(current.mousePosition))
					{
						if (current.button != 1 || this.SelType != ASHistoryFileView.SelectionType.DeletedItems || !this.m_DelPVstate.selectedItems[num])
						{
							GUIUtility.keyboardControl = this.m_FileViewControlID;
							this.SelType = ASHistoryFileView.SelectionType.DeletedItems;
							this.m_DelPVstate.lv.row = num;
							ListViewShared.MultiSelection(null, row, this.m_DelPVstate.lv.row, ref this.m_DelPVstate.initialSelectedItem, ref this.m_DelPVstate.selectedItems);
							this.ScrollToDeletedItem(num);
							parentWin.DoLocalSelectionChange();
						}
						if (current.button == 1 && this.SelType == ASHistoryFileView.SelectionType.DeletedItems)
						{
							GUIUtility.hotControl = 0;
							Rect position3 = new Rect(current.mousePosition.x, current.mousePosition.y, 1f, 1f);
							EditorUtility.DisplayCustomMenu(position3, this.dropDownMenuItems, -1, new EditorUtility.SelectMenuItemFunction(this.ContextMenuClick), null);
						}
						Event.current.Use();
					}
					if (num3 != -1)
					{
						gUIContent.text = parentViewFolder.files[num3].name;
						gUIContent.image = InternalEditorUtility.GetIconForFile(parentViewFolder.files[num3].name);
						left = (int)(this.m_BaseIndent + this.m_Indent * 2f);
					}
					else
					{
						gUIContent.text = parentViewFolder.name;
						gUIContent.image = image;
						left = (int)(this.m_BaseIndent + this.m_Indent);
					}
					s.padding.left = left;
					if (Event.current.type == EventType.Repaint)
					{
						s.Draw(position, gUIContent, false, false, this.m_DelPVstate.selectedItems[num], focused);
					}
					this.m_DelPVstate.NextFileFolder(ref num2, ref num3);
					num++;
				}
				num4++;
				offset += ASHistoryFileView.m_RowHeight;
			}
		}
コード例 #21
0
        public void DoDeletedItemsGUI(ASHistoryWindow parentWin, Rect theRect, GUIStyle s, float offset, float endOffset, bool focused)
        {
            Event     current = Event.current;
            Texture2D texture = EditorGUIUtility.FindTexture(EditorResourcesUtility.folderIconName);

            offset += 3f;
            Rect position1 = new Rect(this.m_Indent, offset, theRect.width - this.m_Indent, ASHistoryFileView.m_RowHeight);

            if (current.type == EventType.MouseDown && position1.Contains(current.mousePosition))
            {
                GUIUtility.keyboardControl = this.m_FileViewControlID;
                this.SelType = ASHistoryFileView.SelectionType.DeletedItemsRoot;
                this.ScrollToDeletedItem(-1);
                parentWin.DoLocalSelectionChange();
            }
            position1.width -= position1.x;
            position1.x      = 0.0f;
            GUIContent content = new GUIContent("Deleted Assets");

            content.image = (Texture)texture;
            int baseIndent = (int)this.m_BaseIndent;

            s.padding.left = baseIndent;
            if (current.type == EventType.Repaint)
            {
                s.Draw(position1, content, false, false, this.SelType == ASHistoryFileView.SelectionType.DeletedItemsRoot, focused);
            }
            Rect position2 = new Rect(this.m_BaseIndent - this.m_FoldoutSize, offset, this.m_FoldoutSize, ASHistoryFileView.m_RowHeight);

            if (!this.m_DeletedItemsInitialized || this.m_DelPVstate.lv.totalRows != 0)
            {
                this.DeletedItemsToggle = GUI.Toggle(position2, this.DeletedItemsToggle, GUIContent.none, ASHistoryFileView.ms_Styles.foldout);
            }
            offset += ASHistoryFileView.m_RowHeight;
            if (!this.DeletedItemsToggle)
            {
                return;
            }
            int row     = this.m_DelPVstate.lv.row;
            int index1  = 0;
            int folder1 = -1;
            int file    = -1;
            int index2  = 0;

            while ((double)offset <= (double)endOffset && index2 < this.m_DelPVstate.lv.totalRows)
            {
                if ((double)offset + (double)ASHistoryFileView.m_RowHeight >= 0.0)
                {
                    if (folder1 == -1)
                    {
                        this.m_DelPVstate.IndexToFolderAndFile(index2, ref folder1, ref file);
                    }
                    position1 = new Rect(0.0f, offset, (float)Screen.width, ASHistoryFileView.m_RowHeight);
                    ParentViewFolder folder2 = this.m_DelPVstate.folders[folder1];
                    if (current.type == EventType.MouseDown && position1.Contains(current.mousePosition))
                    {
                        if (current.button != 1 || this.SelType != ASHistoryFileView.SelectionType.DeletedItems || !this.m_DelPVstate.selectedItems[index1])
                        {
                            GUIUtility.keyboardControl = this.m_FileViewControlID;
                            this.SelType             = ASHistoryFileView.SelectionType.DeletedItems;
                            this.m_DelPVstate.lv.row = index1;
                            ListViewShared.MultiSelection((ListViewShared.InternalListViewState)null, row, this.m_DelPVstate.lv.row, ref this.m_DelPVstate.initialSelectedItem, ref this.m_DelPVstate.selectedItems);
                            this.ScrollToDeletedItem(index1);
                            parentWin.DoLocalSelectionChange();
                        }
                        if (current.button == 1 && this.SelType == ASHistoryFileView.SelectionType.DeletedItems)
                        {
                            GUIUtility.hotControl = 0;
                            EditorUtility.DisplayCustomMenu(new Rect(current.mousePosition.x, current.mousePosition.y, 1f, 1f), this.dropDownMenuItems, -1, new EditorUtility.SelectMenuItemFunction(this.ContextMenuClick), (object)null);
                        }
                        Event.current.Use();
                    }
                    int num;
                    if (file != -1)
                    {
                        content.text  = folder2.files[file].name;
                        content.image = (Texture)InternalEditorUtility.GetIconForFile(folder2.files[file].name);
                        num           = (int)((double)this.m_BaseIndent + (double)this.m_Indent * 2.0);
                    }
                    else
                    {
                        content.text  = folder2.name;
                        content.image = (Texture)texture;
                        num           = (int)((double)this.m_BaseIndent + (double)this.m_Indent);
                    }
                    s.padding.left = num;
                    if (Event.current.type == EventType.Repaint)
                    {
                        s.Draw(position1, content, false, false, this.m_DelPVstate.selectedItems[index1], focused);
                    }
                    this.m_DelPVstate.NextFileFolder(ref folder1, ref file);
                    ++index1;
                }
                ++index2;
                offset += ASHistoryFileView.m_RowHeight;
            }
        }
コード例 #22
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;
 }
コード例 #23
0
 public void DoGUI(ASHistoryWindow parentWin, Rect theRect, bool focused)
 {
   if (ASHistoryFileView.ms_Styles == null)
     ASHistoryFileView.ms_Styles = new ASHistoryFileView.Styles();
   this.m_ScreenRect = theRect;
   Hashtable hashtable = new Hashtable();
   foreach (UnityEngine.Object @object in Selection.objects)
     hashtable.Add((object) @object.GetInstanceID(), (object) null);
   this.m_FileViewControlID = GUIUtility.GetControlID(ASHistoryFileView.ms_FileViewHash, FocusType.Native);
   this.KeyboardGUI(parentWin);
   focused &= GUIUtility.keyboardControl == this.m_FileViewControlID;
   HierarchyProperty property = new HierarchyProperty(HierarchyType.Assets);
   int num1 = property.CountRemaining(this.m_ExpandedArray);
   int num2 = !this.DeletedItemsToggle ? 0 : this.m_DelPVstate.lv.totalRows;
   Rect viewRect = new Rect(0.0f, 0.0f, 1f, (float) ((double) (num1 + 2 + num2) * (double) ASHistoryFileView.m_RowHeight + 16.0));
   this.m_ScrollPosition = GUI.BeginScrollView(this.m_ScreenRect, this.m_ScrollPosition, viewRect);
   theRect.width = (double) viewRect.height <= (double) this.m_ScreenRect.height ? theRect.width : theRect.width - 18f;
   int count = Mathf.RoundToInt(this.m_ScrollPosition.y - 6f - ASHistoryFileView.m_RowHeight) / Mathf.RoundToInt(ASHistoryFileView.m_RowHeight);
   if (count > num1)
     count = num1;
   else if (count < 0)
   {
     count = 0;
     this.m_ScrollPosition.y = 0.0f;
   }
   GUIContent guiContent = new GUIContent();
   Event current = Event.current;
   GUIStyle s = new GUIStyle(ASHistoryFileView.ms_Styles.label);
   Texture2D texture = EditorGUIUtility.FindTexture(EditorResourcesUtility.folderIconName);
   float y1 = (float) ((double) count * (double) ASHistoryFileView.m_RowHeight + 3.0);
   float endOffset = this.m_ScreenRect.height + this.m_ScrollPosition.y;
   Rect position = new Rect(0.0f, y1, theRect.width, ASHistoryFileView.m_RowHeight);
   if (current.type == EventType.MouseDown && position.Contains(current.mousePosition))
   {
     this.SelType = ASHistoryFileView.SelectionType.All;
     GUIUtility.keyboardControl = this.m_FileViewControlID;
     this.ScrollTo(0.0f);
     parentWin.DoLocalSelectionChange();
     current.Use();
   }
   GUIContent content = new GUIContent("Entire Project");
   content.image = (Texture) texture;
   int baseIndent = (int) this.m_BaseIndent;
   s.padding.left = 3;
   if (Event.current.type == EventType.Repaint)
     s.Draw(position, content, false, false, this.SelType == ASHistoryFileView.SelectionType.All, focused);
   float y2 = y1 + (ASHistoryFileView.m_RowHeight + 3f);
   property.Reset();
   property.Skip(count, this.m_ExpandedArray);
   while (property.Next(this.m_ExpandedArray) && (double) y2 <= (double) endOffset)
   {
     int instanceId = property.instanceID;
     position = new Rect(0.0f, y2, theRect.width, ASHistoryFileView.m_RowHeight);
     if (Event.current.type == EventType.Repaint)
     {
       content.text = property.name;
       content.image = (Texture) property.icon;
       int num3 = (int) ((double) this.m_BaseIndent + (double) this.m_Indent * (double) property.depth);
       s.padding.left = num3;
       bool on = hashtable.Contains((object) instanceId);
       s.Draw(position, content, false, false, on, focused);
     }
     if (property.hasChildren)
     {
       bool flag = property.IsExpanded(this.m_ExpandedArray);
       GUI.changed = false;
       bool expand = GUI.Toggle(new Rect(this.m_BaseIndent + this.m_Indent * (float) property.depth - this.m_FoldoutSize, y2, this.m_FoldoutSize, ASHistoryFileView.m_RowHeight), flag, GUIContent.none, ASHistoryFileView.ms_Styles.foldout);
       if (GUI.changed)
       {
         if (Event.current.alt)
           this.SetExpandedRecurse(instanceId, expand);
         else
           this.SetExpanded(instanceId, expand);
       }
     }
     if (current.type == EventType.MouseDown && Event.current.button == 0 && position.Contains(Event.current.mousePosition))
     {
       GUIUtility.keyboardControl = this.m_FileViewControlID;
       if (Event.current.clickCount == 2)
       {
         AssetDatabase.OpenAsset(instanceId);
         GUIUtility.ExitGUI();
       }
       else if (position.Contains(current.mousePosition))
         this.SelectionClick(property);
       current.Use();
     }
     y2 += ASHistoryFileView.m_RowHeight;
   }
   float offset = y2 + 3f;
   this.DoDeletedItemsGUI(parentWin, theRect, s, offset, endOffset, focused);
   GUI.EndScrollView();
   switch (current.type)
   {
     case EventType.MouseDown:
       if (current.button == 0 && this.m_ScreenRect.Contains(current.mousePosition))
       {
         GUIUtility.hotControl = this.m_FileViewControlID;
         current.Use();
         break;
       }
       break;
     case EventType.MouseUp:
       if (GUIUtility.hotControl == this.m_FileViewControlID)
       {
         if (this.m_ScreenRect.Contains(current.mousePosition))
           Selection.activeObject = (UnityEngine.Object) null;
         GUIUtility.hotControl = 0;
         current.Use();
         break;
       }
       break;
   }
   this.HandleFraming();
 }
コード例 #24
0
 private void DrawParentView(Rect r, ref ASHistoryWindow.GUIHistoryListItem item, int changesetIndex, bool hasFocus)
 {
   ParentViewState assets = item.assets;
   GUIContent content = new GUIContent();
   Texture2D texture = EditorGUIUtility.FindTexture(EditorResourcesUtility.folderIconName);
   Event current = Event.current;
   hasFocus &= this.m_HistoryControlID == GUIUtility.keyboardControl;
   r.height = (float) this.m_RowHeight;
   r.y += 3f;
   int index1 = -1;
   int num = (item.collapsedItemCount == 0 ? item.totalLineCount : 4) + item.startShowingFrom;
   for (int index2 = 0; index2 < assets.folders.Length; ++index2)
   {
     ParentViewFolder folder = assets.folders[index2];
     content.text = folder.name;
     content.image = (Texture) texture;
     ++index1;
     if (index1 != num)
     {
       if (index1 >= 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 == folder.guid && EditorGUI.actionKey)
           {
             this.ClearItemSelection();
           }
           else
           {
             this.ChangeLogSelectionRev = this.m_Changesets[changesetIndex].changeset;
             this.m_ChangeLogSelectionGUID = folder.guid;
             this.m_ChangeLogSelectionAssetName = folder.name;
             this.m_FolderSelected = true;
             this.m_AssetSelectionIndex = index1;
           }
           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), (object) null);
           }
           this.DoScroll();
           current.Use();
         }
         bool on = this.ChangeLogSelectionRev == this.m_Changesets[changesetIndex].changeset && this.m_ChangeLogSelectionGUID == folder.guid;
         if (item.boldAssets[index1] && !on)
           GUI.Label(r, string.Empty, ASHistoryWindow.ms_Style.ping);
         if (Event.current.type == EventType.Repaint)
         {
           label.Draw(r, content, false, false, on, hasFocus);
           this.DrawBadge(r, folder.changeFlags, label, content, 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 index3 = 0; index3 < folder.files.Length; ++index3)
         {
           ++index1;
           if (index1 != num)
           {
             if (index1 >= 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 == folder.files[index3].guid && EditorGUI.actionKey)
                 {
                   this.ClearItemSelection();
                 }
                 else
                 {
                   this.ChangeLogSelectionRev = this.m_Changesets[changesetIndex].changeset;
                   this.m_ChangeLogSelectionGUID = folder.files[index3].guid;
                   this.m_ChangeLogSelectionAssetName = folder.files[index3].name;
                   this.m_FolderSelected = false;
                   this.m_AssetSelectionIndex = index1;
                 }
                 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), (object) null);
                 }
                 this.DoScroll();
                 current.Use();
               }
               content.text = folder.files[index3].name;
               content.image = (Texture) InternalEditorUtility.GetIconForFile(folder.files[index3].name);
               bool on = this.ChangeLogSelectionRev == this.m_Changesets[changesetIndex].changeset && this.m_ChangeLogSelectionGUID == folder.files[index3].guid;
               if (item.boldAssets[index1] && !on)
                 GUI.Label(r, string.Empty, ASHistoryWindow.ms_Style.ping);
               if (Event.current.type == EventType.Repaint)
               {
                 label.Draw(r, content, false, false, on, hasFocus);
                 this.DrawBadge(r, folder.files[index3].changeFlags, label, content, GUIClip.visibleRect.width - 150f);
               }
               r.y += (float) this.m_RowHeight;
             }
           }
           else
             break;
         }
         if (index1 == num)
           break;
       }
       finally
       {
         ASHistoryWindow.ms_Style.label.padding.left -= 16;
         ASHistoryWindow.ms_Style.boldLabel.padding.left -= 16;
       }
     }
     else
       break;
   }
   if (index1 != num && num < item.totalLineCount || item.collapsedItemCount == 0)
     return;
   r.x += 19f;
   if (!GUI.Button(r, item.collapsedItemCount.ToString() + " more...", ASHistoryWindow.ms_Style.foldout))
     return;
   GUIUtility.keyboardControl = this.m_HistoryControlID;
   this.UncollapseListItem(ref item);
 }
コード例 #25
0
 public void InitHistoryPage(bool lastActionsResult)
 {
     if (!lastActionsResult)
     {
         this.Reinit();
     }
     else
     {
         this.asHistoryWin = new ASHistoryWindow(this);
         if (this.asHistoryWin == null)
         {
             this.Reinit();
         }
     }
 }
コード例 #26
0
        public void DoGUI(ASHistoryWindow parentWin, Rect theRect, bool focused)
        {
            if (ASHistoryFileView.ms_Styles == null)
            {
                ASHistoryFileView.ms_Styles = new ASHistoryFileView.Styles();
            }
            this.m_ScreenRect = theRect;
            Hashtable hashtable = new Hashtable();

            foreach (UnityEngine.Object @object in Selection.objects)
            {
                hashtable.Add((object)@object.GetInstanceID(), (object)null);
            }
            this.m_FileViewControlID = GUIUtility.GetControlID(ASHistoryFileView.ms_FileViewHash, FocusType.Native);
            this.KeyboardGUI(parentWin);
            focused &= GUIUtility.keyboardControl == this.m_FileViewControlID;
            HierarchyProperty property = new HierarchyProperty(HierarchyType.Assets);
            int  num1     = property.CountRemaining(this.m_ExpandedArray);
            int  num2     = !this.DeletedItemsToggle ? 0 : this.m_DelPVstate.lv.totalRows;
            Rect viewRect = new Rect(0.0f, 0.0f, 1f, (float)((double)(num1 + 2 + num2) * (double)ASHistoryFileView.m_RowHeight + 16.0));

            this.m_ScrollPosition = GUI.BeginScrollView(this.m_ScreenRect, this.m_ScrollPosition, viewRect);
            theRect.width         = (double)viewRect.height <= (double)this.m_ScreenRect.height ? theRect.width : theRect.width - 18f;
            int count = Mathf.RoundToInt(this.m_ScrollPosition.y - 6f - ASHistoryFileView.m_RowHeight) / Mathf.RoundToInt(ASHistoryFileView.m_RowHeight);

            if (count > num1)
            {
                count = num1;
            }
            else if (count < 0)
            {
                count = 0;
                this.m_ScrollPosition.y = 0.0f;
            }
            GUIContent guiContent = new GUIContent();
            Event      current    = Event.current;
            GUIStyle   s          = new GUIStyle(ASHistoryFileView.ms_Styles.label);
            Texture2D  texture    = EditorGUIUtility.FindTexture(EditorResourcesUtility.folderIconName);
            float      y1         = (float)((double)count * (double)ASHistoryFileView.m_RowHeight + 3.0);
            float      endOffset  = this.m_ScreenRect.height + this.m_ScrollPosition.y;
            Rect       position   = new Rect(0.0f, y1, theRect.width, ASHistoryFileView.m_RowHeight);

            if (current.type == EventType.MouseDown && position.Contains(current.mousePosition))
            {
                this.SelType = ASHistoryFileView.SelectionType.All;
                GUIUtility.keyboardControl = this.m_FileViewControlID;
                this.ScrollTo(0.0f);
                parentWin.DoLocalSelectionChange();
                current.Use();
            }
            GUIContent content = new GUIContent("Entire Project");

            content.image = (Texture)texture;
            int baseIndent = (int)this.m_BaseIndent;

            s.padding.left = 3;
            if (Event.current.type == EventType.Repaint)
            {
                s.Draw(position, content, false, false, this.SelType == ASHistoryFileView.SelectionType.All, focused);
            }
            float y2 = y1 + (ASHistoryFileView.m_RowHeight + 3f);

            property.Reset();
            property.Skip(count, this.m_ExpandedArray);
            while (property.Next(this.m_ExpandedArray) && (double)y2 <= (double)endOffset)
            {
                int instanceId = property.instanceID;
                position = new Rect(0.0f, y2, theRect.width, ASHistoryFileView.m_RowHeight);
                if (Event.current.type == EventType.Repaint)
                {
                    content.text  = property.name;
                    content.image = (Texture)property.icon;
                    int num3 = (int)((double)this.m_BaseIndent + (double)this.m_Indent * (double)property.depth);
                    s.padding.left = num3;
                    bool on = hashtable.Contains((object)instanceId);
                    s.Draw(position, content, false, false, on, focused);
                }
                if (property.hasChildren)
                {
                    bool flag = property.IsExpanded(this.m_ExpandedArray);
                    GUI.changed = false;
                    bool expand = GUI.Toggle(new Rect(this.m_BaseIndent + this.m_Indent * (float)property.depth - this.m_FoldoutSize, y2, this.m_FoldoutSize, ASHistoryFileView.m_RowHeight), flag, GUIContent.none, ASHistoryFileView.ms_Styles.foldout);
                    if (GUI.changed)
                    {
                        if (Event.current.alt)
                        {
                            this.SetExpandedRecurse(instanceId, expand);
                        }
                        else
                        {
                            this.SetExpanded(instanceId, expand);
                        }
                    }
                }
                if (current.type == EventType.MouseDown && Event.current.button == 0 && position.Contains(Event.current.mousePosition))
                {
                    GUIUtility.keyboardControl = this.m_FileViewControlID;
                    if (Event.current.clickCount == 2)
                    {
                        AssetDatabase.OpenAsset(instanceId);
                        GUIUtility.ExitGUI();
                    }
                    else if (position.Contains(current.mousePosition))
                    {
                        this.SelectionClick(property);
                    }
                    current.Use();
                }
                y2 += ASHistoryFileView.m_RowHeight;
            }
            float offset = y2 + 3f;

            this.DoDeletedItemsGUI(parentWin, theRect, s, offset, endOffset, focused);
            GUI.EndScrollView();
            switch (current.type)
            {
            case EventType.MouseDown:
                if (current.button == 0 && this.m_ScreenRect.Contains(current.mousePosition))
                {
                    GUIUtility.hotControl = this.m_FileViewControlID;
                    current.Use();
                    break;
                }
                break;

            case EventType.MouseUp:
                if (GUIUtility.hotControl == this.m_FileViewControlID)
                {
                    if (this.m_ScreenRect.Contains(current.mousePosition))
                    {
                        Selection.activeObject = (UnityEngine.Object)null;
                    }
                    GUIUtility.hotControl = 0;
                    current.Use();
                    break;
                }
                break;
            }
            this.HandleFraming();
        }
コード例 #27
0
        private void DeletedItemsKeyboard(ASHistoryWindow parentWin)
        {
            int row = this.m_DelPVstate.lv.row;
            int currSelected = row;
            if (this.DeletedItemsToggle)
            {
                switch (Event.current.keyCode)
                {
                    case KeyCode.UpArrow:
                        if (currSelected <= 0)
                        {
                            this.SelType = SelectionType.DeletedItemsRoot;
                            this.ScrollToDeletedItem(-1);
                            parentWin.DoLocalSelectionChange();
                        }
                        else
                        {
                            currSelected--;
                        }
                        goto Label_01AE;

                    case KeyCode.DownArrow:
                        if (currSelected < (this.m_DelPVstate.lv.totalRows - 1))
                        {
                            currSelected++;
                        }
                        goto Label_01AE;

                    case KeyCode.Home:
                        currSelected = 0;
                        goto Label_01AE;

                    case KeyCode.End:
                        currSelected = this.m_DelPVstate.lv.totalRows - 1;
                        goto Label_01AE;

                    case KeyCode.PageUp:
                        if (!OSX)
                        {
                            currSelected -= (int) (this.m_ScreenRect.height / m_RowHeight);
                            if (currSelected < 0)
                            {
                                currSelected = 0;
                            }
                        }
                        else
                        {
                            this.m_ScrollPosition.y -= this.m_ScreenRect.height;
                            if (this.m_ScrollPosition.y < 0f)
                            {
                                this.m_ScrollPosition.y = 0f;
                            }
                        }
                        goto Label_01AE;

                    case KeyCode.PageDown:
                        if (!OSX)
                        {
                            currSelected += (int) (this.m_ScreenRect.height / m_RowHeight);
                            if (currSelected > (this.m_DelPVstate.lv.totalRows - 1))
                            {
                                currSelected = this.m_DelPVstate.lv.totalRows - 1;
                            }
                        }
                        else
                        {
                            this.m_ScrollPosition.y += this.m_ScreenRect.height;
                        }
                        goto Label_01AE;
                }
            }
            return;
        Label_01AE:
            Event.current.Use();
            if (currSelected != row)
            {
                this.m_DelPVstate.lv.row = currSelected;
                ListViewShared.MultiSelection(null, row, currSelected, ref this.m_DelPVstate.initialSelectedItem, ref this.m_DelPVstate.selectedItems);
                this.ScrollToDeletedItem(currSelected);
                parentWin.DoLocalSelectionChange();
            }
        }
コード例 #28
0
        private void DeletedItemsKeyboard(ASHistoryWindow parentWin)
        {
            int row          = this.m_DelPVstate.lv.row;
            int currSelected = row;

            if (this.DeletedItemsToggle)
            {
                switch (Event.current.keyCode)
                {
                case KeyCode.UpArrow:
                    if (currSelected <= 0)
                    {
                        this.SelType = SelectionType.DeletedItemsRoot;
                        this.ScrollToDeletedItem(-1);
                        parentWin.DoLocalSelectionChange();
                    }
                    else
                    {
                        currSelected--;
                    }
                    goto Label_01AE;

                case KeyCode.DownArrow:
                    if (currSelected < (this.m_DelPVstate.lv.totalRows - 1))
                    {
                        currSelected++;
                    }
                    goto Label_01AE;

                case KeyCode.Home:
                    currSelected = 0;
                    goto Label_01AE;

                case KeyCode.End:
                    currSelected = this.m_DelPVstate.lv.totalRows - 1;
                    goto Label_01AE;

                case KeyCode.PageUp:
                    if (!OSX)
                    {
                        currSelected -= (int)(this.m_ScreenRect.height / m_RowHeight);
                        if (currSelected < 0)
                        {
                            currSelected = 0;
                        }
                    }
                    else
                    {
                        this.m_ScrollPosition.y -= this.m_ScreenRect.height;
                        if (this.m_ScrollPosition.y < 0f)
                        {
                            this.m_ScrollPosition.y = 0f;
                        }
                    }
                    goto Label_01AE;

                case KeyCode.PageDown:
                    if (!OSX)
                    {
                        currSelected += (int)(this.m_ScreenRect.height / m_RowHeight);
                        if (currSelected > (this.m_DelPVstate.lv.totalRows - 1))
                        {
                            currSelected = this.m_DelPVstate.lv.totalRows - 1;
                        }
                    }
                    else
                    {
                        this.m_ScrollPosition.y += this.m_ScreenRect.height;
                    }
                    goto Label_01AE;
                }
            }
            return;

Label_01AE:
            Event.current.Use();
            if (currSelected != row)
            {
                this.m_DelPVstate.lv.row = currSelected;
                ListViewShared.MultiSelection(null, row, currSelected, ref this.m_DelPVstate.initialSelectedItem, ref this.m_DelPVstate.selectedItems);
                this.ScrollToDeletedItem(currSelected);
                parentWin.DoLocalSelectionChange();
            }
        }
コード例 #29
0
 public void DoDeletedItemsGUI(ASHistoryWindow parentWin, Rect theRect, GUIStyle s, float offset, float endOffset, bool focused)
 {
     Event current = Event.current;
     Texture2D textured = EditorGUIUtility.FindTexture(EditorResourcesUtility.folderIconName);
     offset += 3f;
     Rect position = new Rect(this.m_Indent, offset, theRect.width - this.m_Indent, m_RowHeight);
     if ((current.type == EventType.MouseDown) && position.Contains(current.mousePosition))
     {
         GUIUtility.keyboardControl = this.m_FileViewControlID;
         this.SelType = SelectionType.DeletedItemsRoot;
         this.ScrollToDeletedItem(-1);
         parentWin.DoLocalSelectionChange();
     }
     position.width -= position.x;
     position.x = 0f;
     GUIContent content = new GUIContent("Deleted Assets") {
         image = textured
     };
     int baseIndent = (int) this.m_BaseIndent;
     s.padding.left = baseIndent;
     if (current.type == EventType.Repaint)
     {
         s.Draw(position, content, false, false, this.SelType == SelectionType.DeletedItemsRoot, focused);
     }
     Rect rect2 = new Rect(this.m_BaseIndent - this.m_FoldoutSize, offset, this.m_FoldoutSize, m_RowHeight);
     if (!this.m_DeletedItemsInitialized || (this.m_DelPVstate.lv.totalRows != 0))
     {
         this.DeletedItemsToggle = GUI.Toggle(rect2, this.DeletedItemsToggle, GUIContent.none, ms_Styles.foldout);
     }
     offset += m_RowHeight;
     if (this.DeletedItemsToggle)
     {
         int row = this.m_DelPVstate.lv.row;
         int index = 0;
         int num4 = -1;
         int file = -1;
         int num6 = 0;
         while ((offset <= endOffset) && (num6 < this.m_DelPVstate.lv.totalRows))
         {
             if ((offset + m_RowHeight) >= 0f)
             {
                 if (num4 == -1)
                 {
                     this.m_DelPVstate.IndexToFolderAndFile(num6, ref num4, ref file);
                 }
                 position = new Rect(0f, offset, (float) Screen.width, m_RowHeight);
                 ParentViewFolder folder = this.m_DelPVstate.folders[num4];
                 if ((current.type == EventType.MouseDown) && position.Contains(current.mousePosition))
                 {
                     if (!(((current.button == 1) && (this.SelType == SelectionType.DeletedItems)) && this.m_DelPVstate.selectedItems[index]))
                     {
                         GUIUtility.keyboardControl = this.m_FileViewControlID;
                         this.SelType = SelectionType.DeletedItems;
                         this.m_DelPVstate.lv.row = index;
                         ListViewShared.MultiSelection(null, row, this.m_DelPVstate.lv.row, ref this.m_DelPVstate.initialSelectedItem, ref this.m_DelPVstate.selectedItems);
                         this.ScrollToDeletedItem(index);
                         parentWin.DoLocalSelectionChange();
                     }
                     if ((current.button == 1) && (this.SelType == SelectionType.DeletedItems))
                     {
                         GUIUtility.hotControl = 0;
                         Rect rect3 = new Rect(current.mousePosition.x, current.mousePosition.y, 1f, 1f);
                         EditorUtility.DisplayCustomMenu(rect3, this.dropDownMenuItems, -1, new EditorUtility.SelectMenuItemFunction(this.ContextMenuClick), null);
                     }
                     Event.current.Use();
                 }
                 if (file != -1)
                 {
                     content.text = folder.files[file].name;
                     content.image = InternalEditorUtility.GetIconForFile(folder.files[file].name);
                     baseIndent = (int) (this.m_BaseIndent + (this.m_Indent * 2f));
                 }
                 else
                 {
                     content.text = folder.name;
                     content.image = textured;
                     baseIndent = (int) (this.m_BaseIndent + this.m_Indent);
                 }
                 s.padding.left = baseIndent;
                 if (Event.current.type == EventType.Repaint)
                 {
                     s.Draw(position, content, false, false, this.m_DelPVstate.selectedItems[index], focused);
                 }
                 this.m_DelPVstate.NextFileFolder(ref num4, ref file);
                 index++;
             }
             num6++;
             offset += m_RowHeight;
         }
     }
 }
コード例 #30
0
        public void DoGUI(ASHistoryWindow parentWin, Rect theRect, bool focused)
        {
            if (ms_Styles == null)
            {
                ms_Styles = new Styles();
            }
            this.m_ScreenRect = theRect;
            Hashtable hashtable = new Hashtable();

            foreach (UnityEngine.Object obj2 in Selection.objects)
            {
                hashtable.Add(obj2.GetInstanceID(), null);
            }
            this.m_FileViewControlID = GUIUtility.GetControlID(ms_FileViewHash, FocusType.Native);
            this.KeyboardGUI(parentWin);
            focused &= GUIUtility.keyboardControl == this.m_FileViewControlID;
            HierarchyProperty property = new HierarchyProperty(HierarchyType.Assets);
            int  num2     = property.CountRemaining(this.m_ExpandedArray);
            int  num3     = !this.DeletedItemsToggle ? 0 : this.m_DelPVstate.lv.totalRows;
            Rect viewRect = new Rect(0f, 0f, 1f, (((num2 + 2) + num3) * m_RowHeight) + 16f);

            this.m_ScrollPosition = GUI.BeginScrollView(this.m_ScreenRect, this.m_ScrollPosition, viewRect);
            theRect.width         = (viewRect.height <= this.m_ScreenRect.height) ? theRect.width : (theRect.width - 18f);
            int count = Mathf.RoundToInt((this.m_ScrollPosition.y - 6f) - m_RowHeight) / Mathf.RoundToInt(m_RowHeight);

            if (count > num2)
            {
                count = num2;
            }
            else if (count < 0)
            {
                count = 0;
                this.m_ScrollPosition.y = 0f;
            }
            float      y        = 0f;
            GUIContent content  = new GUIContent();
            Event      current  = Event.current;
            GUIStyle   s        = new GUIStyle(ms_Styles.label);
            Texture2D  textured = EditorGUIUtility.FindTexture(EditorResourcesUtility.folderIconName);

            y = (count * m_RowHeight) + 3f;
            float endOffset = this.m_ScreenRect.height + this.m_ScrollPosition.y;
            Rect  position  = new Rect(0f, y, theRect.width, m_RowHeight);

            if ((current.type == EventType.MouseDown) && position.Contains(current.mousePosition))
            {
                this.SelType = SelectionType.All;
                GUIUtility.keyboardControl = this.m_FileViewControlID;
                this.ScrollTo(0f);
                parentWin.DoLocalSelectionChange();
                current.Use();
            }
            content = new GUIContent("Entire Project")
            {
                image = textured
            };
            int baseIndent = (int)this.m_BaseIndent;

            s.padding.left = 3;
            if (Event.current.type == EventType.Repaint)
            {
                s.Draw(position, content, false, false, this.SelType == SelectionType.All, focused);
            }
            y += m_RowHeight + 3f;
            property.Reset();
            property.Skip(count, this.m_ExpandedArray);
            while (property.Next(this.m_ExpandedArray) && (y <= endOffset))
            {
                int instanceID = property.instanceID;
                position = new Rect(0f, y, theRect.width, m_RowHeight);
                if (Event.current.type == EventType.Repaint)
                {
                    content.text   = property.name;
                    content.image  = property.icon;
                    baseIndent     = (int)(this.m_BaseIndent + (this.m_Indent * property.depth));
                    s.padding.left = baseIndent;
                    bool on = hashtable.Contains(instanceID);
                    s.Draw(position, content, false, false, on, focused);
                }
                if (property.hasChildren)
                {
                    bool flag2 = property.IsExpanded(this.m_ExpandedArray);
                    GUI.changed = false;
                    Rect rect3 = new Rect((this.m_BaseIndent + (this.m_Indent * property.depth)) - this.m_FoldoutSize, y, this.m_FoldoutSize, m_RowHeight);
                    flag2 = GUI.Toggle(rect3, flag2, GUIContent.none, ms_Styles.foldout);
                    if (GUI.changed)
                    {
                        if (Event.current.alt)
                        {
                            this.SetExpandedRecurse(instanceID, flag2);
                        }
                        else
                        {
                            this.SetExpanded(instanceID, flag2);
                        }
                    }
                }
                if (((current.type == EventType.MouseDown) && (Event.current.button == 0)) && position.Contains(Event.current.mousePosition))
                {
                    GUIUtility.keyboardControl = this.m_FileViewControlID;
                    if (Event.current.clickCount == 2)
                    {
                        AssetDatabase.OpenAsset(instanceID);
                        GUIUtility.ExitGUI();
                    }
                    else if (position.Contains(current.mousePosition))
                    {
                        this.SelectionClick(property);
                    }
                    current.Use();
                }
                y += m_RowHeight;
            }
            y += 3f;
            this.DoDeletedItemsGUI(parentWin, theRect, s, y, endOffset, focused);
            GUI.EndScrollView();
            switch (current.type)
            {
            case EventType.MouseDown:
                if ((current.button == 0) && this.m_ScreenRect.Contains(current.mousePosition))
                {
                    GUIUtility.hotControl = this.m_FileViewControlID;
                    current.Use();
                }
                break;

            case EventType.MouseUp:
                if (GUIUtility.hotControl == this.m_FileViewControlID)
                {
                    if (this.m_ScreenRect.Contains(current.mousePosition))
                    {
                        Selection.activeObject = null;
                    }
                    GUIUtility.hotControl = 0;
                    current.Use();
                }
                break;
            }
            this.HandleFraming();
        }
コード例 #31
0
 private void DeletedItemsKeyboard(ASHistoryWindow parentWin)
 {
   int row = this.m_DelPVstate.lv.row;
   int num = row;
   if (!this.DeletedItemsToggle)
     return;
   switch (Event.current.keyCode)
   {
     case KeyCode.UpArrow:
       if (num > 0)
       {
         --num;
         break;
       }
       this.SelType = ASHistoryFileView.SelectionType.DeletedItemsRoot;
       this.ScrollToDeletedItem(-1);
       parentWin.DoLocalSelectionChange();
       break;
     case KeyCode.DownArrow:
       if (num < this.m_DelPVstate.lv.totalRows - 1)
       {
         ++num;
         break;
       }
       break;
     case KeyCode.RightArrow:
       return;
     case KeyCode.LeftArrow:
       return;
     case KeyCode.Insert:
       return;
     case KeyCode.Home:
       num = 0;
       break;
     case KeyCode.End:
       num = this.m_DelPVstate.lv.totalRows - 1;
       break;
     case KeyCode.PageUp:
       if (ASHistoryFileView.OSX)
       {
         this.m_ScrollPosition.y -= this.m_ScreenRect.height;
         if ((double) this.m_ScrollPosition.y < 0.0)
         {
           this.m_ScrollPosition.y = 0.0f;
           break;
         }
         break;
       }
       num -= (int) ((double) this.m_ScreenRect.height / (double) ASHistoryFileView.m_RowHeight);
       if (num < 0)
       {
         num = 0;
         break;
       }
       break;
     case KeyCode.PageDown:
       if (ASHistoryFileView.OSX)
       {
         this.m_ScrollPosition.y += this.m_ScreenRect.height;
         break;
       }
       num += (int) ((double) this.m_ScreenRect.height / (double) ASHistoryFileView.m_RowHeight);
       if (num > this.m_DelPVstate.lv.totalRows - 1)
       {
         num = this.m_DelPVstate.lv.totalRows - 1;
         break;
       }
       break;
     default:
       return;
   }
   Event.current.Use();
   if (num == row)
     return;
   this.m_DelPVstate.lv.row = num;
   ListViewShared.MultiSelection((ListViewShared.InternalListViewState) null, row, num, ref this.m_DelPVstate.initialSelectedItem, ref this.m_DelPVstate.selectedItems);
   this.ScrollToDeletedItem(num);
   parentWin.DoLocalSelectionChange();
 }