private void TogglePlanetEditor(CelestialBody body, Boolean active) { if (ActiveEditors.ContainsKey(body.transform.name) && ActiveEditors[body.transform.name].IsOpen) { if (active) { ActiveEditors[body.transform.name].Show(); } else { ActiveEditors[body.transform.name].Hide(); } } else if (ActiveEditors.ContainsKey(body.transform.name)) { if (active) { ActiveEditors[body.transform.name].Open(); } else { ActiveEditors.Remove(body.transform.name); } } else { KopernicusEditor editor = new KopernicusEditor(() => Bodies[body.transform.name], v => Bodies[body.transform.name] = (Body)v, body, body.transform.name); editor.Open(); ActiveEditors.Add(body.transform.name, editor); } }
/// <summary> /// Toggles a subeditor for a ParserTarget /// </summary> private void ToggleSubEditor(ParserTarget target, MemberInfo member, Boolean active) { if (Children.ContainsKey(target.FieldName) && Children[target.FieldName].IsOpen) { if (active) { Children[target.FieldName].Show(); } else { Children[target.FieldName].Hide(); } } else if (Children.ContainsKey(target.FieldName)) { if (active) { Children[target.FieldName].Open(); } else { Children.Remove(target.FieldName); } } else { KopernicusEditor editor = new KopernicusEditor(() => Tools.GetValue(member, Info.Value), v => Tools.SetValue(member, Info.Value, v), Info.Body, Info.Body.transform.name + " - " + target.FieldName); editor.Open(); Children.Add(target.FieldName, editor); } }