public void Load(ConfigNode node)
        {
            /* Load action ConfigNodes in order.
             * I'm unsure if node.GetNodes() will return the nodes in sequence,
             * so we'll have to sort it first.
             */

            name = node.GetValue("pid");
            pid  = new Guid(node.GetValue("pid"));

            List <ConfigNode> nodes = new List <ConfigNode>(node.GetNodes("Action"));

            nodes.Sort(
                (ConfigNode comp1, ConfigNode comp2) =>
            {
                int idx1 = 0;
                int idx2 = 0;
                comp1.TryGetValue("idx", ref idx1);
                comp2.TryGetValue("idx", ref idx2);

                return(idx1.CompareTo(idx2));
            }
                );

            foreach (ConfigNode actNode in nodes)
            {
                int idx = 0;
                actNode.TryGetValue("idx", ref idx);
                string type = actNode.GetValue("type");
                if (type == "SupplyLink")
                {
                    SupplyLink act = SupplyChainController.getLinkByGuid(new Guid(actNode.GetValue("id")));
                }
                else if (type == "ResourceTransfer")
                {
                    ResourceTransferAction act = new ResourceTransferAction();
                    act.Load(actNode);
                }
            }

            List <ConfigNode> setNodes = new List <ConfigNode>(node.GetNodes("ConditionSet"));

            foreach (ConfigNode setNode in setNodes)
            {
                List <SequenceCondition> condSet = new List <SequenceCondition>();

                List <ConfigNode> condNodes = new List <ConfigNode>(node.GetNodes("Condition"));
                foreach (ConfigNode condNode in condNodes)
                {
                    SequenceCondition condition = SequenceCondition.LoadFactory(condNode);
                    if (condition != null)
                    {
                        condSet.Add(condition);
                    }
                }

                conditions.Add(condSet);
            }
        }
 public static void drawStatusLabel(SupplyLink l)
 {
     if (l.active)
     {
         GUILayout.Label(
             l.linkVessel.vessel.name + ":" + l.location.name + " -> " + l.to.name +
             " (Active: T-" + UIStyle.formatTimespan(l.timeComplete - Planetarium.GetUniversalTime(), true) + ")",
             UIStyle.activeLabelStyle
             );
     }
     else
     {
         GUILayout.Label(l.linkVessel.vessel.name + ":" + l.location.name + " -> " + l.to.name);
     }
 }
예제 #3
0
 public SupplyLinkEditor(SupplyLink selected)
 {
     action = selected;
 }
 public SupplyLinkStatus(SupplyLink selected)
 {
     this.action = selected;
     onUpdate();
 }