AddAssetItems() public method

public AddAssetItems ( AssetsItem assets ) : void
assets AssetsItem
return void
示例#1
0
 private void OnGUI()
 {
     if ((EditorSettings.externalVersionControl != ExternalVersionControl.Disabled) && (EditorSettings.externalVersionControl != ExternalVersionControl.AssetServer))
     {
         GUILayout.FlexibleSpace();
         GUILayout.BeginHorizontal(new GUILayoutOption[0]);
         GUILayout.FlexibleSpace();
         GUILayout.Label("Asset Server is disabled when external version control is used. Go to 'Edit -> Project Settings -> Editor' to re-enable it.", new GUILayoutOption[0]);
         GUILayout.FlexibleSpace();
         GUILayout.EndHorizontal();
         GUILayout.FlexibleSpace();
     }
     else
     {
         if (constants == null)
         {
             constants = new Constants();
         }
         if (!this.m_CheckedMaint && (Event.current.type != EventType.Layout))
         {
             if (!InternalEditorUtility.HasTeamLicense())
             {
                 base.Close();
                 GUIUtility.ExitGUI();
             }
             this.m_CheckedMaint = true;
         }
         if ((this.maxNickLength == 1) && (this.sharedChangesets != null))
         {
             for (int i = 0; i < this.sharedChangesets.Length; i++)
             {
                 int x = (int) constants.serverUpdateInfo.CalcSize(new GUIContent(this.sharedChangesets[i].owner)).x;
                 if (x > this.maxNickLength)
                 {
                     this.maxNickLength = x;
                 }
             }
             this.changesetContents = new GUIContent[this.sharedChangesets.Length];
             ParentViewState st = new ParentViewState();
             for (int j = 0; j < this.changesetContents.Length; j++)
             {
                 int num4 = 15;
                 Changeset assets = this.sharedChangesets[j];
                 char[] separator = new char[] { '\n' };
                 string str = assets.message.Split(separator)[0];
                 str = (str.Length >= 0x2d) ? (str.Substring(0, 0x2a) + "...") : str;
                 string tooltip = string.Format("[{0} {1}] {2}", assets.date, assets.owner, str);
                 num4--;
                 st.Clear();
                 st.AddAssetItems(assets);
                 for (int k = 0; k < st.folders.Length; k++)
                 {
                     if ((--num4 == 0) && !this.IsLastOne(k, 0, st))
                     {
                         tooltip = tooltip + "\n(and more...)";
                         break;
                     }
                     tooltip = tooltip + "\n" + st.folders[k].name;
                     for (int m = 0; m < st.folders[k].files.Length; m++)
                     {
                         if ((--num4 == 0) && !this.IsLastOne(k, m, st))
                         {
                             tooltip = tooltip + "\n(and more...)";
                             break;
                         }
                         tooltip = tooltip + "\n\t" + st.folders[k].files[m].name;
                     }
                     if (num4 == 0)
                     {
                         break;
                     }
                 }
                 char[] chArray2 = new char[] { '\n' };
                 this.changesetContents[j] = new GUIContent(this.sharedChangesets[j].message.Split(chArray2)[0], tooltip);
             }
             if (this.maxNickLength == 1)
             {
                 this.maxNickLength = 0;
             }
         }
         if (AssetServer.IsControllerBusy() != 0)
         {
             base.Repaint();
         }
         else
         {
             if (this.isInitialUpdate)
             {
                 this.isInitialUpdate = false;
                 this.SwitchSelectedPage(Page.Overview);
             }
             if ((Event.current.type == EventType.ExecuteCommand) && (Event.current.commandName == "Find"))
             {
                 this.SetShownSearchField(this.m_SearchToShow);
                 Event.current.Use();
             }
             GUILayout.BeginHorizontal(EditorStyles.toolbar, new GUILayoutOption[0]);
             int num7 = -1;
             bool enabled = GUI.enabled;
             if (this.ToolbarToggle(this.selectedPage == Page.Overview, this.pageTitles[0], EditorStyles.toolbarButton))
             {
                 num7 = 0;
             }
             GUI.enabled = ((!this.needsSetup && (this.sharedChangesets != null)) && (this.sharedChangesets.Length != 0)) && enabled;
             if (this.ToolbarToggle(this.selectedPage == Page.Update, this.pageTitles[1], EditorStyles.toolbarButton))
             {
                 num7 = 1;
             }
             GUI.enabled = (!this.needsSetup && (this.pv.lv.totalRows != 0)) && enabled;
             if (this.selectedPage > Page.Commit)
             {
                 if (this.ToolbarToggle(this.selectedPage == Page.Commit, this.pageTitles[2], EditorStyles.toolbarButton))
                 {
                     num7 = 2;
                 }
                 GUI.enabled = enabled;
                 if (this.ToolbarToggle(this.selectedPage > Page.Commit, this.pageTitles[3], EditorStyles.toolbarButton))
                 {
                     num7 = 3;
                 }
             }
             else
             {
                 if (this.ToolbarToggle(this.selectedPage == Page.Commit, this.pageTitles[2], EditorStyles.toolbarButton))
                 {
                     num7 = 2;
                 }
                 GUI.enabled = enabled;
             }
             if ((num7 != -1) && (num7 != this.selectedPage))
             {
                 if (this.selectedPage == Page.Commit)
                 {
                     this.NotifyClosingCommit();
                 }
                 if (num7 <= 2)
                 {
                     this.SwitchSelectedPage((Page) num7);
                     GUIUtility.ExitGUI();
                 }
             }
             GUILayout.FlexibleSpace();
             if (this.selectedPage == Page.History)
             {
                 this.DoSearchToggle(ShowSearchField.HistoryList);
             }
             if (!this.needsSetup)
             {
                 Page selectedPage = this.selectedPage;
                 if ((((selectedPage == Page.Overview) || (selectedPage == Page.Update)) || (selectedPage == Page.History)) && GUILayout.Button("Refresh", EditorStyles.toolbarButton, new GUILayoutOption[0]))
                 {
                     this.ActionRefresh();
                     GUIUtility.ExitGUI();
                 }
             }
             GUILayout.EndHorizontal();
             EditorGUIUtility.SetIconSize(this.iconSize);
             this.DoSelectedPageGUI();
             EditorGUIUtility.SetIconSize(Vector2.zero);
             if (Event.current.type == EventType.ContextClick)
             {
                 GUIUtility.hotControl = 0;
                 Rect position = new Rect(Event.current.mousePosition.x, Event.current.mousePosition.y, 1f, 1f);
                 EditorUtility.DisplayCustomMenu(position, !this.needsSetup ? this.dropDownMenuItems : this.unconfiguredDropDownMenuItems, null, new EditorUtility.SelectMenuItemFunction(this.ContextMenuClick), null);
                 Event.current.Use();
             }
         }
     }
 }
 private void OnGUI()
 {
   if (EditorSettings.externalVersionControl != ExternalVersionControl.Disabled && EditorSettings.externalVersionControl != ExternalVersionControl.AssetServer)
   {
     GUILayout.FlexibleSpace();
     GUILayout.BeginHorizontal();
     GUILayout.FlexibleSpace();
     GUILayout.Label("Asset Server is disabled when external version control is used. Go to 'Edit -> Project Settings -> Editor' to re-enable it.");
     GUILayout.FlexibleSpace();
     GUILayout.EndHorizontal();
     GUILayout.FlexibleSpace();
   }
   else
   {
     if (ASMainWindow.constants == null)
       ASMainWindow.constants = new ASMainWindow.Constants();
     if (!this.m_CheckedMaint && Event.current.type != EventType.Layout)
     {
       if (!InternalEditorUtility.HasTeamLicense())
       {
         this.Close();
         GUIUtility.ExitGUI();
       }
       this.m_CheckedMaint = true;
     }
     if (this.maxNickLength == 1 && this.sharedChangesets != null)
     {
       for (int index = 0; index < this.sharedChangesets.Length; ++index)
       {
         int x = (int) ASMainWindow.constants.serverUpdateInfo.CalcSize(new GUIContent(this.sharedChangesets[index].owner)).x;
         if (x > this.maxNickLength)
           this.maxNickLength = x;
       }
       this.changesetContents = new GUIContent[this.sharedChangesets.Length];
       ParentViewState st = new ParentViewState();
       for (int index = 0; index < this.changesetContents.Length; ++index)
       {
         int num1 = 15;
         Changeset sharedChangeset = this.sharedChangesets[index];
         string str1 = sharedChangeset.message.Split('\n')[0];
         string str2 = str1.Length >= 45 ? str1.Substring(0, 42) + "..." : str1;
         string tooltip = string.Format("[{0} {1}] {2}", (object) sharedChangeset.date, (object) sharedChangeset.owner, (object) str2);
         int num2 = num1 - 1;
         st.Clear();
         st.AddAssetItems(sharedChangeset);
         for (int f = 0; f < st.folders.Length; ++f)
         {
           if (--num2 == 0 && !this.IsLastOne(f, 0, st))
           {
             tooltip += "\n(and more...)";
             break;
           }
           tooltip = tooltip + "\n" + st.folders[f].name;
           for (int fl = 0; fl < st.folders[f].files.Length; ++fl)
           {
             if (--num2 == 0 && !this.IsLastOne(f, fl, st))
             {
               tooltip += "\n(and more...)";
               break;
             }
             tooltip = tooltip + "\n\t" + st.folders[f].files[fl].name;
           }
           if (num2 == 0)
             break;
         }
         this.changesetContents[index] = new GUIContent(this.sharedChangesets[index].message.Split('\n')[0], tooltip);
       }
       if (this.maxNickLength == 1)
         this.maxNickLength = 0;
     }
     if (AssetServer.IsControllerBusy() != 0)
     {
       this.Repaint();
     }
     else
     {
       if (this.isInitialUpdate)
       {
         this.isInitialUpdate = false;
         this.SwitchSelectedPage(ASMainWindow.Page.Overview);
       }
       if (Event.current.type == EventType.ExecuteCommand && Event.current.commandName == "Find")
       {
         this.SetShownSearchField(this.m_SearchToShow);
         Event.current.Use();
       }
       GUILayout.BeginHorizontal(EditorStyles.toolbar, new GUILayoutOption[0]);
       int num = -1;
       bool enabled = GUI.enabled;
       if (this.ToolbarToggle(this.selectedPage == ASMainWindow.Page.Overview, this.pageTitles[0], EditorStyles.toolbarButton))
         num = 0;
       GUI.enabled = !this.needsSetup && this.sharedChangesets != null && this.sharedChangesets.Length != 0 && enabled;
       if (this.ToolbarToggle(this.selectedPage == ASMainWindow.Page.Update, this.pageTitles[1], EditorStyles.toolbarButton))
         num = 1;
       GUI.enabled = !this.needsSetup && this.pv.lv.totalRows != 0 && enabled;
       if (this.selectedPage > ASMainWindow.Page.Commit)
       {
         if (this.ToolbarToggle(this.selectedPage == ASMainWindow.Page.Commit, this.pageTitles[2], EditorStyles.toolbarButton))
           num = 2;
         GUI.enabled = enabled;
         if (this.ToolbarToggle(this.selectedPage > ASMainWindow.Page.Commit, this.pageTitles[3], EditorStyles.toolbarButton))
           num = 3;
       }
       else
       {
         if (this.ToolbarToggle(this.selectedPage == ASMainWindow.Page.Commit, this.pageTitles[2], EditorStyles.toolbarButton))
           num = 2;
         GUI.enabled = enabled;
       }
       if (num != -1 && (ASMainWindow.Page) num != this.selectedPage)
       {
         if (this.selectedPage == ASMainWindow.Page.Commit)
           this.NotifyClosingCommit();
         if (num <= 2)
         {
           this.SwitchSelectedPage((ASMainWindow.Page) num);
           GUIUtility.ExitGUI();
         }
       }
       GUILayout.FlexibleSpace();
       if (this.selectedPage == ASMainWindow.Page.History)
         this.DoSearchToggle(ASMainWindow.ShowSearchField.HistoryList);
       if (!this.needsSetup)
       {
         switch (this.selectedPage)
         {
           case ASMainWindow.Page.Overview:
           case ASMainWindow.Page.Update:
           case ASMainWindow.Page.History:
             if (GUILayout.Button("Refresh", EditorStyles.toolbarButton, new GUILayoutOption[0]))
             {
               this.ActionRefresh();
               GUIUtility.ExitGUI();
               break;
             }
             break;
         }
       }
       GUILayout.EndHorizontal();
       EditorGUIUtility.SetIconSize(this.iconSize);
       this.DoSelectedPageGUI();
       EditorGUIUtility.SetIconSize(Vector2.zero);
       if (Event.current.type != EventType.ContextClick)
         return;
       GUIUtility.hotControl = 0;
       EditorUtility.DisplayCustomMenu(new Rect(Event.current.mousePosition.x, Event.current.mousePosition.y, 1f, 1f), !this.needsSetup ? this.dropDownMenuItems : this.unconfiguredDropDownMenuItems, (int[]) null, new EditorUtility.SelectMenuItemFunction(this.ContextMenuClick), (object) null);
       Event.current.Use();
     }
   }
 }
