Exemplo n.º 1
0
 public void Init(ParticleEffectUI owner, ParticleSystem[] systems)
 {
     if (ParticleSystemUI.s_ModuleNames == null)
     {
         ParticleSystemUI.s_ModuleNames = ParticleSystemUI.GetUIModuleNames();
     }
     if (ParticleSystemUI.s_Texts == null)
     {
         ParticleSystemUI.s_Texts = new ParticleSystemUI.Texts();
     }
     this.m_ParticleEffectUI = owner;
     this.m_ParticleSystems  = systems;
     this.m_ParticleSystemSerializedObject = new SerializedObject(this.m_ParticleSystems);
     this.m_RendererSerializedObject       = null;
     this.m_SupportsCullingText            = null;
     this.m_Modules = ParticleSystemUI.CreateUIModules(this, this.m_ParticleSystemSerializedObject);
     if (!(this.m_ParticleSystems.FirstOrDefault((ParticleSystem o) => o.GetComponent <ParticleSystemRenderer>() == null) != null))
     {
         this.InitRendererUI();
     }
     this.UpdateParticleSystemInfoString();
 }
Exemplo n.º 2
0
        public void OnGUI(ParticleSystem root, float width, bool fixedWidth)
        {
            if (ParticleSystemUI.s_Texts == null)
            {
                ParticleSystemUI.s_Texts = new ParticleSystemUI.Texts();
            }
            bool   flag = Event.current.type == EventType.Repaint;
            string text = (!this.m_ParticleSystem) ? null : this.m_ParticleSystem.gameObject.name;

            if (fixedWidth)
            {
                EditorGUIUtility.labelWidth = width * 0.4f;
                EditorGUILayout.BeginVertical(new GUILayoutOption[]
                {
                    GUILayout.Width(width)
                });
            }
            else
            {
                EditorGUIUtility.labelWidth  = 0f;
                EditorGUIUtility.labelWidth -= 4f;
                EditorGUILayout.BeginVertical(new GUILayoutOption[0]);
            }
            for (int i = 0; i < this.m_Modules.Length; i++)
            {
                ModuleUI moduleUI = this.m_Modules[i];
                if (moduleUI != null)
                {
                    bool flag2 = moduleUI == this.m_Modules[0];
                    if (moduleUI.visibleUI || flag2)
                    {
                        GUIContent gUIContent = new GUIContent();
                        Rect       rect;
                        GUIStyle   style;
                        if (flag2)
                        {
                            rect  = GUILayoutUtility.GetRect(width, 25f);
                            style = ParticleSystemStyles.Get().emitterHeaderStyle;
                        }
                        else
                        {
                            rect  = GUILayoutUtility.GetRect(width, 15f);
                            style = ParticleSystemStyles.Get().moduleHeaderStyle;
                        }
                        if (moduleUI.foldout)
                        {
                            using (new EditorGUI.DisabledScope(!moduleUI.enabled))
                            {
                                Rect position = EditorGUILayout.BeginVertical(ParticleSystemStyles.Get().modulePadding, new GUILayoutOption[0]);
                                position.y      -= 4f;
                                position.height += 4f;
                                GUI.Label(position, GUIContent.none, ParticleSystemStyles.Get().moduleBgStyle);
                                moduleUI.OnInspectorGUI(this.m_ParticleSystem);
                                EditorGUILayout.EndVertical();
                            }
                        }
                        if (flag2)
                        {
                            ParticleSystemRenderer particleSystemRenderer = this.GetParticleSystemRenderer();
                            float num       = 21f;
                            Rect  position2 = new Rect(rect.x + 4f, rect.y + 2f, num, num);
                            if (flag && particleSystemRenderer != null)
                            {
                                bool             flag3            = false;
                                int              num2             = 0;
                                RendererModuleUI rendererModuleUI = this.m_Modules[this.m_Modules.Length - 1] as RendererModuleUI;
                                if (rendererModuleUI != null)
                                {
                                    if (rendererModuleUI.IsMeshEmitter())
                                    {
                                        if (particleSystemRenderer.mesh != null)
                                        {
                                            num2 = particleSystemRenderer.mesh.GetInstanceID();
                                        }
                                    }
                                    else if (particleSystemRenderer.sharedMaterial != null)
                                    {
                                        num2 = particleSystemRenderer.sharedMaterial.GetInstanceID();
                                    }
                                    if (EditorUtility.IsDirty(num2))
                                    {
                                        AssetPreview.ClearTemporaryAssetPreviews();
                                    }
                                }
                                if (num2 != 0)
                                {
                                    Texture2D assetPreview = AssetPreview.GetAssetPreview(num2);
                                    if (assetPreview != null)
                                    {
                                        GUI.DrawTexture(position2, assetPreview, ScaleMode.StretchToFill, true);
                                        flag3 = true;
                                    }
                                }
                                if (!flag3)
                                {
                                    GUI.Label(position2, GUIContent.none, ParticleSystemStyles.Get().moduleBgStyle);
                                }
                            }
                            if (EditorGUI.ButtonMouseDown(position2, GUIContent.none, FocusType.Passive, GUIStyle.none))
                            {
                                if (EditorGUI.actionKey)
                                {
                                    List <int> list       = new List <int>();
                                    int        instanceID = this.m_ParticleSystem.gameObject.GetInstanceID();
                                    list.AddRange(Selection.instanceIDs);
                                    if (!list.Contains(instanceID) || list.Count != 1)
                                    {
                                        if (list.Contains(instanceID))
                                        {
                                            list.Remove(instanceID);
                                        }
                                        else
                                        {
                                            list.Add(instanceID);
                                        }
                                    }
                                    Selection.instanceIDs = list.ToArray();
                                }
                                else
                                {
                                    Selection.instanceIDs      = new int[0];
                                    Selection.activeInstanceID = this.m_ParticleSystem.gameObject.GetInstanceID();
                                }
                            }
                        }
                        Rect position3 = new Rect(rect.x + 2f, rect.y + 1f, 13f, 13f);
                        if (!flag2 && GUI.Button(position3, GUIContent.none, GUIStyle.none))
                        {
                            moduleUI.enabled = !moduleUI.enabled;
                        }
                        Rect position4 = new Rect(rect.x + rect.width - 10f, rect.y + rect.height - 10f, 10f, 10f);
                        Rect position5 = new Rect(position4.x - 4f, position4.y - 4f, position4.width + 4f, position4.height + 4f);
                        Rect position6 = new Rect(position4.x - 23f, position4.y - 3f, 16f, 16f);
                        if (flag2 && EditorGUI.ButtonMouseDown(position5, ParticleSystemUI.s_Texts.addModules, FocusType.Passive, GUIStyle.none))
                        {
                            this.ShowAddModuleMenu();
                        }
                        if (!string.IsNullOrEmpty(text))
                        {
                            gUIContent.text = ((!flag2) ? moduleUI.displayName : text);
                        }
                        else
                        {
                            gUIContent.text = moduleUI.displayName;
                        }
                        gUIContent.tooltip = moduleUI.toolTip;
                        bool flag4 = GUI.Toggle(rect, moduleUI.foldout, gUIContent, style);
                        if (flag4 != moduleUI.foldout)
                        {
                            int button = Event.current.button;
                            if (button != 0)
                            {
                                if (button == 1)
                                {
                                    if (flag2)
                                    {
                                        this.ShowEmitterMenu();
                                    }
                                    else
                                    {
                                        this.ShowModuleMenu(i);
                                    }
                                }
                            }
                            else
                            {
                                bool foldout = !moduleUI.foldout;
                                if (Event.current.control)
                                {
                                    ModuleUI[] modules = this.m_Modules;
                                    for (int j = 0; j < modules.Length; j++)
                                    {
                                        ModuleUI moduleUI2 = modules[j];
                                        if (moduleUI2 != null && moduleUI2.visibleUI)
                                        {
                                            moduleUI2.foldout = foldout;
                                        }
                                    }
                                }
                                else
                                {
                                    moduleUI.foldout = foldout;
                                }
                            }
                        }
                        if (!flag2)
                        {
                            GUI.Toggle(position3, moduleUI.enabled, GUIContent.none, ParticleSystemStyles.Get().checkmark);
                        }
                        if (flag)
                        {
                            if (flag2)
                            {
                                GUI.Label(position4, GUIContent.none, ParticleSystemStyles.Get().plus);
                            }
                        }
                        ParticleSystemUI.s_Texts.supportsCullingText.tooltip = this.m_SupportsCullingText;
                        if (flag2 && ParticleSystemUI.s_Texts.supportsCullingText.tooltip != null)
                        {
                            GUI.Label(position6, ParticleSystemUI.s_Texts.supportsCullingText);
                        }
                        GUILayout.Space(1f);
                    }
                }
            }
            GUILayout.Space(-1f);
            EditorGUILayout.EndVertical();
            this.ApplyProperties();
        }
