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); }
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); }