示例#3
0
		private void OnGUI()
		{
			if (EditorSettings.externalVersionControl != ExternalVersionControl.Disabled && EditorSettings.externalVersionControl != ExternalVersionControl.AssetServer)
			{
				GUILayout.FlexibleSpace();
				GUILayout.BeginHorizontal(new GUILayoutOption[0]);
				GUILayout.FlexibleSpace();
				GUILayout.Label("Asset Server is disabled when external version control is used. Go to 'Edit -> Project Settings -> Editor' to re-enable it.", new GUILayoutOption[0]);
				GUILayout.FlexibleSpace();
				GUILayout.EndHorizontal();
				GUILayout.FlexibleSpace();
				return;
			}
			if (ASMainWindow.constants == null)
			{
				ASMainWindow.constants = new ASMainWindow.Constants();
			}
			if (!this.m_CheckedMaint && Event.current.type != EventType.Layout)
			{
				if (!InternalEditorUtility.HasPro())
				{
					base.Close();
					GUIUtility.ExitGUI();
				}
				this.m_CheckedMaint = true;
			}
			if (this.maxNickLength == 1 && this.sharedChangesets != null)
			{
				for (int i = 0; i < this.sharedChangesets.Length; i++)
				{
					int num = (int)ASMainWindow.constants.serverUpdateInfo.CalcSize(new GUIContent(this.sharedChangesets[i].owner)).x;
					if (num > this.maxNickLength)
					{
						this.maxNickLength = num;
					}
				}
				this.changesetContents = new GUIContent[this.sharedChangesets.Length];
				ParentViewState parentViewState = new ParentViewState();
				for (int j = 0; j < this.changesetContents.Length; j++)
				{
					int num2 = 15;
					Changeset changeset = this.sharedChangesets[j];
					string text = changeset.message.Split(new char[]
					{
						'\n'
					})[0];
					text = ((text.Length >= 45) ? (text.Substring(0, 42) + "...") : text);
					string text2 = string.Format("[{0} {1}] {2}", changeset.date, changeset.owner, text);
					num2--;
					parentViewState.Clear();
					parentViewState.AddAssetItems(changeset);
					for (int k = 0; k < parentViewState.folders.Length; k++)
					{
						if (--num2 == 0 && !this.IsLastOne(k, 0, parentViewState))
						{
							text2 += "\n(and more...)";
							break;
						}
						text2 = text2 + "\n" + parentViewState.folders[k].name;
						for (int l = 0; l < parentViewState.folders[k].files.Length; l++)
						{
							if (--num2 == 0 && !this.IsLastOne(k, l, parentViewState))
							{
								text2 += "\n(and more...)";
								break;
							}
							text2 = text2 + "\n\t" + parentViewState.folders[k].files[l].name;
						}
						if (num2 == 0)
						{
							break;
						}
					}
					this.changesetContents[j] = new GUIContent(this.sharedChangesets[j].message.Split(new char[]
					{
						'\n'
					})[0], text2);
				}
				if (this.maxNickLength == 1)
				{
					this.maxNickLength = 0;
				}
			}
			if (AssetServer.IsControllerBusy() != 0)
			{
				base.Repaint();
				return;
			}
			if (this.isInitialUpdate)
			{
				this.isInitialUpdate = false;
				this.SwitchSelectedPage(ASMainWindow.Page.Overview);
			}
			if (Event.current.type == EventType.ExecuteCommand && Event.current.commandName == "Find")
			{
				this.SetShownSearchField(this.m_SearchToShow);
				Event.current.Use();
			}
			GUILayout.BeginHorizontal(EditorStyles.toolbar, new GUILayoutOption[0]);
			int num3 = -1;
			bool enabled = GUI.enabled;
			if (this.ToolbarToggle(this.selectedPage == ASMainWindow.Page.Overview, this.pageTitles[0], EditorStyles.toolbarButton))
			{
				num3 = 0;
			}
			GUI.enabled = (!this.needsSetup && this.sharedChangesets != null && this.sharedChangesets.Length != 0 && enabled);
			if (this.ToolbarToggle(this.selectedPage == ASMainWindow.Page.Update, this.pageTitles[1], EditorStyles.toolbarButton))
			{
				num3 = 1;
			}
			GUI.enabled = (!this.needsSetup && this.pv.lv.totalRows != 0 && enabled);
			if (this.selectedPage > ASMainWindow.Page.Commit)
			{
				if (this.ToolbarToggle(this.selectedPage == ASMainWindow.Page.Commit, this.pageTitles[2], EditorStyles.toolbarButton))
				{
					num3 = 2;
				}
				GUI.enabled = enabled;
				if (this.ToolbarToggle(this.selectedPage > ASMainWindow.Page.Commit, this.pageTitles[3], EditorStyles.toolbarButton))
				{
					num3 = 3;
				}
			}
			else
			{
				if (this.ToolbarToggle(this.selectedPage == ASMainWindow.Page.Commit, this.pageTitles[2], EditorStyles.toolbarButton))
				{
					num3 = 2;
				}
				GUI.enabled = enabled;
			}
			if (num3 != -1 && num3 != (int)this.selectedPage)
			{
				if (this.selectedPage == ASMainWindow.Page.Commit)
				{
					this.NotifyClosingCommit();
				}
				if (num3 <= 2)
				{
					this.SwitchSelectedPage((ASMainWindow.Page)num3);
					GUIUtility.ExitGUI();
				}
			}
			GUILayout.FlexibleSpace();
			if (this.selectedPage == ASMainWindow.Page.History)
			{
				this.DoSearchToggle(ASMainWindow.ShowSearchField.HistoryList);
			}
			if (!this.needsSetup)
			{
				switch (this.selectedPage)
				{
				case ASMainWindow.Page.Overview:
				case ASMainWindow.Page.Update:
				case ASMainWindow.Page.History:
					if (GUILayout.Button("Refresh", EditorStyles.toolbarButton, new GUILayoutOption[0]))
					{
						this.ActionRefresh();
						GUIUtility.ExitGUI();
					}
					break;
				}
			}
			GUILayout.EndHorizontal();
			EditorGUIUtility.SetIconSize(this.iconSize);
			this.DoSelectedPageGUI();
			EditorGUIUtility.SetIconSize(Vector2.zero);
			if (Event.current.type == EventType.ContextClick)
			{
				GUIUtility.hotControl = 0;
				Rect position = new Rect(Event.current.mousePosition.x, Event.current.mousePosition.y, 1f, 1f);
				EditorUtility.DisplayCustomMenu(position, (!this.needsSetup) ? this.dropDownMenuItems : this.unconfiguredDropDownMenuItems, null, new EditorUtility.SelectMenuItemFunction(this.ContextMenuClick), null);
				Event.current.Use();
			}
		}