void DoSystemGUI()
{
mDetailScroll = EditorGUILayout.BeginScrollView(mDetailScroll);
// GENERAL SECTION
EditorGUILayout.BeginVertical(GUI.skin.GetStyle("Box"));
if (DoSectionHeader("General Settings", mColHeader, true)) {
EditorGUILayout.BeginHorizontal();
string tempname = MBGUI.DoTextField("Name", "", SelectedParticleSystem.name);
if (MBGUI.HasChanged) SelectedParticleSystem.name = tempname;
int oldth = SelectedParticleSystem.ParticleThreshold;
SelectedParticleSystem.ParticleThreshold = MBGUI.DoIntField("Threshold", "Particle Buffer Size", SelectedParticleSystem.ParticleThreshold);
if (oldth != SelectedParticleSystem.ParticleThreshold)
SelectedParticleSystem.Purge();
SelectedParticleSystem.ParticleBlocksize = MBGUI.DoIntField("Blocksize", "Blocksize when adding", SelectedParticleSystem.ParticleBlocksize);
EditorGUILayout.EndHorizontal();
EditorGUILayout.BeginHorizontal();
SelectedParticleSystem.AutoPlay = MBGUI.DoToggle("AutoPlay", "Start playing when GameObject becomes enabled?", SelectedParticleSystem.AutoPlay);
SelectedParticleSystem.SingleShot = MBGUI.DoToggle("SingleShot", "Play only once?", SelectedParticleSystem.SingleShot);
SelectedParticleSystem.Infinite = MBGUI.DoToggle("Infinite", "Ignore Duration?", SelectedParticleSystem.Infinite);
EditorGUILayout.EndHorizontal();
EditorGUILayout.BeginHorizontal();
int oldp = SelectedParticleSystem.TexturePadding;
SelectedParticleSystem.TexturePadding = Mathf.Max(0, MBGUI.DoIntField("Padding", "Texture padding", SelectedParticleSystem.TexturePadding));
if (oldp != SelectedParticleSystem.TexturePadding)
SelectedParticleSystem.GenerateTextureMap(true);
SelectedParticleSystem.PersistentAtlas = MBGUI.DoToggle("Persistent Atlas", "Don't build atlas at start?", SelectedParticleSystem.PersistentAtlas);
EditorGUILayout.EndHorizontal();
}
EditorGUILayout.EndVertical();
// TIMING
EditorGUILayout.BeginVertical(GUI.skin.GetStyle("Box"));
if (DoSectionHeader("Timing", mColHeader, true)) {
EditorGUILayout.BeginHorizontal();
SelectedParticleSystem.TimeWarp = Mathf.Max(0, MBGUI.DoFloatField("Timewarp", "Advance without rendering", SelectedParticleSystem.TimeWarp, true));
SelectedParticleSystem.TimeWarpStepSize = MBGUI.DoFloatField("StepSize", "Timewarp step size", SelectedParticleSystem.TimeWarpStepSize, true);
EditorGUILayout.EndHorizontal();
EditorGUILayout.BeginHorizontal();
GUILayout.Space(155);
GUILayout.HorizontalSlider(SelectedParticleSystem.AgePercent, 0, 1, new GUILayoutOption[] { GUILayout.Width(300), GUILayout.ExpandWidth(false) });
MBGUI.DoLabel(((int)(SelectedParticleSystem.Age * 10) / 10.0f).ToString());
EditorGUILayout.EndHorizontal();
// TIMELINE-Editor
//Draw a tree like button list holding the current system and all emitters
EditorGUILayout.BeginHorizontal();
MBGUI.DoLabelButton(new GUIContent(SelectedParticleSystem.name, ObjectIcon(typeof(MBParticleSystem)), ""), 150, true);
float dummy = 0, dummy2 = 1;
EditorGUILayout.MinMaxSlider(ref dummy, ref dummy2, 0, 1, GUILayout.Width(300));
GUILayout.Space(125);
//SYS-Duration
float dur = SelectedParticleSystem.Duration;
SelectedParticleSystem.Duration = MBGUI.DoFloatFieldSmall(new GUIContent("Duration", "Total Loop-Time"), SelectedParticleSystem.Duration, false);
if (dur != SelectedParticleSystem.Duration)
SelectedParticleSystem.mbCalculateRuntime();
if (MBGUI.DoButton("Auto", "Calculate time from emitters", true)) {
SelectedParticleSystem.Duration = 0;
SelectedParticleSystem.mbCalculateRuntime();
}
EditorGUILayout.EndHorizontal();
for (int e = 0; e < mEmitters.Count; e++) {
MBEmitter em = mEmitters[e];
if (em) {
EditorGUILayout.BeginHorizontal();
MBGUI.DoLabelButton(new GUIContent(em.name, (em.IsTrail) ? mTexEMTrail : ObjectIcon(typeof(MBEmitter))), 150, true);
dur = em.Duration;
float combined = em.Delay + em.Duration;
EditorGUILayout.MinMaxSlider(ref em.Delay, ref combined, 0, SelectedParticleSystem.Duration, GUILayout.Width(300));
em.Duration = combined - em.Delay;
em.Delay = MBGUI.DoFloatFieldSmall(new GUIContent("Delay", "Time until playing begins"), em.Delay, false);
em.Duration = MBGUI.DoFloatFieldSmall(new GUIContent("Duration", "Emitting time"), em.Duration, false);
if (dur != em.Duration)
SelectedParticleSystem.mbCalculateRuntime();
if (MBGUI.DoButton("Max", "Set duration to match ParticleSystem's runtime", true))
em.Duration = SelectedParticleSystem.Duration - em.Delay;
EditorGUILayout.EndHorizontal();
}
}
}
EditorGUILayout.EndVertical();
if (SelectedParticleSystem.Playing)
RepaintEditor(false);
// STATISTICS
EditorGUILayout.BeginVertical(GUI.skin.GetStyle("Box"));
if (DoSectionHeader("Statistics", mColHeader, true)) {
EditorGUILayout.BeginHorizontal();
GUILayout.Space(150);
MBGUI.DoLabel("Active", 50, true);
MBGUI.DoLabel("Idle", 50, true);
MBGUI.DoLabel("Max Rndr", 85, true);
MBGUI.DoLabel("Death: Age", 85, true);
MBGUI.DoLabel("Color", 50, true);
MBGUI.DoLabel("Size", 50, true);
MBGUI.DoLabel("Zone", 50, true);
MBGUI.DoLabel("User", 50, true);
EditorGUILayout.EndHorizontal();
EditorGUILayout.BeginHorizontal();
MBGUI.DoLabelButton(new GUIContent(SelectedParticleSystem.name, ObjectIcon(typeof(MBParticleSystem)), ""), 170, true);
MBGUI.DoLabel(SelectedParticleSystem.ParticleCount.ToString(), 30, false);
MBGUI.DoLabel(SelectedParticleSystem.ParticleCountIdle.ToString(), 70, false);
MBGUI.DoLabel(SelectedParticleSystem.ParticlesRenderedMax.ToString(), 85, false);
GUILayout.Space(265);
if (MBGUI.DoButton("Max->Threshold", "Set Particle treshold to max. Rendered", true)) {
SelectedParticleSystem.ParticleThreshold = SelectedParticleSystem.ParticlesRenderedMax;
SelectedParticleSystem.Purge();
}
EditorGUILayout.EndHorizontal();
for (int l = 0; l < SelectedParticleSystem.Layer.Count; l++) {
MBLayer lyr = SelectedParticleSystem.Layer[l];
if (lyr) {
EditorGUILayout.BeginHorizontal();
GUILayout.Space(20);
MBGUI.DoLabelButton(new GUIContent(lyr.name, ObjectIcon(typeof(MBLayer)), ""), 150, true);
MBGUI.DoLabel(lyr.ParticlesRendered.ToString(), 50, false);
GUILayout.Space(55);
MBGUI.DoLabel(lyr.ParticlesRenderedMax.ToString(), 50, false);
GUILayout.Space(300);
if (MBGUI.DoButton("Max->Threshold", "Set layer treshold to max. Rendered", true)) {
lyr.LayerThreshold = lyr.ParticlesRenderedMax;
lyr.Purge();
}
EditorGUILayout.EndHorizontal();
for (int e = 0; e < lyr.Emitter.Count; e++) {
MBEmitter em = lyr.Emitter[e];
if (em) {
EditorGUILayout.BeginHorizontal();
GUILayout.Space(40);
MBGUI.DoLabelButton(new GUIContent(em.name, (em.IsTrail) ? mTexEMTrail : ObjectIcon(typeof(MBEmitter))), MBGUI._DefaultWidth - 40, true);
MBGUI.DoLabel(em.ParticleCount.ToString(), 30, false);
GUILayout.Space(50);
MBGUI.DoLabel(em.DeathByAge.ToString(), 70, false);
MBGUI.DoLabel(em.DeathByColor.ToString(), 50, false);
MBGUI.DoLabel(em.DeathBySize.ToString(), 50, false);
MBGUI.DoLabel(em.DeathByZone.ToString(), 50, false);
MBGUI.DoLabel(em.DeathByUser.ToString(), 50, false);
EditorGUILayout.EndHorizontal();
}
}
}
}
}
EditorGUILayout.EndVertical();
EditorGUILayout.EndScrollView();
}