Exemplo n.º 1
0
 public void OnGUI()
 {
     if (PackageExport.ms_Constants == null)
     {
         PackageExport.ms_Constants = new PackageExport.Constants();
     }
     if (this.m_assets == null)
     {
         return;
     }
     if (this.m_LeastIndent == 999999)
     {
         int num = this.m_LeastIndent;
         for (int i = 0; i < this.m_assets.Length; i++)
         {
             int num2 = PackageExport.CountOccurencesOfChar(this.m_assets[i].pathName, '/');
             if (num > num2)
             {
                 num = num2;
             }
         }
         this.m_LeastIndent = num - 1;
     }
     if (this.m_assets != null)
     {
         this.SetupListView();
         bool flag = Event.current.type == EventType.Repaint;
         GUILayout.BeginVertical(new GUILayoutOption[0]);
         GUILayout.Label("Items to Export", PackageExport.ms_Constants.title, new GUILayoutOption[0]);
         GUILayout.Space(1f);
         EditorGUIUtility.SetIconSize(new Vector2(16f, 16f));
         foreach (ListViewElement listViewElement in ListViewGUI.ListView(this.m_ListView, GUIStyle.none, new GUILayoutOption[0]))
         {
             AssetsItem assetsItem = this.m_assets[listViewElement.row];
             Rect       position   = listViewElement.position;
             position = new Rect(position.x + 1f, position.y, position.width - 2f, position.height);
             int num3 = PackageExport.CountOccurencesOfChar(assetsItem.pathName, '/') - this.m_LeastIndent;
             if (flag && this.m_ListView.row == listViewElement.row)
             {
                 PackageExport.ms_Constants.ConsoleEntryBackEven.Draw(position, false, false, true, false);
             }
             float y = listViewElement.position.y;
             position.x += 3f;
             int enabled = assetsItem.enabled;
             assetsItem.enabled = ((!GUI.Toggle(new Rect(position.x, position.y, 16f, 16f), assetsItem.enabled != 0, string.Empty)) ? 0 : 1);
             if (enabled != assetsItem.enabled)
             {
                 this.m_ListView.row        = listViewElement.row;
                 GUIUtility.keyboardControl = this.m_ListView.ID;
                 this.CheckChildren(assetsItem);
             }
             if (flag)
             {
                 Rect    position2  = new Rect(position.x + (float)(15 * num3), y + 1f, 16f, 16f);
                 Texture cachedIcon = AssetDatabase.GetCachedIcon(assetsItem.pathName);
                 if (cachedIcon != null)
                 {
                     GUI.DrawTexture(position2, cachedIcon);
                 }
             }
             position = new Rect(position.x + 20f + (float)(15 * num3), listViewElement.position.y, position.width - (float)(20 + 15 * num3), position.height);
             GUI.Label(position, assetsItem.pathName);
         }
         this.FrameLastGUIRect();
         GUILayout.EndVertical();
         if (this.m_ListView.row != -1 && GUIUtility.keyboardControl == this.m_ListView.ID && Event.current.type == EventType.KeyDown && Event.current.keyCode == KeyCode.Space)
         {
             this.m_assets[this.m_ListView.row].enabled = ((this.m_assets[this.m_ListView.row].enabled != 0) ? 0 : 1);
             this.CheckChildren(this.m_assets[this.m_ListView.row]);
             Event.current.Use();
         }
         EditorGUIUtility.SetIconSize(Vector2.zero);
         GUILayout.Space(5f);
         GUILayout.BeginHorizontal(new GUILayoutOption[0]);
         GUILayout.Space(10f);
         if (GUILayout.Button(EditorGUIUtility.TextContent("All"), new GUILayoutOption[]
         {
             GUILayout.Width(50f)
         }))
         {
             for (int j = 0; j < this.m_assets.Length; j++)
             {
                 this.m_assets[j].enabled = 1;
             }
         }
         if (GUILayout.Button(EditorGUIUtility.TextContent("None"), new GUILayoutOption[]
         {
             GUILayout.Width(50f)
         }))
         {
             for (int k = 0; k < this.m_assets.Length; k++)
             {
                 this.m_assets[k].enabled = 0;
             }
         }
         GUILayout.Space(10f);
         bool flag2 = GUILayout.Toggle(this.m_bIncludeDependencies, "Include dependencies", new GUILayoutOption[0]);
         if (flag2 != this.m_bIncludeDependencies)
         {
             this.m_bIncludeDependencies = flag2;
             this.BuildAssetList();
         }
         GUILayout.FlexibleSpace();
         if (GUILayout.Button(EditorGUIUtility.TextContent("Export..."), new GUILayoutOption[0]))
         {
             this.Export();
             GUIUtility.ExitGUI();
         }
         GUILayout.Space(10f);
         GUILayout.EndHorizontal();
         GUILayout.Space(10f);
     }
 }