Exemplo n.º 3
0
		public void OnGUI(ParticleSystem root, float width, bool fixedWidth)
		{
			if (ParticleSystemUI.s_Texts == null)
			{
				ParticleSystemUI.s_Texts = new ParticleSystemUI.Texts();
			}
			bool flag = Event.current.type == EventType.Repaint;
			string text = (!this.m_ParticleSystem) ? null : this.m_ParticleSystem.gameObject.name;
			if (fixedWidth)
			{
				EditorGUIUtility.labelWidth = width * 0.55f;
				EditorGUILayout.BeginVertical(new GUILayoutOption[]
				{
					GUILayout.Width(width)
				});
			}
			else
			{
				EditorGUIUtility.labelWidth = 0f;
				EditorGUIUtility.labelWidth -= 4f;
				EditorGUILayout.BeginVertical(new GUILayoutOption[0]);
			}
			for (int i = 0; i < this.m_Modules.Length; i++)
			{
				ModuleUI moduleUI = this.m_Modules[i];
				if (moduleUI != null)
				{
					bool flag2 = moduleUI == this.m_Modules[0];
					if (moduleUI.visibleUI || flag2)
					{
						GUIContent gUIContent = new GUIContent();
						Rect rect;
						GUIStyle style;
						if (flag2)
						{
							rect = GUILayoutUtility.GetRect(width, 25f);
							style = ParticleSystemStyles.Get().emitterHeaderStyle;
						}
						else
						{
							rect = GUILayoutUtility.GetRect(width, 15f);
							style = ParticleSystemStyles.Get().moduleHeaderStyle;
						}
						if (moduleUI.foldout)
						{
							EditorGUI.BeginDisabledGroup(!moduleUI.enabled);
							Rect position = EditorGUILayout.BeginVertical(ParticleSystemStyles.Get().modulePadding, new GUILayoutOption[0]);
							position.y -= 4f;
							position.height += 4f;
							GUI.Label(position, GUIContent.none, ParticleSystemStyles.Get().moduleBgStyle);
							moduleUI.OnInspectorGUI(this.m_ParticleSystem);
							EditorGUILayout.EndVertical();
							EditorGUI.EndDisabledGroup();
						}
						if (flag2)
						{
							ParticleSystemRenderer particleSystemRenderer = this.GetParticleSystemRenderer();
							float num = 21f;
							Rect position2 = new Rect(rect.x + 4f, rect.y + 2f, num, num);
							if (flag && particleSystemRenderer != null)
							{
								bool flag3 = false;
								int num2 = 0;
								RendererModuleUI rendererModuleUI = this.m_Modules[this.m_Modules.Length - 1] as RendererModuleUI;
								if (rendererModuleUI != null)
								{
									if (rendererModuleUI.IsMeshEmitter())
									{
										if (particleSystemRenderer.mesh != null)
										{
											num2 = particleSystemRenderer.mesh.GetInstanceID();
										}
									}
									else
									{
										if (particleSystemRenderer.sharedMaterial != null)
										{
											num2 = particleSystemRenderer.sharedMaterial.GetInstanceID();
										}
									}
									if (EditorUtility.IsDirty(num2))
									{
										AssetPreview.ClearTemporaryAssetPreviews();
									}
								}
								if (num2 != 0)
								{
									Texture2D assetPreview = AssetPreview.GetAssetPreview(num2);
									if (assetPreview != null)
									{
										GUI.DrawTexture(position2, assetPreview, ScaleMode.StretchToFill, true);
										flag3 = true;
									}
								}
								if (!flag3)
								{
									GUI.Label(position2, GUIContent.none, ParticleSystemStyles.Get().moduleBgStyle);
								}
							}
							if (EditorGUI.ButtonMouseDown(position2, GUIContent.none, FocusType.Passive, GUIStyle.none))
							{
								if (EditorGUI.actionKey)
								{
									List<int> list = new List<int>();
									int instanceID = this.m_ParticleSystem.gameObject.GetInstanceID();
									list.AddRange(Selection.instanceIDs);
									if (!list.Contains(instanceID) || list.Count != 1)
									{
										if (list.Contains(instanceID))
										{
											list.Remove(instanceID);
										}
										else
										{
											list.Add(instanceID);
										}
									}
									Selection.instanceIDs = list.ToArray();
								}
								else
								{
									Selection.instanceIDs = new int[0];
									Selection.activeInstanceID = this.m_ParticleSystem.gameObject.GetInstanceID();
								}
							}
						}
						Rect position3 = new Rect(rect.x + 2f, rect.y + 1f, 13f, 13f);
						if (!flag2 && GUI.Button(position3, GUIContent.none, GUIStyle.none))
						{
							moduleUI.enabled = !moduleUI.enabled;
						}
						Rect position4 = new Rect(rect.x + rect.width - 10f, rect.y + rect.height - 10f, 10f, 10f);
						Rect position5 = new Rect(position4.x - 4f, position4.y - 4f, position4.width + 4f, position4.height + 4f);
						Rect position6 = new Rect(position4.x - 23f, position4.y - 3f, 16f, 16f);
						if (flag2 && EditorGUI.ButtonMouseDown(position5, ParticleSystemUI.s_Texts.addModules, FocusType.Passive, GUIStyle.none))
						{
							this.ShowAddModuleMenu();
						}
						if (!string.IsNullOrEmpty(text))
						{
							gUIContent.text = ((!flag2) ? moduleUI.displayName : text);
						}
						else
						{
							gUIContent.text = moduleUI.displayName;
						}
						gUIContent.tooltip = moduleUI.toolTip;
						bool flag4 = GUI.Toggle(rect, moduleUI.foldout, gUIContent, style);
						if (flag4 != moduleUI.foldout)
						{
							int button = Event.current.button;
							if (button != 0)
							{
								if (button == 1)
								{
									if (flag2)
									{
										this.ShowEmitterMenu();
									}
									else
									{
										this.ShowModuleMenu(i);
									}
								}
							}
							else
							{
								bool foldout = !moduleUI.foldout;
								if (Event.current.control)
								{
									ModuleUI[] modules = this.m_Modules;
									for (int j = 0; j < modules.Length; j++)
									{
										ModuleUI moduleUI2 = modules[j];
										if (moduleUI2 != null && moduleUI2.visibleUI)
										{
											moduleUI2.foldout = foldout;
										}
									}
								}
								else
								{
									moduleUI.foldout = foldout;
								}
							}
						}
						if (!flag2)
						{
							GUI.Toggle(position3, moduleUI.enabled, GUIContent.none, ParticleSystemStyles.Get().checkmark);
						}
						if (flag && flag2)
						{
							GUI.Label(position4, GUIContent.none, ParticleSystemStyles.Get().plus);
						}
						ParticleSystemUI.s_Texts.supportsCullingText.tooltip = ParticleSystemUI.m_SupportsCullingText;
						if (flag2 && ParticleSystemUI.s_Texts.supportsCullingText.tooltip != null)
						{
							GUI.Label(position6, ParticleSystemUI.s_Texts.supportsCullingText);
						}
						GUILayout.Space(1f);
					}
				}
			}
			GUILayout.Space(-1f);
			EditorGUILayout.EndVertical();
			this.ApplyProperties();
		}
 public void OnGUI(ParticleSystem root, float width, bool fixedWidth)
 {
   if (ParticleSystemUI.s_Texts == null)
     ParticleSystemUI.s_Texts = new ParticleSystemUI.Texts();
   bool flag1 = Event.current.type == EventType.Repaint;
   string str = !(bool) ((Object) this.m_ParticleSystem) ? (string) null : this.m_ParticleSystem.gameObject.name;
   if (fixedWidth)
   {
     EditorGUIUtility.labelWidth = width * 0.55f;
     EditorGUILayout.BeginVertical(GUILayout.Width(width));
   }
   else
   {
     EditorGUIUtility.labelWidth = 0.0f;
     EditorGUIUtility.labelWidth -= 4f;
     EditorGUILayout.BeginVertical();
   }
   for (int moduleIndex = 0; moduleIndex < this.m_Modules.Length; ++moduleIndex)
   {
     ModuleUI module1 = this.m_Modules[moduleIndex];
     if (module1 != null)
     {
       bool flag2 = module1 == this.m_Modules[0];
       if (module1.visibleUI || flag2)
       {
         GUIContent content = new GUIContent();
         Rect rect;
         GUIStyle style;
         if (flag2)
         {
           rect = GUILayoutUtility.GetRect(width, 25f);
           style = ParticleSystemStyles.Get().emitterHeaderStyle;
         }
         else
         {
           rect = GUILayoutUtility.GetRect(width, 15f);
           style = ParticleSystemStyles.Get().moduleHeaderStyle;
         }
         if (module1.foldout)
         {
           EditorGUI.BeginDisabledGroup(!module1.enabled);
           Rect position = EditorGUILayout.BeginVertical(ParticleSystemStyles.Get().modulePadding, new GUILayoutOption[0]);
           position.y -= 4f;
           position.height += 4f;
           GUI.Label(position, GUIContent.none, ParticleSystemStyles.Get().moduleBgStyle);
           module1.OnInspectorGUI(this.m_ParticleSystem);
           EditorGUILayout.EndVertical();
           EditorGUI.EndDisabledGroup();
         }
         if (flag2)
         {
           ParticleSystemRenderer particleSystemRenderer = this.GetParticleSystemRenderer();
           float num = 21f;
           Rect position = new Rect(rect.x + 4f, rect.y + 2f, num, num);
           if (flag1 && (Object) particleSystemRenderer != (Object) null)
           {
             bool flag3 = false;
             int instanceID = 0;
             RendererModuleUI module2 = this.m_Modules[this.m_Modules.Length - 1] as RendererModuleUI;
             if (module2 != null)
             {
               if (module2.IsMeshEmitter())
               {
                 if ((Object) particleSystemRenderer.mesh != (Object) null)
                   instanceID = particleSystemRenderer.mesh.GetInstanceID();
               }
               else if ((Object) particleSystemRenderer.sharedMaterial != (Object) null)
                 instanceID = particleSystemRenderer.sharedMaterial.GetInstanceID();
               if (EditorUtility.IsDirty(instanceID))
                 AssetPreview.ClearTemporaryAssetPreviews();
             }
             if (instanceID != 0)
             {
               Texture2D assetPreview = AssetPreview.GetAssetPreview(instanceID);
               if ((Object) assetPreview != (Object) null)
               {
                 GUI.DrawTexture(position, (Texture) assetPreview, ScaleMode.StretchToFill, true);
                 flag3 = true;
               }
             }
             if (!flag3)
               GUI.Label(position, GUIContent.none, ParticleSystemStyles.Get().moduleBgStyle);
           }
           if (EditorGUI.ButtonMouseDown(position, GUIContent.none, FocusType.Passive, GUIStyle.none))
           {
             if (EditorGUI.actionKey)
             {
               List<int> intList = new List<int>();
               int instanceId = this.m_ParticleSystem.gameObject.GetInstanceID();
               intList.AddRange((IEnumerable<int>) Selection.instanceIDs);
               if (!intList.Contains(instanceId) || intList.Count != 1)
               {
                 if (intList.Contains(instanceId))
                   intList.Remove(instanceId);
                 else
                   intList.Add(instanceId);
               }
               Selection.instanceIDs = intList.ToArray();
             }
             else
             {
               Selection.instanceIDs = new int[0];
               Selection.activeInstanceID = this.m_ParticleSystem.gameObject.GetInstanceID();
             }
           }
         }
         Rect position1 = new Rect(rect.x + 2f, rect.y + 1f, 13f, 13f);
         if (!flag2 && GUI.Button(position1, GUIContent.none, GUIStyle.none))
           module1.enabled = !module1.enabled;
         Rect position2 = new Rect((float) ((double) rect.x + (double) rect.width - 10.0), (float) ((double) rect.y + (double) rect.height - 10.0), 10f, 10f);
         Rect position3 = new Rect(position2.x - 4f, position2.y - 4f, position2.width + 4f, position2.height + 4f);
         Rect position4 = new Rect(position2.x - 23f, position2.y - 3f, 16f, 16f);
         if (flag2 && EditorGUI.ButtonMouseDown(position3, ParticleSystemUI.s_Texts.addModules, FocusType.Passive, GUIStyle.none))
           this.ShowAddModuleMenu();
         content.text = string.IsNullOrEmpty(str) ? module1.displayName : (!flag2 ? module1.displayName : str);
         content.tooltip = module1.toolTip;
         if (GUI.Toggle(rect, module1.foldout, content, style) != module1.foldout)
         {
           switch (Event.current.button)
           {
             case 0:
               bool flag4 = !module1.foldout;
               if (Event.current.control)
               {
                 foreach (ModuleUI module2 in this.m_Modules)
                 {
                   if (module2 != null && module2.visibleUI)
                     module2.foldout = flag4;
                 }
                 break;
               }
               module1.foldout = flag4;
               break;
             case 1:
               if (flag2)
               {
                 this.ShowEmitterMenu();
                 break;
               }
               this.ShowModuleMenu(moduleIndex);
               break;
           }
         }
         if (!flag2)
           GUI.Toggle(position1, module1.enabled, GUIContent.none, ParticleSystemStyles.Get().checkmark);
         if (flag1 && flag2)
           GUI.Label(position2, GUIContent.none, ParticleSystemStyles.Get().plus);
         ParticleSystemUI.s_Texts.supportsCullingText.tooltip = ParticleSystemUI.m_SupportsCullingText;
         if (flag2 && ParticleSystemUI.s_Texts.supportsCullingText.tooltip != null)
           GUI.Label(position4, ParticleSystemUI.s_Texts.supportsCullingText);
         GUILayout.Space(1f);
       }
     }
   }
   GUILayout.Space(-1f);
   EditorGUILayout.EndVertical();
   this.ApplyProperties();
 }
