public void CopyFrom(MacroNode mn)
        {
            var node = new ConfigNode();

            mn.Save(node);
            Load(node);
        }
 public virtual void OnChildActivate(MacroNode child)
 {
     if (Parent != null)
     {
         Parent.OnChildActivate(child);
     }
 }
 void select_action(MacroNode action)
 {
     if (action != null && action_selected != null)
     {
         action_selected(action);
     }
     SelectAction(null);
 }
 public override bool AddChild(MacroNode child)
 {
     child.Parent = this;
     Subnodes.Add(child);
     child.SetCFG(EditedCFG);
     child.SetSelector(SelectNode);
     child.SetConditionSelector(SelectCondition);
     return(true);
 }
 public override bool AddChild(MacroNode child)
 {
     child.Parent = this;
     Subnodes.Add(child);
     child.SetCFG(EditedCFG);
     child.SetSelector(SelectNode);
     child.SetConditionSelector(SelectCondition);
     return true;
 }
Example #6
0
        public bool Selector(out MacroNode macro)
        {
            macro = null;
            TCAMacro m = null;

            if (Selector(out m))
            {
                macro = m; return(true);
            }
            return(false);
        }
 public virtual void OnChildActivate(MacroNode child)
 {
     if(Parent != null) Parent.OnChildActivate(child);
 }
 public override void OnChildActivate(MacroNode child)
 {
     ActiveChild = child;
     base.OnChildActivate(this);
 }
 public override void OnChildRemove(MacroNode child)
 {
     base.OnChildRemove(child);
     deleted_nodes.Add(child);
 }
 public override void OnChildRemove(MacroNode child)
 {
     base.OnChildRemove(child);
     deleted_nodes.Add(child);
 }
 public virtual bool AddSibling(MacroNode sibling)
 {
     return false;
 }
 public override bool AddSibling(MacroNode sibling)
 {
     return Parent != null && Parent.AddSibling(sibling);
 }
 public override bool AddChild(MacroNode child)
 {
     Block.AddChild(child); return true;
 }
 public override bool AddSibling(MacroNode sibling)
 {
     return(Parent != null && Parent.AddSibling(sibling));
 }
 public override bool AddChild(MacroNode child)
 {
     Block.AddChild(child); return(true);
 }
 public override bool AddSibling(MacroNode sibling)
 {
     return AddChild(sibling);
 }
 public virtual void OnChildRemove(MacroNode child)
 {
     child.Parent = null;
 }
 public virtual bool AddChild(MacroNode child)
 {
     return false;
 }
Example #19
0
 public override void OnChildActivate(MacroNode child)
 {
     ActiveChild = child;
     base.OnChildActivate(this);
 }
 public void CopyFrom(MacroNode mn)
 {
     var node = new ConfigNode();
     mn.Save(node);
     Load(node);
 }
 public virtual void OnChildRemove(MacroNode child)
 {
     child.Parent = null;
 }
 public override bool AddSibling(MacroNode sibling)
 {
     return(AddChild(sibling));
 }
 public virtual bool AddSibling(MacroNode sibling)
 {
     return(false);
 }
Example #24
0
 public override void Rewind()
 {
     base.Rewind();
     ActiveChild = null;
 }
 public override void Rewind()
 {
     base.Rewind();
     ActiveChild = null;
 }
 public virtual bool AddChild(MacroNode child)
 {
     return(false);
 }
 void DrawMainWindow(int windowID)
 {
     if (Macro == null)
     {
         return;
     }
     GUILayout.BeginVertical();
     GUILayout.BeginHorizontal();
     LoadMacro |= GUILayout.Button("Load", Styles.active_button, GUILayout.ExpandWidth(false));
     if (GUILayout.Button("New", Styles.open_button, GUILayout.ExpandWidth(false)))
     {
         EditMacro(null);
     }
     GUILayout.Space(20);
     if (GUILayout.Button(CFG.SelectedMacro != null && CFG.SelectedMacro.Name == Macro.Name? "Apply" : "Use",
                          Styles.active_button, GUILayout.ExpandWidth(false)))
     {
         CFG.SelectedMacro = (TCAMacro)Macro.GetCopy();
     }
     if (GUILayout.Button("Save to Vessel DB", Styles.active_button, GUILayout.ExpandWidth(false)))
     {
         CFG.Macros.SaveMacro(Macro, true);
     }
     if (GUILayout.Button("Save to Global DB", Styles.active_button, GUILayout.ExpandWidth(false)))
     {
         TCAScenario.SaveMacro(Macro);
     }
     GUILayout.FlexibleSpace();
     exit |= GUILayout.Button("Exit", Styles.close_button, GUILayout.ExpandWidth(false));
     GUILayout.EndHorizontal();
     scroll = GUILayout.BeginScrollView(scroll, GUILayout.ExpandHeight(false));
     Macro.Draw();
     GUILayout.EndScrollView();
     if (SelectingAction)
     {
         GUILayout.FlexibleSpace();
         GUILayout.BeginVertical(Styles.white);
         GUILayout.Label("Select Action", Styles.enabled, GUILayout.ExpandWidth(true));
         MacroNode action = null;
         GUILayout.BeginHorizontal();
         GUILayout.BeginVertical();
         GUILayout.Label("Builtin", Styles.active, GUILayout.ExpandWidth(true));
         if (Components.ActionSelector(out action))
         {
             select_action(action);
         }
         GUILayout.EndVertical();
         GUILayout.BeginVertical();
         GUILayout.Label("Current Vessel", Styles.active, GUILayout.ExpandWidth(true));
         if (CFG.Macros.Selector(out action))
         {
             select_action(action);
         }
         GUILayout.EndVertical();
         GUILayout.BeginVertical();
         GUILayout.Label("Global Database", Styles.active, GUILayout.ExpandWidth(true));
         if (TCAScenario.Macros.Selector(out action))
         {
             select_action(action);
         }
         GUILayout.EndVertical();
         GUILayout.EndHorizontal();
         if (GUILayout.Button("Cancel", Styles.close_button, GUILayout.ExpandWidth(true)))
         {
             SelectAction(null);
         }
         GUILayout.EndVertical();
     }
     if (SelectingCondition)
     {
         GUILayout.FlexibleSpace();
         GUILayout.BeginVertical(Styles.white);
         GUILayout.Label("Select Condition", Styles.enabled, GUILayout.ExpandWidth(true));
         Condition cnd = null;
         if (Components.ConditionSelector(out cnd))
         {
             if (cnd != null && condition_selected != null)
             {
                 condition_selected(cnd);
             }
             SelectCondition(null);
         }
         if (GUILayout.Button("Cancel", Styles.close_button, GUILayout.ExpandWidth(true)))
         {
             SelectCondition(null);
         }
         GUILayout.EndVertical();
     }
     if (LoadMacro)
     {
         GUILayout.FlexibleSpace();
         TCAMacro macro;
         if (DrawMacroSelector(CFG, out macro))
         {
             load_macro(macro);
         }
     }
     GUILayout.EndVertical();
     TooltipsAndDragWindow();
 }
 public static bool ActionSelector(out MacroNode action)
 {
     return(ComponentDB <MacroNode> .Selector(out action));
 }
 public bool Selector(out MacroNode macro)
 {
     macro = null;
     TCAMacro m = null;
     if(Selector(out m))
     { macro = m; return true; }
     return false;
 }