private void ResetModules() { ModuleUI[] modules = this.m_Modules; for (int i = 0; i < modules.Length; i++) { ModuleUI moduleUI = modules[i]; if (moduleUI != null) { moduleUI.enabled = false; if (!ParticleEffectUI.GetAllModulesVisible()) { moduleUI.visibleUI = false; } } } if (this.m_Modules[this.m_Modules.Length - 1] == null) { this.InitRendererUI(); } int[] array = new int[] { 1, 2, this.m_Modules.Length - 1 }; for (int j = 0; j < array.Length; j++) { int num = array[j]; if (this.m_Modules[num] != null) { this.m_Modules[num].enabled = true; this.m_Modules[num].visibleUI = true; } } }
private void ResetModules() { foreach (ModuleUI module in this.m_Modules) { if (module != null) { module.enabled = false; if (!ParticleEffectUI.GetAllModulesVisible()) { module.visibleUI = false; } } } if (this.m_Modules[this.m_Modules.Length - 1] == null) { this.InitRendererUI(); } int[] numArray = new int[3] { 1, 2, this.m_Modules.Length - 1 }; foreach (int index in numArray) { if (this.m_Modules[index] != null) { this.m_Modules[index].enabled = true; this.m_Modules[index].visibleUI = true; } } }
private void InitAllEmitters(ParticleSystem[] shurikens) { int num = shurikens.Length; if (num == 0) { return; } this.m_Emitters = new ParticleSystemUI[num]; for (int i = 0; i < num; i++) { this.m_Emitters[i] = new ParticleSystemUI(); this.m_Emitters[i].Init(this, shurikens[i]); } ParticleSystemUI[] emitters = this.m_Emitters; for (int j = 0; j < emitters.Length; j++) { ParticleSystemUI particleSystemUI = emitters[j]; ModuleUI[] modules = particleSystemUI.m_Modules; for (int k = 0; k < modules.Length; k++) { ModuleUI moduleUI = modules[k]; if (moduleUI != null) { moduleUI.Validate(); } } } if (ParticleEffectUI.GetAllModulesVisible()) { this.SetAllModulesVisible(true); } }
private void InitAllEmitters(ParticleSystem[] shurikens) { int length = shurikens.Length; if (length == 0) { return; } this.m_Emitters = new ParticleSystemUI[length]; for (int index = 0; index < length; ++index) { this.m_Emitters[index] = new ParticleSystemUI(); this.m_Emitters[index].Init(this, shurikens[index]); } foreach (ParticleSystemUI emitter in this.m_Emitters) { foreach (ModuleUI module in emitter.m_Modules) { if (module != null) { module.Validate(); } } } if (!ParticleEffectUI.GetAllModulesVisible()) { return; } this.SetAllModulesVisible(true); }
private void ResetModules() { foreach (ModuleUI eui in this.m_Modules) { if (eui != null) { eui.enabled = false; if (!ParticleEffectUI.GetAllModulesVisible()) { eui.visibleUI = false; } } } if (this.m_Modules[this.m_Modules.Length - 1] == null) { this.InitRendererUI(); } int[] numArray1 = new int[] { 1, 2, this.m_Modules.Length - 1 }; foreach (int num3 in numArray1) { if (this.m_Modules[num3] != null) { this.m_Modules[num3].enabled = true; this.m_Modules[num3].visibleUI = true; } } }
void ResetModules() { // Reset all foreach (var module in m_Modules) { if (module != null) { module.enabled = false; if (!ParticleEffectUI.GetAllModulesVisible()) { module.visibleUI = false; } } } // Default setup has a renderer if (m_Modules.Last() == null) { InitRendererUI(); } // Default setup has shape, emission and renderer int[] defaultEnabledModulesIndicies = { 1, 2, m_Modules.Length - 1 }; for (int i = 0; i < defaultEnabledModulesIndicies.Length; ++i) { int moduleIndex = defaultEnabledModulesIndicies[i]; if (m_Modules[moduleIndex] != null) { m_Modules[moduleIndex].enabled = true; m_Modules[moduleIndex].visibleUI = true; } } }
internal void CheckVisibilityState() { if (!(this is RendererModuleUI) && !this.m_Enabled.boolValue && !ParticleEffectUI.GetAllModulesVisible()) { this.SetVisibilityState(ModuleUI.VisibilityState.NotVisible); } if (this.m_Enabled.boolValue && !this.visibleUI) { this.SetVisibilityState(ModuleUI.VisibilityState.VisibleAndFolded); } }
private void ShowModuleMenu(int moduleIndex) { GenericMenu genericMenu = new GenericMenu(); if (!ParticleEffectUI.GetAllModulesVisible()) { genericMenu.AddItem(new GUIContent("Remove"), false, new GenericMenu.MenuFunction2(this.ModuleMenuCallback), moduleIndex); } else { genericMenu.AddDisabledItem(new GUIContent("Remove")); } genericMenu.ShowAsContext(); Event.current.Use(); }
void ShowModuleMenu(int moduleIndex) { // Now create the menu, add items and show it GenericMenu menu = new GenericMenu(); if (!ParticleEffectUI.GetAllModulesVisible()) { menu.AddItem(EditorGUIUtility.TrTextContent("Remove"), false, ModuleMenuCallback, moduleIndex); } else { menu.AddDisabledItem(EditorGUIUtility.TrTextContent("Remove")); // Do not allow remove module when always show modules is enabled } menu.ShowAsContext(); Event.current.Use(); }
internal void CheckVisibilityState() { bool isRendererModule = this is RendererModuleUI; // Ensure disabled modules are only visible if show all modules is true. Except the renderer module, we want that // to be shown always if the module is there which means that we have a ParticleSystemRenderer if (!isRendererModule && !m_Enabled.boolValue && !ParticleEffectUI.GetAllModulesVisible()) { SetVisibilityState(VisibilityState.NotVisible); } // Ensure enabled modules are visible if (m_Enabled.boolValue && !visibleUI) { SetVisibilityState(VisibilityState.VisibleAndFolded); } }
private void ModuleMenuCallback(object obj) { int index = (int)obj; if (index == (this.m_Modules.Length - 1)) { this.ClearRenderer(); } else { if (!ParticleEffectUI.GetAllModulesVisible()) { this.m_Modules[index].visibleUI = false; } this.m_Modules[index].enabled = false; } }
private void ModuleMenuCallback(object obj) { int num = (int)obj; bool flag = num == this.m_Modules.Length - 1; if (flag) { this.ClearRenderer(); } else { if (!ParticleEffectUI.GetAllModulesVisible()) { this.m_Modules[num].visibleUI = false; } this.m_Modules[num].enabled = false; } }
void ModuleMenuCallback(object obj) { int moduleIndex = (int)obj; bool isRendererModule = (moduleIndex == m_Modules.Length - 1); if (isRendererModule) { ClearRenderers(); } else { if (!ParticleEffectUI.GetAllModulesVisible()) { m_Modules[moduleIndex].visibleUI = false; } m_Modules[moduleIndex].enabled = false; } }
private void ShowAddModuleMenu() { GenericMenu genericMenu = new GenericMenu(); for (int i = 0; i < ParticleSystemUI.s_ModuleNames.Length; i++) { if (this.m_Modules[i] == null || !this.m_Modules[i].visibleUI) { genericMenu.AddItem(new GUIContent(ParticleSystemUI.s_ModuleNames[i]), false, new GenericMenu.MenuFunction2(this.AddModuleCallback), i); } else { genericMenu.AddDisabledItem(new GUIContent(ParticleSystemUI.s_ModuleNames[i])); } } genericMenu.AddSeparator(""); genericMenu.AddItem(new GUIContent("Show All Modules"), ParticleEffectUI.GetAllModulesVisible(), new GenericMenu.MenuFunction2(this.AddModuleCallback), 10000); genericMenu.ShowAsContext(); Event.current.Use(); }
private void ShowAddModuleMenu() { GenericMenu menu = new GenericMenu(); for (int i = 0; i < s_ModuleNames.Length; i++) { if ((this.m_Modules[i] == null) || !this.m_Modules[i].visibleUI) { menu.AddItem(new GUIContent(s_ModuleNames[i]), false, new GenericMenu.MenuFunction2(this.AddModuleCallback), i); } else { menu.AddDisabledItem(new GUIContent(s_ModuleNames[i])); } } menu.AddSeparator(string.Empty); menu.AddItem(new GUIContent("Show All Modules"), ParticleEffectUI.GetAllModulesVisible(), new GenericMenu.MenuFunction2(this.AddModuleCallback), 0x2710); menu.ShowAsContext(); Event.current.Use(); }
private void AddModuleCallback(object obj) { int num = (int)obj; if (num >= 0 && num < this.m_Modules.Length) { if (num == this.m_Modules.Length - 1) { this.InitRendererUI(); } else { this.m_Modules[num].enabled = true; this.m_Modules[num].foldout = true; } } else { this.m_ParticleEffectUI.SetAllModulesVisible(!ParticleEffectUI.GetAllModulesVisible()); } this.ApplyProperties(); }
void ShowModuleMenu(int moduleIndex) { // Now create the menu, add items and show it GenericMenu menu = new GenericMenu(); if (!ParticleEffectUI.GetAllModulesVisible()) { menu.AddItem(EditorGUIUtility.TrTextContent("Remove"), false, ModuleMenuCallback, moduleIndex); } else { menu.AddDisabledItem(EditorGUIUtility.TrTextContent("Remove")); // Do not allow remove module when always show modules is enabled } var copy = EditorGUIUtility.TrTextContent("Copy Module"); var paste = EditorGUIUtility.TrTextContent("Paste Module"); SerializedProperty prop = m_ParticleSystemSerializedObject.FindProperty(m_Modules[moduleIndex].moduleName); if (prop != null) { ClipboardContextMenu.overrideCopyContent = copy; ClipboardContextMenu.overridePasteContent = paste; EditorGUI.DoPropertyContextMenu(prop, null, menu); ClipboardContextMenu.overrideCopyContent = null; ClipboardContextMenu.overridePasteContent = null; Event.current.Use(); } else if (m_RendererSerializedObject.targetObjectsCount == 1) { menu.AddItem(copy, false, () => UnityEditorInternal.ComponentUtility.CopyComponent(m_RendererSerializedObject.targetObject as Component)); menu.AddItem(paste, false, () => UnityEditorInternal.ComponentUtility.PasteComponentValues(m_RendererSerializedObject.targetObject as Component)); Event.current.Use(); menu.ShowAsContext(); } }
private void AddModuleCallback(object obj) { int index = (int)obj; if ((index >= 0) && (index < this.m_Modules.Length)) { if (index == (this.m_Modules.Length - 1)) { this.InitRendererUI(); } else { this.m_Modules[index].enabled = true; this.m_Modules[index].foldout = true; } } else { this.m_ParticleEffectUI.SetAllModulesVisible(!ParticleEffectUI.GetAllModulesVisible()); } this.ApplyProperties(); }
void AddModuleCallback(object obj) { int index = (int)obj; if (index >= 0 && index < m_Modules.Length) { if (index == m_Modules.Length - 1) { InitRendererUI(); } else { m_Modules[index].enabled = true; m_Modules[index].foldout = true; } } else { m_ParticleEffectUI.SetAllModulesVisible(!ParticleEffectUI.GetAllModulesVisible()); } ApplyProperties(); }
void ShowAddModuleMenu() { // Now create the menu, add items and show it GenericMenu menu = new GenericMenu(); for (int i = 0; i < s_ModuleNames.Length; ++i) { if (m_Modules[i] == null || !m_Modules[i].visibleUI) { menu.AddItem(new GUIContent(s_ModuleNames[i]), false, AddModuleCallback, i); } else { menu.AddDisabledItem(new GUIContent(s_ModuleNames[i])); } } menu.AddSeparator(""); menu.AddItem(EditorGUIUtility.TrTextContent("Show All Modules"), ParticleEffectUI.GetAllModulesVisible(), AddModuleCallback, 10000); menu.ShowAsContext(); Event.current.Use(); }
public bool InitializeIfNeeded(IEnumerable <ParticleSystem> systems) { bool flag = false; ParticleSystem[] array = systems.ToArray <ParticleSystem>(); bool flag2 = array.Count <ParticleSystem>() > 1; bool flag3 = false; ParticleSystem particleSystem = null; ParticleSystem[] array2 = array; int i = 0; while (i < array2.Length) { ParticleSystem particleSystem2 = array2[i]; if (flag2) { ParticleSystem[] array3 = new ParticleSystem[] { particleSystem2 }; particleSystem = particleSystem2; goto IL_11F; } ParticleSystem root = ParticleSystemEditorUtils.GetRoot(particleSystem2); if (!(root == null)) { ParticleSystem[] array3 = ParticleEffectUI.GetParticleSystems(root); particleSystem = root; if (this.m_SelectedParticleSystems != null && this.m_SelectedParticleSystems.Count > 0) { if (root == ParticleSystemEditorUtils.GetRoot(this.m_SelectedParticleSystems[0])) { if (this.m_ParticleSystemCurveEditor != null && this.m_Emitters != null && array3.Length == this.m_Emitters.Length && particleSystem2.gameObject.activeInHierarchy == this.m_EmittersActiveInHierarchy) { this.m_SelectedParticleSystems = new List <ParticleSystem>(); this.m_SelectedParticleSystems.Add(particleSystem2); if (this.IsShowOnlySelectedMode()) { this.RefreshShowOnlySelected(); } goto IL_1E6; } } } goto IL_11F; } IL_1E6: i++; continue; IL_11F: if (this.m_ParticleSystemCurveEditor != null) { this.Clear(); } flag3 = true; if (!flag) { this.m_SelectedParticleSystems = new List <ParticleSystem>(); flag = true; } this.m_SelectedParticleSystems.Add(particleSystem2); if (!flag2) { this.m_ParticleSystemCurveEditor = new ParticleSystemCurveEditor(); this.m_ParticleSystemCurveEditor.Init(); ParticleSystem[] array3; int num = array3.Length; if (num > 0) { this.m_Emitters = new ParticleSystemUI[num]; for (int j = 0; j < num; j++) { this.m_Emitters[j] = new ParticleSystemUI(); this.m_Emitters[j].Init(this, new ParticleSystem[] { array3[j] }); } this.m_EmittersActiveInHierarchy = particleSystem2.gameObject.activeInHierarchy; } } goto IL_1E6; } if (flag3) { if (flag2) { this.m_ParticleSystemCurveEditor = new ParticleSystemCurveEditor(); this.m_ParticleSystemCurveEditor.Init(); int count = this.m_SelectedParticleSystems.Count; if (count > 0) { this.m_Emitters = new ParticleSystemUI[1]; this.m_Emitters[0] = new ParticleSystemUI(); this.m_Emitters[0].Init(this, this.m_SelectedParticleSystems.ToArray()); this.m_EmittersActiveInHierarchy = this.m_SelectedParticleSystems[0].gameObject.activeInHierarchy; } } ParticleSystemUI[] emitters = this.m_Emitters; for (int k = 0; k < emitters.Length; k++) { ParticleSystemUI particleSystemUI = emitters[k]; ModuleUI[] modules = particleSystemUI.m_Modules; for (int l = 0; l < modules.Length; l++) { ModuleUI moduleUI = modules[l]; if (moduleUI != null) { moduleUI.Validate(); } } } if (ParticleEffectUI.GetAllModulesVisible()) { this.SetAllModulesVisible(true); } this.m_EmitterAreaWidth = EditorPrefs.GetFloat("ParticleSystemEmitterAreaWidth", ParticleEffectUI.k_MinEmitterAreaSize.x); this.m_CurveEditorAreaHeight = EditorPrefs.GetFloat("ParticleSystemCurveEditorAreaHeight", ParticleEffectUI.k_MinCurveAreaSize.y); this.SetShowOnlySelectedMode(this.m_Owner is ParticleSystemWindow && SessionState.GetBool("ShowSelected" + particleSystem.GetInstanceID(), false)); this.m_EmitterAreaScrollPos.x = SessionState.GetFloat("CurrentEmitterAreaScroll", 0f); if (this.ShouldManagePlaybackState(particleSystem)) { Vector3 vector = SessionState.GetVector3("SimulationState" + particleSystem.GetInstanceID(), Vector3.zero); if (particleSystem.GetInstanceID() == (int)vector.x) { float z = vector.z; if (z > 0f) { ParticleSystemEditorUtils.playbackTime = z; ParticleSystemEditorUtils.PerformCompleteResimulation(); } } if (ParticleEffectUI.m_MainPlaybackSystem != particleSystem) { this.Play(); } } } ParticleEffectUI.m_MainPlaybackSystem = particleSystem; return(flag3); }