diff --git a/PhotonicFreedom.cs b/PhotonicFreedom.cs index 3824cd4..e388e98 100644 --- a/PhotonicFreedom.cs +++ b/PhotonicFreedom.cs @@ -216,6 +216,50 @@ public static void TestForUIBuilder(UIBuilder builder) object comp = type.InheritsFrom(typeof(PostProcessEffectSettings)) ? layer.GetBundle(type).settings : mainCam.GetComponent(type) ?? Activator.CreateInstance(type); builder.Text("" + type.Name + "", true, null, true, null); + + foreach (var property in holder.Properties) + { + if (property.BasePropertyType == typeof(bool) && property.Name == "enabled") + { + builder.Panel(); + var list = builder.SplitHorizontally(new float[] { 0.42f, 0.58f }); + builder.NestInto(list[1]); + var checkbox = builder.Checkbox(property.PrettifiedName, (bool)property.GetValue(comp!), false); + builder.NestOut(); + builder.NestOut(); + checkbox.State.Changed += (IChangeable c) => OnPhotonicSettingChanged(c, property, comp!); + if (SettingFields.ContainsKey(type)) + { + SettingFields[type].Add(property.Name, checkbox.State); + } + else + { + SettingFields.Add(type, new Dictionary() { { property.Name, checkbox.State } }); + } + } + } + foreach (var field in holder.Fields) + { + if (field.RealType == typeof(bool) && field.Name == "enabled") + { + builder.Panel(); + var list = builder.SplitHorizontally(new float[] { 0.42f, 0.58f }); + builder.NestInto(list[1]); + var checkbox = builder.Checkbox(field.PrettifiedName, (bool)field.GetValue(comp!), false); + builder.NestOut(); + builder.NestOut(); + checkbox.State.Changed += (IChangeable c) => OnPhotonicSettingChanged(c, field, comp!); + if (SettingFields.ContainsKey(type)) + { + SettingFields[type].Add(field.Name, checkbox.State); + } + else + { + SettingFields.Add(type, new Dictionary() { { field.Name, checkbox.State } }); + } + } + } + builder.Text("---------------------------------------------", true, null, true, null); Button IndividualComponentResetButton = builder.Button("Reset"); IndividualComponentResetButton.LocalPressed += (IButton b, ButtonEventData d) => { foreach (KeyValuePair kvp in SettingFields[type]) @@ -244,7 +288,6 @@ public static void TestForUIBuilder(UIBuilder builder) } }; builder.Text("---------------------------------------------", true, null, true, null); - foreach (var field in holder.Fields) { if (field.RealType == typeof(int)) @@ -279,7 +322,7 @@ public static void TestForUIBuilder(UIBuilder builder) SettingFields.Add(type, new Dictionary() { { field.Name, parser.ParsedValue } }); } } - if (field.RealType == typeof(bool) && field.Name != "active") + if (field.RealType == typeof(bool) && field.Name != "active" && field.Name != "enabled") { var checkbox = builder.Checkbox(field.PrettifiedName, (bool)field.GetValue(comp!)); checkbox.State.Changed += (IChangeable c) => OnPhotonicSettingChanged(c, field, comp!); @@ -337,22 +380,6 @@ public static void TestForUIBuilder(UIBuilder builder) builder.Text("" + field.Tooltip + "", false, Alignment.TopLeft, true, null).Slot.GetComponent().Priority.Value = 0; } } - foreach (var property in holder.Properties) - { - if (property.BasePropertyType == typeof(bool) && property.Name == "enabled") - { - var checkbox = builder.Checkbox(property.PrettifiedName, (bool)property.GetValue(comp!)); - checkbox.State.Changed += (IChangeable c) => OnPhotonicSettingChanged(c, property, comp!); - if (SettingFields.ContainsKey(type)) - { - SettingFields[type].Add(property.Name, checkbox.State); - } - else - { - SettingFields.Add(type, new Dictionary() { { property.Name, checkbox.State } }); - } - } - } } }