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