Exemplo n.º 1
0
        /// <summary>
        /// Populates a new ModCraftTreeRoot from a CraftNode tree.
        /// </summary>
        /// <param name="tree">The tree to create the ModCraftTreeRoot from.</param>
        /// <param name="root"></param>
        internal static void CreateFromExistingTree(CraftNode tree, ref ModCraftTreeLinkingNode root)
        {
            foreach (CraftNode node in tree)
            {
                if (node.action == TreeAction.Expand)
                {
                    ModCraftTreeTab tab   = root.AddTabNode(node.id);
                    var             thing = (ModCraftTreeLinkingNode)tab;
                    CreateFromExistingTree(node, ref thing);
                }

                if (node.action == TreeAction.Craft)
                {
                    var techType = TechType.None;
                    TechTypeExtensions.FromString(node.id, out techType, false);

                    if (node.id == "SeamothHullModule2")
                    {
                        techType = TechType.VehicleHullModule2;
                    }
                    else if (node.id == "SeamothHullModule3")
                    {
                        techType = TechType.VehicleHullModule3;
                    }

                    root.AddCraftingNode(techType);
                }
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Populates a new ModCraftTreeRoot from a CraftNode tree.
        /// </summary>
        /// <param name="tree">The tree to create the ModCraftTreeRoot from.</param>
        /// <param name="root"></param>
        internal static void CreateFromExistingTree(CraftNode tree, ref ModCraftTreeLinkingNode root)
        {
            foreach (CraftNode node in tree)
            {
                if (node.action == TreeAction.Expand)
                {
                    ModCraftTreeTab tab   = root.AddTabNode(node.id);
                    var             thing = (ModCraftTreeLinkingNode)tab;
                    CreateFromExistingTree(node, ref thing);
                }

                if (node.action == TreeAction.Craft)
                {
                    TechTypeExtensions.FromString(node.id, out TechType techType, false);

                    root.AddCraftingNode(techType);
                }
            }
        }