예제 #1
0
 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);
     }
 }
예제 #2
0
 /// <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);
     }
 }