예제 #1
0
        public void CraftingTabList_Serialize_Deserialize()
        {
            var tabList = new CustomCraftingTabList
            {
                new CustomCraftingTab
                {
                    TabID         = "CustomTab1",
                    DisplayName   = "Custom Tab The First",
                    ParentTabPath = "CyclopsFabricator/OriginalTab_1",
                    SpriteItemID  = TechType.Cyclops
                },
                new CustomCraftingTab
                {
                    TabID         = "CustomTab2",
                    DisplayName   = "Custom Tab The Second",
                    ParentTabPath = "SeamothUpgrades/OriginalTab_2",
                    SpriteItemID  = TechType.Seamoth
                },
            };

            string serialized = tabList.PrettyPrint();

            Console.WriteLine(serialized);

            var tabList2 = new CustomCraftingTabList();

            tabList2.FromString(serialized);

            Assert.AreEqual(tabList, tabList2);
            Assert.IsTrue(tabList.Equals(tabList2));
            Assert.IsTrue(tabList == tabList2);
        }
예제 #2
0
        public void Sample_CustomTabs_Ok()
        {
            var cTabs = new CustomCraftingTabList();

            string sample = File.ReadAllText(SampleFileDirectory + "CustomTab_Samples.txt");

            bool result = cTabs.FromString(sample);

            Assert.IsTrue(result);
        }
        public void Generate_All_Files()
        {
            // TABS
            var salvageTab = new CustomCraftingTab
            {
                TabID         = SalvageTabID,
                DisplayName   = "Salvage and Recycling",
                ParentTabPath = PathToSalvageTab,
                SpriteItemID  = TechType.Trashcans
            };

            var tabList = new CustomCraftingTabList
            {
                salvageTab
            };

            WriteFile(tabList, "EquipmentSalvage_Tabs.txt");

            // Move the Metal Salvage into the new tab
            var moveMetalSalvage = new MovedRecipe
            {
                ItemID  = TechType.Titanium.ToString(),
                OldPath = PathHelper.Fabricator.Resources.BasicMaterials.BasicMaterialsTab.GetCraftingPath.ToString(),
                NewPath = tabList[0].FullPath,
                Hidden  = false,
                Copied  = true
            };

            var movedList = new MovedRecipeList
            {
                moveMetalSalvage
            };

            WriteFile(movedList, "EquipmentSalvage_Moves.txt");

            // RECIPES
            var leadSalvage = new AliasRecipe
            {
                ItemID             = "LeadSalvage",
                DisplayName        = "Salvage Lead",
                Tooltip            = "Recover the useful lead from a radiation suit no longer in use",
                Path               = tabList[0].FullPath,
                ForceUnlockAtStart = !EnableUnlocking,
                PdaCategory        = TechCategory.BasicMaterials,
                PdaGroup           = TechGroup.Resources,
                SpriteItemID       = TechType.Lead,
                Ingredients        =
                {
                    new EmIngredient(TechType.RadiationSuit),
                    new EmIngredient(TechType.RadiationHelmet),
                    new EmIngredient(TechType.RadiationGloves)
                },
                LinkedItemIDs =
                {
                    TechType.Lead.ToString(),
                    TechType.Lead.ToString()
                },
                UnlockedBy = { TechType.RadiationSuit.ToString() }
            };

            var copperSalvage = new AliasRecipe
            {
                ItemID             = "CopperSalvage",
                DisplayName        = "Salvage Copper",
                Tooltip            = "Recover the precious copper from unneeded power cells",
                Path               = tabList[0].FullPath,
                ForceUnlockAtStart = !EnableUnlocking,
                PdaCategory        = TechCategory.BasicMaterials,
                PdaGroup           = TechGroup.Resources,
                SpriteItemID       = TechType.Copper,
                Ingredients        =
                {
                    new EmIngredient(TechType.PowerCell)
                },
                LinkedItemIDs =
                {
                    TechType.Copper.ToString(),
                    TechType.Copper.ToString()
                },
                UnlockedBy = { TechType.PowerCell.ToString() }
            };

            var deepSalvage = new AliasRecipe
            {
                ItemID             = "DeepSalvage",
                DisplayName        = "Salvage Precious Metals",
                Tooltip            = "Recover the lithium and magnetite from unneeded deep power cells",
                Path               = tabList[0].FullPath,
                ForceUnlockAtStart = !EnableUnlocking,
                PdaCategory        = TechCategory.AdvancedMaterials,
                PdaGroup           = TechGroup.Resources,
                SpriteItemID       = TechType.Magnetite,
                Ingredients        =
                {
                    new EmIngredient("DeepPowerCell")
                },
                LinkedItemIDs =
                {
                    TechType.Lithium.ToString(),
                    TechType.Magnetite.ToString(),
                    TechType.Lithium.ToString(),
                    TechType.Magnetite.ToString()
                },
                UnlockedBy = { "DeepPowerCell" }
            };

            var ionSalvage = new AliasRecipe
            {
                ItemID             = "IonCubeSalvage",
                DisplayName        = "Salvage Ion Cubes",
                Tooltip            = "Recover the precious ion cubes from unneeded ion power cells",
                Path               = tabList[0].FullPath,
                ForceUnlockAtStart = !EnableUnlocking,
                PdaCategory        = TechCategory.AdvancedMaterials,
                PdaGroup           = TechGroup.Resources,
                SpriteItemID       = TechType.PrecursorIonCrystal,
                Ingredients        =
                {
                    new EmIngredient(TechType.PrecursorIonPowerCell)
                },
                LinkedItemIDs =
                {
                    TechType.PrecursorIonCrystal.ToString(),
                    TechType.PrecursorIonCrystal.ToString()
                },
                UnlockedBy = { TechType.PrecursorIonPowerCell.ToString() }
            };

            var diamondSalvage = new AliasRecipe
            {
                ItemID             = "DiamondSalvage",
                DisplayName        = "Salvage Diamonds",
                Tooltip            = "Recover diamonds from retired laser cutters. Don't forget to remove the batteries first.",
                Path               = tabList[0].FullPath,
                ForceUnlockAtStart = !EnableUnlocking,
                PdaCategory        = TechCategory.AdvancedMaterials,
                PdaGroup           = TechGroup.Resources,
                SpriteItemID       = TechType.Diamond,
                Ingredients        =
                {
                    new EmIngredient(TechType.LaserCutter)
                },
                LinkedItemIDs =
                {
                    TechType.Diamond.ToString(),
                    TechType.Diamond.ToString()
                },
                UnlockedBy = { TechType.Diamond.ToString() }
            };

            var wireSalvage = new AliasRecipe
            {
                ItemID             = "WireSalvage",
                DisplayName        = "Salvage Copper Wire",
                Tooltip            = "Recover copper wire from retired seaglide. Don't forget to remove the batteries first.",
                Path               = tabList[0].FullPath,
                ForceUnlockAtStart = !EnableUnlocking,
                PdaCategory        = TechCategory.Electronics,
                PdaGroup           = TechGroup.Resources,
                SpriteItemID       = TechType.CopperWire,
                Ingredients        =
                {
                    new EmIngredient(TechType.Seaglide)
                },
                LinkedItemIDs =
                {
                    TechType.CopperWire.ToString(),
                },
                UnlockedBy = { TechType.Seaglide.ToString() }
            };

            var aliasList = new AliasRecipeList
            {
                leadSalvage, copperSalvage, deepSalvage, ionSalvage, diamondSalvage, wireSalvage
            };

            WriteFile(aliasList, "EquipmentSalvage_Recipes.txt");
        }