Exemplo n.º 5
0
        public void OnGUI(ParticleSystem root, float width, bool fixedWidth)
        {
            if (ParticleSystemUI.s_Texts == null)
            {
                ParticleSystemUI.s_Texts = new ParticleSystemUI.Texts();
            }
            bool   flag1 = Event.current.type == EventType.Repaint;
            string str   = !(bool)((Object)this.m_ParticleSystem) ? (string)null : this.m_ParticleSystem.gameObject.name;

            if (fixedWidth)
            {
                EditorGUIUtility.labelWidth = width * 0.55f;
                EditorGUILayout.BeginVertical(GUILayout.Width(width));
            }
            else
            {
                EditorGUIUtility.labelWidth  = 0.0f;
                EditorGUIUtility.labelWidth -= 4f;
                EditorGUILayout.BeginVertical();
            }
            for (int moduleIndex = 0; moduleIndex < this.m_Modules.Length; ++moduleIndex)
            {
                ModuleUI module1 = this.m_Modules[moduleIndex];
                if (module1 != null)
                {
                    bool flag2 = module1 == this.m_Modules[0];
                    if (module1.visibleUI || flag2)
                    {
                        GUIContent content = new GUIContent();
                        Rect       rect;
                        GUIStyle   style;
                        if (flag2)
                        {
                            rect  = GUILayoutUtility.GetRect(width, 25f);
                            style = ParticleSystemStyles.Get().emitterHeaderStyle;
                        }
                        else
                        {
                            rect  = GUILayoutUtility.GetRect(width, 15f);
                            style = ParticleSystemStyles.Get().moduleHeaderStyle;
                        }
                        if (module1.foldout)
                        {
                            EditorGUI.BeginDisabledGroup(!module1.enabled);
                            Rect position = EditorGUILayout.BeginVertical(ParticleSystemStyles.Get().modulePadding, new GUILayoutOption[0]);
                            position.y      -= 4f;
                            position.height += 4f;
                            GUI.Label(position, GUIContent.none, ParticleSystemStyles.Get().moduleBgStyle);
                            module1.OnInspectorGUI(this.m_ParticleSystem);
                            EditorGUILayout.EndVertical();
                            EditorGUI.EndDisabledGroup();
                        }
                        if (flag2)
                        {
                            ParticleSystemRenderer particleSystemRenderer = this.GetParticleSystemRenderer();
                            float num      = 21f;
                            Rect  position = new Rect(rect.x + 4f, rect.y + 2f, num, num);
                            if (flag1 && (Object)particleSystemRenderer != (Object)null)
                            {
                                bool             flag3      = false;
                                int              instanceID = 0;
                                RendererModuleUI module2    = this.m_Modules[this.m_Modules.Length - 1] as RendererModuleUI;
                                if (module2 != null)
                                {
                                    if (module2.IsMeshEmitter())
                                    {
                                        if ((Object)particleSystemRenderer.mesh != (Object)null)
                                        {
                                            instanceID = particleSystemRenderer.mesh.GetInstanceID();
                                        }
                                    }
                                    else if ((Object)particleSystemRenderer.sharedMaterial != (Object)null)
                                    {
                                        instanceID = particleSystemRenderer.sharedMaterial.GetInstanceID();
                                    }
                                    if (EditorUtility.IsDirty(instanceID))
                                    {
                                        AssetPreview.ClearTemporaryAssetPreviews();
                                    }
                                }
                                if (instanceID != 0)
                                {
                                    Texture2D assetPreview = AssetPreview.GetAssetPreview(instanceID);
                                    if ((Object)assetPreview != (Object)null)
                                    {
                                        GUI.DrawTexture(position, (Texture)assetPreview, ScaleMode.StretchToFill, true);
                                        flag3 = true;
                                    }
                                }
                                if (!flag3)
                                {
                                    GUI.Label(position, GUIContent.none, ParticleSystemStyles.Get().moduleBgStyle);
                                }
                            }
                            if (EditorGUI.ButtonMouseDown(position, GUIContent.none, FocusType.Passive, GUIStyle.none))
                            {
                                if (EditorGUI.actionKey)
                                {
                                    List <int> intList    = new List <int>();
                                    int        instanceId = this.m_ParticleSystem.gameObject.GetInstanceID();
                                    intList.AddRange((IEnumerable <int>)Selection.instanceIDs);
                                    if (!intList.Contains(instanceId) || intList.Count != 1)
                                    {
                                        if (intList.Contains(instanceId))
                                        {
                                            intList.Remove(instanceId);
                                        }
                                        else
                                        {
                                            intList.Add(instanceId);
                                        }
                                    }
                                    Selection.instanceIDs = intList.ToArray();
                                }
                                else
                                {
                                    Selection.instanceIDs      = new int[0];
                                    Selection.activeInstanceID = this.m_ParticleSystem.gameObject.GetInstanceID();
                                }
                            }
                        }
                        Rect position1 = new Rect(rect.x + 2f, rect.y + 1f, 13f, 13f);
                        if (!flag2 && GUI.Button(position1, GUIContent.none, GUIStyle.none))
                        {
                            module1.enabled = !module1.enabled;
                        }
                        Rect position2 = new Rect((float)((double)rect.x + (double)rect.width - 10.0), (float)((double)rect.y + (double)rect.height - 10.0), 10f, 10f);
                        Rect position3 = new Rect(position2.x - 4f, position2.y - 4f, position2.width + 4f, position2.height + 4f);
                        Rect position4 = new Rect(position2.x - 23f, position2.y - 3f, 16f, 16f);
                        if (flag2 && EditorGUI.ButtonMouseDown(position3, ParticleSystemUI.s_Texts.addModules, FocusType.Passive, GUIStyle.none))
                        {
                            this.ShowAddModuleMenu();
                        }
                        content.text    = string.IsNullOrEmpty(str) ? module1.displayName : (!flag2 ? module1.displayName : str);
                        content.tooltip = module1.toolTip;
                        if (GUI.Toggle(rect, module1.foldout, content, style) != module1.foldout)
                        {
                            switch (Event.current.button)
                            {
                            case 0:
                                bool flag4 = !module1.foldout;
                                if (Event.current.control)
                                {
                                    foreach (ModuleUI module2 in this.m_Modules)
                                    {
                                        if (module2 != null && module2.visibleUI)
                                        {
                                            module2.foldout = flag4;
                                        }
                                    }
                                    break;
                                }
                                module1.foldout = flag4;
                                break;

                            case 1:
                                if (flag2)
                                {
                                    this.ShowEmitterMenu();
                                    break;
                                }
                                this.ShowModuleMenu(moduleIndex);
                                break;
                            }
                        }
                        if (!flag2)
                        {
                            GUI.Toggle(position1, module1.enabled, GUIContent.none, ParticleSystemStyles.Get().checkmark);
                        }
                        if (flag1 && flag2)
                        {
                            GUI.Label(position2, GUIContent.none, ParticleSystemStyles.Get().plus);
                        }
                        ParticleSystemUI.s_Texts.supportsCullingText.tooltip = ParticleSystemUI.m_SupportsCullingText;
                        if (flag2 && ParticleSystemUI.s_Texts.supportsCullingText.tooltip != null)
                        {
                            GUI.Label(position4, ParticleSystemUI.s_Texts.supportsCullingText);
                        }
                        GUILayout.Space(1f);
                    }
                }
            }
            GUILayout.Space(-1f);
            EditorGUILayout.EndVertical();
            this.ApplyProperties();
        }