private void MultiParticleSystemGUI(bool verticalLayout) { ParticleSystem root = ParticleSystemEditorUtils.GetRoot(this.m_SelectedParticleSystem); GUILayout.BeginVertical(ParticleSystemStyles.Get().effectBgStyle, new GUILayoutOption[0]); this.m_EmitterAreaScrollPos = EditorGUILayout.BeginScrollView(this.m_EmitterAreaScrollPos, new GUILayoutOption[0]); Rect position = EditorGUILayout.BeginVertical(new GUILayoutOption[0]); this.m_EmitterAreaScrollPos -= EditorGUI.MouseDeltaReader(position, Event.current.alt); GUILayout.Space(3f); GUILayout.BeginHorizontal(new GUILayoutOption[0]); GUILayout.Space(3f); Color color = GUI.color; bool flag = Event.current.type == EventType.Repaint; bool flag2 = this.IsShowOnlySelectedMode(); List <ParticleSystemUI> selectedParticleSystemUIs = this.GetSelectedParticleSystemUIs(); for (int i = 0; i < this.m_Emitters.Length; i++) { if (i != 0) { GUILayout.Space(ModuleUI.k_SpaceBetweenModules); } bool flag3 = selectedParticleSystemUIs.Contains(this.m_Emitters[i]); ModuleUI particleSystemRendererModuleUI = this.m_Emitters[i].GetParticleSystemRendererModuleUI(); if (flag && particleSystemRendererModuleUI != null && !particleSystemRendererModuleUI.enabled) { GUI.color = ParticleEffectUI.GetDisabledColor(); } if (flag && flag2 && !flag3) { GUI.color = ParticleEffectUI.GetDisabledColor(); } Rect rect = EditorGUILayout.BeginVertical(new GUILayoutOption[0]); if (flag && flag3 && this.m_Emitters.Length > 1) { this.DrawSelectionMarker(rect); } this.m_Emitters[i].OnGUI(root, ModuleUI.k_CompactFixedModuleWidth, true); EditorGUILayout.EndVertical(); GUI.color = color; } GUILayout.Space(5f); if (GUILayout.Button(ParticleEffectUI.s_Texts.addParticleSystem, "OL Plus", new GUILayoutOption[] { GUILayout.Width(20f) })) { this.CreateParticleSystem(root, SubModuleUI.SubEmitterType.None); } GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); GUILayout.Space(4f); this.m_EmitterAreaScrollPos -= EditorGUI.MouseDeltaReader(position, true); GUILayout.FlexibleSpace(); EditorGUILayout.EndVertical(); EditorGUILayout.EndScrollView(); GUILayout.EndVertical(); this.HandleKeyboardShortcuts(root); }
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; } } }
public void Init(ParticleEffectUI owner, ParticleSystem[] systems) { if (s_ModuleNames == null) { s_ModuleNames = GetUIModuleNames(); } if (s_Texts == null) { s_Texts = new Texts(); } m_ParticleEffectUI = owner; m_ParticleSystems = systems; m_ParticleSystemSerializedObject = new SerializedObject(m_ParticleSystems); m_RendererSerializedObject = null; m_SupportsCullingText = null; m_Modules = CreateUIModules(this, m_ParticleSystemSerializedObject); bool anyWithoutRenderers = m_ParticleSystems.FirstOrDefault(o => o.GetComponent <ParticleSystemRenderer>() == null) != null; if (!anyWithoutRenderers) { InitRendererUI(); } UpdateParticleSystemInfoString(); }
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; } } }
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 static void GetDirectParticleSystemChildrenRecursive(Transform transform, List <ParticleSystem> particleSystems) { IEnumerator enumerator = transform.GetEnumerator(); try { while (enumerator.MoveNext()) { Transform transform2 = (Transform)enumerator.Current; ParticleSystem component = transform2.gameObject.GetComponent <ParticleSystem>(); if (component != null) { particleSystems.Add(component); ParticleEffectUI.GetDirectParticleSystemChildrenRecursive(transform2, particleSystems); } } } finally { IDisposable disposable; if ((disposable = (enumerator as IDisposable)) != null) { disposable.Dispose(); } } }
public void ApplyProperties() { bool hasModifiedProperties = m_ParticleSystemSerializedObject.hasModifiedProperties; // Check the system was not destroyed such as by an Undo operation. if (m_ParticleSystemSerializedObject.targetObject != null) { m_ParticleSystemSerializedObject.ApplyModifiedProperties(); } if (hasModifiedProperties) { // Resimulate foreach (ParticleSystem ps in m_ParticleSystems) { ParticleSystem root = ParticleSystemEditorUtils.GetRoot(ps); if (!ParticleEffectUI.IsStopped(root) && ParticleSystemEditorUtils.resimulation) { ParticleSystemEditorUtils.PerformCompleteResimulation(); } } // Refresh procedural supported string UpdateParticleSystemInfoString(); } if (m_RendererSerializedObject != null && m_RendererSerializedObject.targetObject != null) { m_RendererSerializedObject.ApplyModifiedProperties(); } }
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; } } }
public void ApplyProperties() { bool hasModifiedProperties = this.m_ParticleSystemSerializedObject.hasModifiedProperties; if (this.m_ParticleSystemSerializedObject.targetObject != null) { this.m_ParticleSystemSerializedObject.ApplyModifiedProperties(); } if (hasModifiedProperties) { ParticleSystem[] particleSystems = this.m_ParticleSystems; for (int i = 0; i < particleSystems.Length; i++) { ParticleSystem ps = particleSystems[i]; ParticleSystem root = ParticleSystemEditorUtils.GetRoot(ps); if (!ParticleEffectUI.IsStopped(root) && ParticleSystemEditorUtils.editorResimulation) { ParticleSystemEditorUtils.PerformCompleteResimulation(); } } this.UpdateParticleSystemInfoString(); } if (this.m_RendererSerializedObject != null && this.m_RendererSerializedObject.targetObject != null) { this.m_RendererSerializedObject.ApplyModifiedProperties(); } }
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 InitEffectUI() { if (!this.m_IsVisible) { return; } ParticleSystem particleSystem = ParticleSystemEditorUtils.lockedParticleSystem; if ((Object)particleSystem == (Object)null && (Object)Selection.activeGameObject != (Object)null) { particleSystem = Selection.activeGameObject.GetComponent <ParticleSystem>(); } this.m_Target = particleSystem; if ((Object)this.m_Target != (Object)null) { if (this.m_ParticleEffectUI == null) { this.m_ParticleEffectUI = new ParticleEffectUI((ParticleEffectUIOwner)this); } if (this.m_ParticleEffectUI.InitializeIfNeeded(this.m_Target)) { this.Repaint(); } } if (!((Object)this.m_Target == (Object)null) || this.m_ParticleEffectUI == null) { return; } this.Clear(); this.Repaint(); SceneView.RepaintAll(); GameView.RepaintAll(); }
private void InitEffectUI() { if (this.m_IsVisible) { ParticleSystem lockedParticleSystem = ParticleSystemEditorUtils.lockedParticleSystem; if ((lockedParticleSystem == null) && (Selection.activeGameObject != null)) { lockedParticleSystem = Selection.activeGameObject.GetComponent <ParticleSystem>(); } this.m_Target = lockedParticleSystem; if (this.m_Target != null) { if (this.m_ParticleEffectUI == null) { this.m_ParticleEffectUI = new ParticleEffectUI(this); } if (this.m_ParticleEffectUI.InitializeIfNeeded(this.m_Target)) { base.Repaint(); } } if ((this.m_Target == null) && (this.m_ParticleEffectUI != null)) { this.Clear(); base.Repaint(); SceneView.RepaintAll(); GameView.RepaintAll(); } } }
public bool InitializeIfNeeded(ParticleSystem shuriken) { ParticleSystem root = ParticleSystemEditorUtils.GetRoot(shuriken); bool result; if (root == null) { result = false; } else { ParticleSystem[] particleSystems = ParticleEffectUI.GetParticleSystems(root); if (root == this.GetRoot()) { if (this.m_ParticleSystemCurveEditor != null && this.m_Emitters != null && particleSystems.Length == this.m_Emitters.Length) { this.m_SelectedParticleSystem = shuriken; if (this.IsShowOnlySelectedMode()) { this.RefreshShowOnlySelected(); } result = false; return(result); } } if (this.m_ParticleSystemCurveEditor != null) { this.Clear(); } this.m_SelectedParticleSystem = shuriken; ParticleSystemEditorUtils.PerformCompleteResimulation(); this.m_ParticleSystemCurveEditor = new ParticleSystemCurveEditor(); this.m_ParticleSystemCurveEditor.Init(); this.m_EmitterAreaWidth = EditorPrefs.GetFloat("ParticleSystemEmitterAreaWidth", ParticleEffectUI.k_MinEmitterAreaSize.x); this.m_CurveEditorAreaHeight = EditorPrefs.GetFloat("ParticleSystemCurveEditorAreaHeight", ParticleEffectUI.k_MinCurveAreaSize.y); this.InitAllEmitters(particleSystems); this.m_ShowOnlySelectedMode = (this.m_Owner is ParticleSystemWindow && SessionState.GetBool("ShowSelected" + root.GetInstanceID(), false)); if (this.IsShowOnlySelectedMode()) { this.RefreshShowOnlySelected(); } this.m_EmitterAreaScrollPos.x = SessionState.GetFloat("CurrentEmitterAreaScroll", 0f); if (this.ShouldManagePlaybackState(root)) { Vector3 vector = SessionState.GetVector3("SimulationState" + root.GetInstanceID(), Vector3.zero); if (root.GetInstanceID() == (int)vector.x) { float z = vector.z; if (z > 0f) { ParticleSystemEditorUtils.editorPlaybackTime = z; } } this.Play(); } result = true; } return(result); }
void Clear() { if (m_ParticleEffectUI != null) { m_ParticleEffectUI.Clear(); } m_ParticleEffectUI = null; }
private void Clear() { if (this.m_ParticleEffectUI != null) { this.m_ParticleEffectUI.Clear(); } this.m_ParticleEffectUI = null; }
private void Clear() { this.m_Target = (ParticleSystem) null; if (this.m_ParticleEffectUI == null) return; this.m_ParticleEffectUI.Clear(); this.m_ParticleEffectUI = (ParticleEffectUI) null; }
internal bool IsPaused() { if (!this.IsPlaying()) { return(!ParticleEffectUI.IsStopped(this.GetRoot())); } return(false); }
internal static ParticleSystem[] GetParticleSystems(ParticleSystem root) { List <ParticleSystem> list = new List <ParticleSystem>(); list.Add(root); ParticleEffectUI.GetDirectParticleSystemChildrenRecursive(root.transform, list); return(list.ToArray()); }
internal void Clear() { m_Target = null; if (m_ParticleEffectUI != null) { m_ParticleEffectUI.Clear(); m_ParticleEffectUI = null; } }
private void Clear() { this.m_Target = null; if (this.m_ParticleEffectUI != null) { this.m_ParticleEffectUI.Clear(); this.m_ParticleEffectUI = null; } }
void Clear() { if (m_ParticleEffectUI != null) { m_ParticleEffectUI.Clear(); m_ParticleEffectUI.ClearSelectedSystems(); } m_ParticleEffectUI = null; }
private void Clear() { this.m_Target = (ParticleSystem)null; if (this.m_ParticleEffectUI == null) { return; } this.m_ParticleEffectUI.Clear(); this.m_ParticleEffectUI = (ParticleEffectUI)null; }
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 static void GetDirectParticleSystemChildrenRecursive(Transform transform, List <ParticleSystem> particleSystems) { foreach (Transform transform2 in transform) { ParticleSystem component = transform2.gameObject.GetComponent <ParticleSystem>(); if (component != null) { particleSystems.Add(component); ParticleEffectUI.GetDirectParticleSystemChildrenRecursive(transform2, particleSystems); } } }
public void Init(ParticleEffectUI owner, ParticleSystem ps) { if (ParticleSystemUI.s_ModuleNames == null) ParticleSystemUI.s_ModuleNames = ParticleSystemUI.GetUIModuleNames(); this.m_ParticleEffectUI = owner; this.m_ParticleSystem = ps; this.m_ParticleSystemSerializedObject = new SerializedObject((Object) this.m_ParticleSystem); this.m_RendererSerializedObject = (SerializedObject) null; ParticleSystemUI.m_SupportsCullingText = (string) null; this.m_Modules = ParticleSystemUI.CreateUIModules(this, this.m_ParticleSystemSerializedObject); if ((Object) this.GetParticleSystemRenderer() != (Object) null) this.InitRendererUI(); this.UpdateParticleSystemInfoString(); }
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(); }
private void Init(bool forceInit) { ParticleSystem target = base.target as ParticleSystem; if (target != null) { if (this.m_ParticleEffectUI == null) { this.m_ParticleEffectUI = new ParticleEffectUI(this); this.m_ParticleEffectUI.InitializeIfNeeded(target); } else if (forceInit) { this.m_ParticleEffectUI.InitializeIfNeeded(target); } } }
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 Init(bool forceInit) { ParticleSystem target = this.target as ParticleSystem; if ((Object) target == (Object) null) return; if (this.m_ParticleEffectUI == null) { this.m_ParticleEffectUI = new ParticleEffectUI((ParticleEffectUIOwner) this); this.m_ParticleEffectUI.InitializeIfNeeded(target); } else { if (!forceInit) return; this.m_ParticleEffectUI.InitializeIfNeeded(target); } }
private void Init(bool forceInit) { ParticleSystem particleSystem = base.target as ParticleSystem; if (!(particleSystem == null)) { if (this.m_ParticleEffectUI == null) { this.m_ParticleEffectUI = new ParticleEffectUI(this); this.m_ParticleEffectUI.InitializeIfNeeded(particleSystem); } else if (forceInit) { this.m_ParticleEffectUI.InitializeIfNeeded(particleSystem); } } }
private void Init(bool forceInit) { ParticleSystem target = this.target as ParticleSystem; if (target != null) { if (this.m_ParticleEffectUI == null) { this.m_ParticleEffectUI = new ParticleEffectUI(this); this.m_ParticleEffectUI.InitializeIfNeeded(target); } else if (forceInit) { this.m_ParticleEffectUI.InitializeIfNeeded(target); } } }
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 Init(bool forceInit) { ParticleSystem particleSystem = this.target as ParticleSystem; if (particleSystem == null) { return; } if (this.m_ParticleEffectUI == null) { this.m_ParticleEffectUI = new ParticleEffectUI(this); this.m_ParticleEffectUI.InitializeIfNeeded(particleSystem); } else { if (forceInit) { this.m_ParticleEffectUI.InitializeIfNeeded(particleSystem); } } }
public void Init(ParticleEffectUI owner, ParticleSystem ps) { if (s_ModuleNames == null) { s_ModuleNames = GetUIModuleNames(); } this.m_ParticleEffectUI = owner; this.m_ParticleSystem = ps; this.m_ParticleSystemSerializedObject = new SerializedObject(this.m_ParticleSystem); this.m_RendererSerializedObject = null; m_SupportsCullingText = null; this.m_Modules = CreateUIModules(this, this.m_ParticleSystemSerializedObject); if (this.GetParticleSystemRenderer() != null) { this.InitRendererUI(); } this.UpdateParticleSystemInfoString(); }
private void InitEffectUI() { if (!this.m_IsVisible) return; ParticleSystem particleSystem = ParticleSystemEditorUtils.lockedParticleSystem; if ((Object) particleSystem == (Object) null && (Object) Selection.activeGameObject != (Object) null) particleSystem = Selection.activeGameObject.GetComponent<ParticleSystem>(); this.m_Target = particleSystem; if ((Object) this.m_Target != (Object) null) { if (this.m_ParticleEffectUI == null) this.m_ParticleEffectUI = new ParticleEffectUI((ParticleEffectUIOwner) this); if (this.m_ParticleEffectUI.InitializeIfNeeded(this.m_Target)) this.Repaint(); } if (!((Object) this.m_Target == (Object) null) || this.m_ParticleEffectUI == null) return; this.Clear(); this.Repaint(); SceneView.RepaintAll(); GameView.RepaintAll(); }
private void Clear() { if (this.m_ParticleEffectUI != null) this.m_ParticleEffectUI.Clear(); this.m_ParticleEffectUI = (ParticleEffectUI) null; }
private void InitEffectUI() { if (this.m_IsVisible) { ParticleSystem lockedParticleSystem = ParticleSystemEditorUtils.lockedParticleSystem; if ((lockedParticleSystem == null) && (Selection.activeGameObject != null)) { lockedParticleSystem = Selection.activeGameObject.GetComponent<ParticleSystem>(); } this.m_Target = lockedParticleSystem; if (this.m_Target != null) { if (this.m_ParticleEffectUI == null) { this.m_ParticleEffectUI = new ParticleEffectUI(this); } if (this.m_ParticleEffectUI.InitializeIfNeeded(this.m_Target)) { base.Repaint(); } } if ((this.m_Target == null) && (this.m_ParticleEffectUI != null)) { this.Clear(); base.Repaint(); SceneView.RepaintAll(); GameView.RepaintAll(); } } }