Пример #1
0
        internal static void PatchAll()
        {
            // Create a new crafting tree tab for batteries and power cells
            var tabIcon = ImageUtils.LoadSpriteFromFile(@"./Qmods/" + MgBatteryAssets + @"/CraftingTabIcon.png");

            CraftTreeHandler.AddTabNode(CraftTree.Type.Fabricator, BatteryPowerCraftingTab, "Batteries and Power Cells", tabIcon, ResourcesCraftingTab, ElectronicsCraftingTab);

            // Remove the original batteries from the Electronics tab
            CraftTreeHandler.RemoveNode(CraftTree.Type.Fabricator, ResourcesCraftingTab, ElectronicsCraftingTab, TechType.Battery.ToString());
            CraftTreeHandler.RemoveNode(CraftTree.Type.Fabricator, ResourcesCraftingTab, ElectronicsCraftingTab, TechType.PowerCell.ToString());
            CraftTreeHandler.RemoveNode(CraftTree.Type.Fabricator, ResourcesCraftingTab, ElectronicsCraftingTab, TechType.PrecursorIonBattery.ToString());
            CraftTreeHandler.RemoveNode(CraftTree.Type.Fabricator, ResourcesCraftingTab, ElectronicsCraftingTab, TechType.PrecursorIonPowerCell.ToString());

            // And add them back in on the new Batteries and PowerCells tab
            CraftTreeHandler.AddCraftingNode(CraftTree.Type.Fabricator, TechType.Battery, PathToNewTab);
            CraftTreeHandler.AddCraftingNode(CraftTree.Type.Fabricator, TechType.PowerCell, PathToNewTab);

            var config = new DeepConfig();

            config.ReadConfigFile();

            var lithiumBattery = new DeepBattery(config.BatteryCapacity);

            lithiumBattery.Patch();

            var lithiumPowerCell = new DeepPowerCell(lithiumBattery);

            lithiumPowerCell.Patch();

            // Add the Ion Batteries after the Deep Batteries
            CraftTreeHandler.AddCraftingNode(CraftTree.Type.Fabricator, TechType.PrecursorIonBattery, PathToNewTab);
            CraftTreeHandler.AddCraftingNode(CraftTree.Type.Fabricator, TechType.PrecursorIonPowerCell, PathToNewTab);
        }
Пример #2
0
        private static void PatchCraftables()
        {
            var config = new DeepConfig();

            config.ReadConfigFile();

            var lithiumBattery = new DeepBattery(config.BatteryCapacity);

            lithiumBattery.Patch();

            var lithiumPowerCell = new DeepPowerCell(lithiumBattery);

            lithiumPowerCell.Patch();
        }
        internal static void PatchAll()
        {
            string mainDirectory = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);

            // Create a new crafting tree tab for batteries and power cells
            string assetsFolder = Path.Combine(mainDirectory, "Assets");
            string pathToIcon   = Path.Combine(assetsFolder, @"CraftingTabIcon.png");

            Atlas.Sprite tabIcon = ImageUtils.LoadSpriteFromFile(pathToIcon);
            CraftTreeHandler.AddTabNode(CraftTree.Type.Fabricator, BatteryPowerCraftingTab, "Batteries and Power Cells", tabIcon, ResourcesCraftingTab, ElectronicsCraftingTab);

            // Remove the original batteries from the Electronics tab
            CraftTreeHandler.RemoveNode(CraftTree.Type.Fabricator, ResourcesCraftingTab, ElectronicsCraftingTab, TechType.Battery.ToString());
            CraftTreeHandler.RemoveNode(CraftTree.Type.Fabricator, ResourcesCraftingTab, ElectronicsCraftingTab, TechType.PowerCell.ToString());
            CraftTreeHandler.RemoveNode(CraftTree.Type.Fabricator, ResourcesCraftingTab, ElectronicsCraftingTab, TechType.PrecursorIonBattery.ToString());
            CraftTreeHandler.RemoveNode(CraftTree.Type.Fabricator, ResourcesCraftingTab, ElectronicsCraftingTab, TechType.PrecursorIonPowerCell.ToString());

            // And add them back in on the new Batteries and PowerCells tab
            CraftTreeHandler.AddCraftingNode(CraftTree.Type.Fabricator, TechType.Battery, PathToNewTab);
            CraftTreeHandler.AddCraftingNode(CraftTree.Type.Fabricator, TechType.PowerCell, PathToNewTab);

            var config = new DeepConfig();

            config.ReadConfigFile(mainDirectory);

            QuickLogger.Info($"Selected PowerStyle in config: {config.SelectedPowerStyle} - (Battery Capacity:{Mathf.RoundToInt(config.BatteryCapacity)})");

            QuickLogger.Info("Patching DeepBattery");
            var lithiumBattery = new DeepBattery(config.BatteryCapacity);

            lithiumBattery.Patch();

            QuickLogger.Info("Patching DeepPowerCell");
            var lithiumPowerCell = new DeepPowerCell(lithiumBattery);

            lithiumPowerCell.Patch();

            // Add the Ion Batteries after the Deep Batteries
            CraftTreeHandler.AddCraftingNode(CraftTree.Type.Fabricator, TechType.PrecursorIonBattery, PathToNewTab);
            CraftTreeHandler.AddCraftingNode(CraftTree.Type.Fabricator, TechType.PrecursorIonPowerCell, PathToNewTab);
        }