Exemplo n.º 2
0
		public void OnGUI()
		{
			if (PackageExport.ms_Constants == null)
			{
				PackageExport.ms_Constants = new PackageExport.Constants();
			}
			if (this.m_assets == null)
			{
				return;
			}
			if (this.m_LeastIndent == 999999)
			{
				int num = this.m_LeastIndent;
				for (int i = 0; i < this.m_assets.Length; i++)
				{
					int num2 = PackageExport.CountOccurencesOfChar(this.m_assets[i].pathName, '/');
					if (num > num2)
					{
						num = num2;
					}
				}
				this.m_LeastIndent = num - 1;
			}
			if (this.m_assets != null)
			{
				this.SetupListView();
				bool flag = Event.current.type == EventType.Repaint;
				GUILayout.BeginVertical(new GUILayoutOption[0]);
				GUILayout.Label("Items to Export", PackageExport.ms_Constants.title, new GUILayoutOption[0]);
				GUILayout.Space(1f);
				EditorGUIUtility.SetIconSize(new Vector2(16f, 16f));
				foreach (ListViewElement listViewElement in ListViewGUI.ListView(this.m_ListView, GUIStyle.none, new GUILayoutOption[0]))
				{
					AssetsItem assetsItem = this.m_assets[listViewElement.row];
					Rect position = listViewElement.position;
					position = new Rect(position.x + 1f, position.y, position.width - 2f, position.height);
					int num3 = PackageExport.CountOccurencesOfChar(assetsItem.pathName, '/') - this.m_LeastIndent;
					if (flag && this.m_ListView.row == listViewElement.row)
					{
						PackageExport.ms_Constants.ConsoleEntryBackEven.Draw(position, false, false, true, false);
					}
					float y = listViewElement.position.y;
					position.x += 3f;
					int enabled = assetsItem.enabled;
					assetsItem.enabled = ((!GUI.Toggle(new Rect(position.x, position.y, 16f, 16f), assetsItem.enabled != 0, string.Empty)) ? 0 : 1);
					if (enabled != assetsItem.enabled)
					{
						this.m_ListView.row = listViewElement.row;
						GUIUtility.keyboardControl = this.m_ListView.ID;
						this.CheckChildren(assetsItem);
					}
					if (flag)
					{
						Rect position2 = new Rect(position.x + (float)(15 * num3), y + 1f, 16f, 16f);
						Texture cachedIcon = AssetDatabase.GetCachedIcon(assetsItem.pathName);
						if (cachedIcon != null)
						{
							GUI.DrawTexture(position2, cachedIcon);
						}
					}
					position = new Rect(position.x + 20f + (float)(15 * num3), listViewElement.position.y, position.width - (float)(20 + 15 * num3), position.height);
					GUI.Label(position, assetsItem.pathName);
				}
				this.FrameLastGUIRect();
				GUILayout.EndVertical();
				if (this.m_ListView.row != -1 && GUIUtility.keyboardControl == this.m_ListView.ID && Event.current.type == EventType.KeyDown && Event.current.keyCode == KeyCode.Space)
				{
					this.m_assets[this.m_ListView.row].enabled = ((this.m_assets[this.m_ListView.row].enabled != 0) ? 0 : 1);
					this.CheckChildren(this.m_assets[this.m_ListView.row]);
					Event.current.Use();
				}
				EditorGUIUtility.SetIconSize(Vector2.zero);
				GUILayout.Space(5f);
				GUILayout.BeginHorizontal(new GUILayoutOption[0]);
				GUILayout.Space(10f);
				if (GUILayout.Button(EditorGUIUtility.TextContent("All"), new GUILayoutOption[]
				{
					GUILayout.Width(50f)
				}))
				{
					for (int j = 0; j < this.m_assets.Length; j++)
					{
						this.m_assets[j].enabled = 1;
					}
				}
				if (GUILayout.Button(EditorGUIUtility.TextContent("None"), new GUILayoutOption[]
				{
					GUILayout.Width(50f)
				}))
				{
					for (int k = 0; k < this.m_assets.Length; k++)
					{
						this.m_assets[k].enabled = 0;
					}
				}
				GUILayout.Space(10f);
				bool flag2 = GUILayout.Toggle(this.m_bIncludeDependencies, "Include dependencies", new GUILayoutOption[0]);
				if (flag2 != this.m_bIncludeDependencies)
				{
					this.m_bIncludeDependencies = flag2;
					this.BuildAssetList();
				}
				GUILayout.FlexibleSpace();
				if (GUILayout.Button(EditorGUIUtility.TextContent("Export..."), new GUILayoutOption[0]))
				{
					this.Export();
					GUIUtility.ExitGUI();
				}
				GUILayout.Space(10f);
				GUILayout.EndHorizontal();
				GUILayout.Space(10f);
			}
		}