diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..8a58bf8 --- /dev/null +++ b/.gitignore @@ -0,0 +1,64 @@ +# Windows image file caches +Thumbs.db +ehthumbs.db + +# Folder config file +Desktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Windows Installer files +*.cab +*.msi +*.msm +*.msp + +# Windows shortcuts +*.lnk + +# ========================= +# Operating System Files +# ========================= + +# OSX +# ========================= + +.DS_Store +.AppleDouble +.LSOverride + +# Thumbnails +._* + +# Files that might appear on external disk +.Spotlight-V100 +.Trashes + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + +/Archives/ +/AO/ +/SandcastleUnity/ +/CKAN/ +/Docs/ +/Documents/ +/GraphicsAndLogos/ +/Icons/ +/Models/ +/Promo Materials/ +/References/ +/Releases/ +/scenes/ +/SoundFX/ +/Textures/ +/DesignDocs/ +/Renders/ +/Fonts/ +/SoundEffects/ +/Notes/ \ No newline at end of file diff --git a/ReleaseFolder/GameData/MMREADME.md b/ReleaseFolder/GameData/MMREADME.md new file mode 100644 index 0000000..5970852 --- /dev/null +++ b/ReleaseFolder/GameData/MMREADME.md @@ -0,0 +1,24 @@ +ModuleManager +============= + + +Original (c) from Ialdabaoth ( https://github.com/Ialdabaoth ) + +Modified by // Modifications by // Maintained by sarbian ( https://github.com/sarbian ) + + +The original licence requirement was: + +--- + +under a CC share-alike license. Anyone is free to do anything they like with ModuleManager's source, with two caveats: + +1. You credit me as the original creator that your code is based on +2. You make it ABSOLUTELY CLEAR that your code is not the original ModuleManager, and that any problems that people have with your fork should be taken up with YOU, not me. + +--- + + +THIS IS NOT THE ORIGINAL MODULEMANAGER CODE. + +Do not bother Ialdabaoth about any problems with it. diff --git a/ReleaseFolder/GameData/ModuleManager.4.1.4.dll b/ReleaseFolder/GameData/ModuleManager.4.1.4.dll new file mode 100644 index 0000000..b47a6da Binary files /dev/null and b/ReleaseFolder/GameData/ModuleManager.4.1.4.dll differ diff --git a/ReleaseFolder/GameData/WildBlueIndustries/Sandcastle/Icons/Box.dds b/ReleaseFolder/GameData/WildBlueIndustries/Sandcastle/Icons/Box.dds new file mode 100644 index 0000000..036b65d Binary files /dev/null and b/ReleaseFolder/GameData/WildBlueIndustries/Sandcastle/Icons/Box.dds differ diff --git a/ReleaseFolder/GameData/WildBlueIndustries/Sandcastle/Icons/Pause.dds b/ReleaseFolder/GameData/WildBlueIndustries/Sandcastle/Icons/Pause.dds new file mode 100644 index 0000000..698bb32 Binary files /dev/null and b/ReleaseFolder/GameData/WildBlueIndustries/Sandcastle/Icons/Pause.dds differ diff --git a/ReleaseFolder/GameData/WildBlueIndustries/Sandcastle/Icons/Play.dds b/ReleaseFolder/GameData/WildBlueIndustries/Sandcastle/Icons/Play.dds new file mode 100644 index 0000000..2465fe1 Binary files /dev/null and b/ReleaseFolder/GameData/WildBlueIndustries/Sandcastle/Icons/Play.dds differ diff --git a/ReleaseFolder/GameData/WildBlueIndustries/Sandcastle/Icons/Trash.dds b/ReleaseFolder/GameData/WildBlueIndustries/Sandcastle/Icons/Trash.dds new file mode 100644 index 0000000..0c3e99f Binary files /dev/null and b/ReleaseFolder/GameData/WildBlueIndustries/Sandcastle/Icons/Trash.dds differ diff --git a/ReleaseFolder/GameData/WildBlueIndustries/Sandcastle/Localization/en-us.cfg b/ReleaseFolder/GameData/WildBlueIndustries/Sandcastle/Localization/en-us.cfg new file mode 100644 index 0000000..1217cbe --- /dev/null +++ b/ReleaseFolder/GameData/WildBlueIndustries/Sandcastle/Localization/en-us.cfg @@ -0,0 +1,24 @@ +Localization +{ + en-us + { + // Print Shop + #LOC_SANDCASTLE_printShopTitle = Print Shop + #LOC_SANDCASTLE_printState = Print State + #LOC_SANDCASTLE_printShopGroupName = Print Shop + #LOC_SANDCASTLE_pausePrinting = Pause Printing + #LOC_SANDCASTLE_resumePrinting = Resume Printing + #LOC_SANDCASTLE_openGUI = View Print Shop + #LOC_SANDCASTLE_needsSpace = Needs <<1>>l of storage space. + #LOC_SANDCASTLE_needsResource = Needs more <<1>>. + #LOC_SANDCASTLE_progress = <<1>>% completed. + #LOC_SANDCASTLE_needsPart = Needs <<1>>. + #LOC_SANDCASTLE_storedPart = Stored <<1>> in <<2>> + #LOC_SANDCASTLE_currentJob = Current Job: <<1>> + #LOC_SANDCASTLE_jobStatus = Status: <<1>> + #LOC_SANDCASTLE_printQueue = Print Queue + #LOC_SANDCASTLE_partMassVolume = Mass: <<1>>t\r\nVolume: <<2>>l + #LOC_SANDCASTLE_requiredResources = Required Resources + #LOC_SANDCASTLE_requiredParts = Required Parts + } +} diff --git a/ReleaseFolder/GameData/WildBlueIndustries/Sandcastle/MaterialsList.cfg b/ReleaseFolder/GameData/WildBlueIndustries/Sandcastle/MaterialsList.cfg new file mode 100644 index 0000000..d4cf12c --- /dev/null +++ b/ReleaseFolder/GameData/WildBlueIndustries/Sandcastle/MaterialsList.cfg @@ -0,0 +1,57 @@ +// A materials list specifies what resources it takes to produce a new part. +// This doesn't take into account the resources needed to run the print shop itself. +MATERIALS_LIST +{ + // Name of the materials list. This should correspond to the part categories: + // Aero, Cargo, Communication, Control, Coupling, Electrical, Engine, FuelTank, Ground, Payload, Pods, Robotics, Science, Structural, Thermal, Utility + // The default category is named Default. The default category is used if there is no MATERIALS_LIST provided for the part's category. + name = Default + + // You can specify one or more RESOURCE nodes for the materials list. + // By default, Sandcastle uses Ore as its resource requirement, but you can specify one or more different resources if desired. + RESOURCE + { + // Name of the required resource. + name = Ore + + // The multiplier to use when calculating how much of the resource is required to print the part. + // The exact amount of resource needed depends upon the part mass, the resource density, and the multiplier. + // The equation is: amountRequired = (partMass / resourceDensity) * rate + // The multiplier cannot be less than 1. A value greater than 1 represents the resource that's wasted during construction. + // Since Ore is a generic resource, it has a bunch of useless bits in it, so it generates more waste. + rate = 1.5 + } +} + +// In addition to the standard materials, any parts in the specified tech node may require additional resources. +// Out of the box, Sandcastle only uses stock resources, so this node would only be used when the mod has been patched to use custom resources. +//TECH_NODE_MATERIALS +//{ +// // Name of the tech node +// name = unifiedFieldTheory + +// // One or more resources +// RESOURCE +// { +// name = RubberChickens +// rate = 5 +// } +//} + +// Specific parts can require specialized resources and/or other parts to print as well. +// Out of the box, Sandcastle only uses stock resources, so this node would only be used when the mod has been patched to use custom resources or when it needs +// specific components. +@PART[*]:HAS[@MODULE[ModuleCommand],#CrewCapacity[0]] +{ + // Specify one or more specialized resources to print the part. +// PRINT_RESOURCE +// { +// name = ComputerChips +// rate = 1.01 +// } + + // The name of a part that's required to finish assembly. + // The required component must be located somwhere in the vessel's inventory. + // You can specify one or more requiredComponent entries. + requiredComponent = batteryPack +} \ No newline at end of file diff --git a/ReleaseFolder/GameData/WildBlueIndustries/Sandcastle/ModuleManagerPatches/StockParts.cfg b/ReleaseFolder/GameData/WildBlueIndustries/Sandcastle/ModuleManagerPatches/StockParts.cfg new file mode 100644 index 0000000..2cd71de --- /dev/null +++ b/ReleaseFolder/GameData/WildBlueIndustries/Sandcastle/ModuleManagerPatches/StockParts.cfg @@ -0,0 +1,36 @@ +@PART[Large_Crewed_Lab] +{ + MODULE + { + name = WBIPrintShop + + // The maximum volume that the printer can print, in liters. Set to less than 0 for no restrictions. + maxPrintVolume = 200 + + // The number of resource units per second that the printer can print. + printSpeedUSec = 1 + + // Flag to indicate whether or not to allow specialists to improve the print speed. + //Exactly how the specialist does that is a trade secret. + UseSpecialistBonus = true + + // Per experience rating, how much to improve the print speed by. + // The print shop part must have crew capacity. + SpecialistBonus = 0.05 + + // The skill required to improve the print speed. + ExperienceEffect = "ConverterSkill" + + // Name of the effect to play from the part's EFFECTS node when the printer is running. +// runningEffect = + + // The printer itself may require one or more resources in order to operate. + // You can also use INPUT_RESOURCE in place of RESOURCE, but the other fields remain the same. + // It's possible to have some kind of OUTPUT_RESOURCE as well, but we just use the stock resources. + RESOURCE + { + name = ElectricCharge + rate = 5 + } + } +} \ No newline at end of file diff --git a/ReleaseFolder/GameData/WildBlueIndustries/Sandcastle/Parts/@thumbs/wbiPlayaHab_icon.png b/ReleaseFolder/GameData/WildBlueIndustries/Sandcastle/Parts/@thumbs/wbiPlayaHab_icon.png new file mode 100644 index 0000000..70fcdf4 Binary files /dev/null and b/ReleaseFolder/GameData/WildBlueIndustries/Sandcastle/Parts/@thumbs/wbiPlayaHab_icon.png differ diff --git a/ReleaseFolder/GameData/WildBlueIndustries/Sandcastle/Parts/Utility/Playa/playa.mu b/ReleaseFolder/GameData/WildBlueIndustries/Sandcastle/Parts/Utility/Playa/playa.mu new file mode 100644 index 0000000..60ef31f Binary files /dev/null and b/ReleaseFolder/GameData/WildBlueIndustries/Sandcastle/Parts/Utility/Playa/playa.mu differ diff --git a/ReleaseFolder/GameData/WildBlueIndustries/Sandcastle/Parts/Utility/Playa/wbiPlayaHab.cfg b/ReleaseFolder/GameData/WildBlueIndustries/Sandcastle/Parts/Utility/Playa/wbiPlayaHab.cfg new file mode 100644 index 0000000..9173942 --- /dev/null +++ b/ReleaseFolder/GameData/WildBlueIndustries/Sandcastle/Parts/Utility/Playa/wbiPlayaHab.cfg @@ -0,0 +1,90 @@ +PART +{ + name = wbiPlayaHab + module = Part + author = Angel-125 + + MODEL + { + model = WildBlueIndustries/Sandcastle/Parts/Utility/Playa/playa + } + rescaleFactor = 1 + node_stack_top = 0, 1.375, 0, 0, 1, 0, 3 + node_stack_bottom = 0, -1.375, 0, 0, -1, 0, 3 + node_attach = 3.225, 0.0, 0.0, 1.0, 0.0, 0.0 + node_stack_front = 0, -0.2115,-3.225, 0, 0, -1, 1 + node_stack_back = 0, -0.2115, 3.225, 0, 0, 1, 1 + node_stack_left = -3.225, -0.2115, 0, -1, 0, 0, 1 + node_stack_right = 3.225, -0.2115, 0, 1, 0, 0, 1 + node_stack_frontRight = 2.28053, -0.2115, -2.28053, 1, 0, -1, 1 + node_stack_frontLeft = -2.28053, -0.2115, -2.28053, -1, 0, -1, 1 + node_stack_backRight = 2.28053, -0.2115, 2.28053, 1, 0, 1, 1 + node_stack_backLeft = -2.28053, -0.2115, 2.28053, -1, 0, 1, 1 + + TechRequired = advExploration + entryCost = 16000 + cost = 6000 + category = Utility + subcategory = 0 + title = Playa Habitat Module + manufacturer = Altair Aquatics + description = This advanced habitat module provides amazing views of the outside. + + // attachment rules: stack, srfAttach, allowStack, allowSrfAttach, allowCollision + attachRules = 1,1,1,1,0 + + // --- standard part parameters --- + mass = 0.01 //3.5 + dragModelType = default + maximum_drag = 0.2 + minimum_drag = 0.2 + angularDrag = 2 + crashTolerance = 20 + bulkheadProfiles = size1, srf + maxTemp = 1400 + breakingForce = 2000 + breakingTorque = 2000 + bulkheadProfiles = size5 + CrewCapacity = 0 + vesselType = Base + + INTERNAL + { + name = WBI_D2HabSpace + } + + MODULE + { + name = ModuleGroundPart + placementMaxRivotVelocity = 0.001 + packedVolume = 400 + } + + RESOURCE + { + name = ElectricCharge + amount = 0 + maxAmount = 1000 + } + + RESOURCE + { + name = Snacks + amount = 0 + maxAmount = 36 + } + + RESOURCE + { + name = FreshAir + amount = 0 + maxAmount = 12 + } + + RESOURCE + { + name = HydrazineVodka + amount = 0 + maxAmount = 17 + } +} \ No newline at end of file diff --git a/ReleaseFolder/GameData/WildBlueIndustries/Sandcastle/Plugin/Sandcastle.dll b/ReleaseFolder/GameData/WildBlueIndustries/Sandcastle/Plugin/Sandcastle.dll new file mode 100644 index 0000000..d076160 Binary files /dev/null and b/ReleaseFolder/GameData/WildBlueIndustries/Sandcastle/Plugin/Sandcastle.dll differ diff --git a/ReleaseFolder/GameData/WildBlueIndustries/Sandcastle/Plugin/Sandcastle.pdb b/ReleaseFolder/GameData/WildBlueIndustries/Sandcastle/Plugin/Sandcastle.pdb new file mode 100644 index 0000000..ab03904 Binary files /dev/null and b/ReleaseFolder/GameData/WildBlueIndustries/Sandcastle/Plugin/Sandcastle.pdb differ diff --git a/ReleaseFolder/GameData/WildBlueIndustries/Sandcastle/Readme.txt b/ReleaseFolder/GameData/WildBlueIndustries/Sandcastle/Readme.txt new file mode 100644 index 0000000..9876efe --- /dev/null +++ b/ReleaseFolder/GameData/WildBlueIndustries/Sandcastle/Readme.txt @@ -0,0 +1,38 @@ +Sandcastle: 3D Printed Bases + +---INSTALLATION--- + +Simply copy all the files into your GameData folder. When done, it should look like: + +GameData + WildBlueIndustries + Sandcastle + +Changes + +Implemented WBIPrintShop. It allows you to 3D print cargo parts from Ore. If desired you can specify different resource requirements, and optionally require other parts in order to complete assembly. Simply check out the MaterialsList.cfg for details. Yes, I plan to add a recycler. + +Added the WBIPrintShop to the Mobile Processing Lab. + +---LICENSE--- +Art Assets, including .mu, .png, and .dds files are copyright 2021 by Michael Billard, All Rights Reserved. + +Wild Blue Industries is trademarked by Michael Billard. All rights reserved. +Note that Wild Blue Industries is a ficticious entity +created for entertainment purposes. It is in no way meant to represent a real entity. +Any similarity to a real entity is purely coincidental. + +Source code copyright 2021 by Michael Billard (Angel-125) + + This source code is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . \ No newline at end of file diff --git a/ReleaseFolder/GameData/WildBlueIndustries/Sandcastle/Sandcastle.version b/ReleaseFolder/GameData/WildBlueIndustries/Sandcastle/Sandcastle.version new file mode 100644 index 0000000..515a1aa --- /dev/null +++ b/ReleaseFolder/GameData/WildBlueIndustries/Sandcastle/Sandcastle.version @@ -0,0 +1,24 @@ +{ + "NAME":"Sandcastle", + "URL":"https://raw.githubusercontent.com/Angel-125/Sandcastle/master/ReleaseFolder/GameData/WildBlueIndustries/Sandcastle/Sandcastle.version", + "DOWNLOAD":"https://github.com/Angel-125/Sandcastle/releases", + "GITHUB": + { + "USERNAME":"Angel-125", + "REPOSITORY":"Sandcastle", + "ALLOW_PRE_RELEASE":true + }, + "VERSION": + { + "MAJOR":0, + "MINOR":1, + "PATCH":0, + "BUILD":0 + }, + "KSP_VERSION_MIN": + { + "MAJOR":1, + "MINOR":11, + "PATCH":0 + } +} diff --git a/source/Sandcastle/Inventory/InventoryUtils.cs b/source/Sandcastle/Inventory/InventoryUtils.cs new file mode 100644 index 0000000..d639266 --- /dev/null +++ b/source/Sandcastle/Inventory/InventoryUtils.cs @@ -0,0 +1,328 @@ +using System; +using System.Collections.Generic; +using System.IO; +using UnityEngine; + +namespace Sandcastle.Inventory +{ + /// + /// An inventory helper class + /// + public class InventoryUtils + { + #region Constants + const int kTextureSize = 64; + #endregion + + #region Fields + #endregion + + #region Housekeeping + static List thumbnailFilePaths = null; + static Dictionary thumbnails = null; + #endregion + + #region API + /// + /// Gets an inventory with enough storage space and storage mass for the desired part. + /// + /// The vessel to query. + /// The AvailablePart to check for space. + /// A ModuleInventoryPart if space can be found or null if not. + public static ModuleInventoryPart GetInventoryWithCargoSpace(Vessel vessel, AvailablePart availablePart) + { + ModuleCargoPart cargoPart = availablePart.partPrefab.FindModuleImplementing(); + if (cargoPart == null) + return null; + + List inventories = vessel.FindPartModulesImplementing(); + ModuleInventoryPart inventory; + int count = inventories.Count; + bool massRequirementMet = false; + bool volRequirementMet = false; + double partMass = availablePart.partPrefab.mass + availablePart.partPrefab.resourceMass; + + for (int index = 0; index < count; index++) + { + inventory = inventories[index]; + + if (inventory.InventoryIsFull || inventory.massCapacityReached || inventory.volumeCapacityReached) + continue; + + // Check mass + if (inventory.HasMassLimit) + { + float massAvailable = inventory.massLimit - inventory.massCapacity; + if (massAvailable < partMass) + continue; + else + massRequirementMet = true; + } + else + { + massRequirementMet = true; + } + + // Check volume + if (inventory.HasPackedVolumeLimit) + { + float volumeAvailable = inventory.packedVolumeLimit - inventory.volumeCapacity; + + if (volumeAvailable < cargoPart.packedVolume) + continue; + else + volRequirementMet = true; + } + else + { + volRequirementMet = true; + } + + // If we've met both requirements then we found an inventory that has enough space. + if (massRequirementMet && volRequirementMet) + return inventory; + + // Reset for next inventory + volRequirementMet = false; + massRequirementMet = false; + } + + // No space available. + return null; + } + + /// + /// Determines whether or not the supplied inventory has space for the desired part. + /// + /// A ModuleInventoryPart to check for space. + /// An AvailablePart to check to see if it fits. + /// true if the inventory has space for the part, false if not. + public static bool InventoryHasSpace(ModuleInventoryPart inventory, AvailablePart availablePart) + { + if (inventory == null) + return false; + + ModuleCargoPart cargoPart = availablePart.partPrefab.FindModuleImplementing(); + if (cargoPart == null) + return false; + + bool massRequirementMet = false; + bool volRequirementMet = false; + double partMass = availablePart.partPrefab.mass + availablePart.partPrefab.resourceMass; + + if (inventory.InventoryIsFull || inventory.massCapacityReached || inventory.volumeCapacityReached) + return false; + + // Check mass + if (inventory.HasMassLimit) + { + float massAvailable = inventory.massLimit - inventory.massCapacity; + if (massAvailable < partMass) + return false; + else + massRequirementMet = true; + } + else + { + massRequirementMet = true; + } + + // Check volume + if (inventory.HasPackedVolumeLimit) + { + float volumeAvailable = inventory.packedVolumeLimit - inventory.volumeCapacity; + + if (volumeAvailable < cargoPart.packedVolume) + return false; + else + volRequirementMet = true; + } + else + { + volRequirementMet = true; + } + + return massRequirementMet && volRequirementMet; + } + + /// + /// Determines whether or not the vessel has enough storage space. + /// + /// The vessel to query + /// The AvailablePart to check for space. + /// true if there is enough space, false if not. + public static bool HasEnoughSpace(Vessel vessel, AvailablePart availablePart) + { + return GetInventoryWithCargoSpace(vessel, availablePart) != null; + } + + /// + /// Determines whether or not the vessel has the item in question. + /// + /// The vessel to query. + /// The name of the part to look for + /// true if the vessel has the part, false if not. + public static bool HasItem(Vessel vessel, string partName) + { + List inventories = vessel.FindPartModulesImplementing(); + int count = inventories.Count; + + for (int index = 0; index < count; index++) + { + if (inventories[index].ContainsPart(partName)) + return true; + } + + return false; + } + + /// + /// Removes the item from the vessel if it exists. + /// + /// The vessel to query. + /// The name of the part to remove. + public static void RemoveItem(Vessel vessel, string partName) + { + List inventories = vessel.FindPartModulesImplementing(); + ModuleInventoryPart inventory = null; + int count = inventories.Count; + + // Find an inventory with the desired part + for (int index = 0; index < count; index++) + { + inventory = inventories[index]; + if (inventory.ContainsPart(partName)) + break; + else + inventory = null; + } + if (inventory == null) + return; + + inventory.RemoveNPartsFromInventory(partName, 1); + } + + /// + /// Adds the item to the vessel inventory if there is enough room. + /// + /// The vessel to query. + /// The part to add to the inventory + /// The preferred inventory to store the part in. + /// The Part that the item was stored in, or null if no place could be found for the part. + public static Part AddItem(Vessel vessel, AvailablePart availablePart, ModuleInventoryPart preferredInventory = null) + { + ModuleInventoryPart inventory = null; + if (InventoryHasSpace(preferredInventory, availablePart)) + inventory = preferredInventory; + else + inventory = GetInventoryWithCargoSpace(vessel, availablePart); + if (inventory == null) + return null; + + for (int index = 0; index < inventory.InventorySlots; index++) + { + if (inventory.IsSlotEmpty(index)) + { + inventory.StoreCargoPartAtSlot(availablePart.partPrefab, index); + return inventory.part; + } + } + + // No place to store the part. + return null; + } + + /// + /// Searches the game folder for thumbnail images. + /// + public static void FindThumbnailPaths() + { + string gameDataPath = Path.GetFullPath(Path.Combine(KSPUtil.ApplicationRootPath, "GameData")); + string[] files = Directory.GetFiles(gameDataPath, "*_icon*.png", SearchOption.AllDirectories); + + thumbnailFilePaths = new List(); + + for (int index = 0; index < files.Length; index++) + { + if (files[index].Contains("@thumbs")) + { + thumbnailFilePaths.Add(files[index]); + } + } + } + + /// + /// Retrieves the thumbnail texture that depicts the specified part name. + /// + /// A string containing the name of the part. + /// A Texture2D if the texture exists, or a blank texture if not. + public static Texture2D GetTexture(string partName) + { + if (thumbnails == null) + thumbnails = new Dictionary(); + + if (!thumbnails.ContainsKey(partName)) + thumbnails.Add(partName, loadTexture(partName)); + + return thumbnails[partName]; + } + + /// + /// Retrieves a list of parts that can be printed by the specified max print volume. + /// + /// A float containing the max possible print volume. + /// A List of AvailablePart objects that can be printed. + public static List GetPrintableParts(float maxPrintVolume) + { + List filteredParts = new List(); + + List cargoParts = PartLoader.Instance.GetAvailableCargoParts(); + if (cargoParts != null && cargoParts.Count > 0) + { + int count = cargoParts.Count; + ModuleCargoPart cargoPart; + float maxPrintableVolume = maxPrintVolume > 0 ? maxPrintVolume : float.MaxValue; + for (int index = 0; index < count; index++) + { + cargoPart = cargoParts[index].partPrefab.FindModuleImplementing(); + if (cargoPart.packedVolume > 0 && cargoPart.packedVolume <= maxPrintableVolume && cargoParts[index].TechHidden == false) + filteredParts.Add(cargoParts[index]); + } + } + + return filteredParts; + } + #endregion + + #region Helpers + /// + /// Retrieves the thumbnail texture that depicts the specified part name. + /// + /// A string containing the name of the part. + /// A Texture2D if the texture exists, or a blank texture if not. + public static Texture2D loadTexture(string partName) + { + Texture2D texture = new Texture2D(kTextureSize, kTextureSize, TextureFormat.RGBA32, false); + Texture2D defaultTexture = GameDatabase.Instance.GetTexture("WildBlueIndustries/Sandcastle/Icons/Box", false); + + // Find the file path + string filePath; + int count = thumbnailFilePaths.Count; + for (int index = 0; index < count; index++) + { + filePath = thumbnailFilePaths[index]; + if (filePath.Contains(partName)) + { + if (File.Exists(filePath)) + { + texture.LoadImage(File.ReadAllBytes(filePath)); + return texture; + } + } + } + + return defaultTexture; + } + #endregion + } +} diff --git a/source/Sandcastle/MarkdownSeparator.exe b/source/Sandcastle/MarkdownSeparator.exe new file mode 100644 index 0000000..5cfe397 Binary files /dev/null and b/source/Sandcastle/MarkdownSeparator.exe differ diff --git a/source/Sandcastle/PrintShop/GUI/PrintShopUI.cs b/source/Sandcastle/PrintShop/GUI/PrintShopUI.cs new file mode 100644 index 0000000..061210c --- /dev/null +++ b/source/Sandcastle/PrintShop/GUI/PrintShopUI.cs @@ -0,0 +1,500 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using UnityEngine; +using Sandcastle.Inventory; +using System.Text; +using KSP.Localization; + +namespace Sandcastle.PrintShop +{ + /// + /// Callback to let the controller know about the print state. + /// + public delegate void UpdatePrintStatusDelegate(bool isPrinting); + + /// + /// Represents the Print Shop UI + /// + public class PrintShopUI: Dialog + { + #region Fields + /// + /// Title of the selection dialog. + /// + public string titleText = Localizer.Format("#LOC_SANDCASTLE_printShopTitle"); + + /// + /// Complete list of printable parts. + /// + public List partsList; + + /// + /// Represents the list of build items to print. + /// + public List printQueue; + + /// + /// Status of the current print job. + /// + public string jobStatus = string.Empty; + + /// + /// Callback to let the controller know about the print state. + /// + public UpdatePrintStatusDelegate onPrintStatusUpdate; + + /// + /// Flag indicating that the printer is printing + /// + public bool isPrinting; + + /// + /// The Part associated with the UI. + /// + public Part part; + #endregion + + #region Housekeeping + List filteredParts; + Dictionary itemCache; + AvailablePart previewPart; + Texture2D previewPartImage; + string previewPartRequirements = string.Empty; + string previewPartDescription = string.Empty; + string previewPartMassVolume = string.Empty; + Dictionary iconSet; + Vector2 categoryScrollPos; + Vector2 partsScrollPos; + Vector2 partInfoScrollPos; + Vector2 partQueueScrollPos; + Vector2 partDescriptionScrollPos; + GUILayoutOption[] categoryPanelWidth = new GUILayoutOption[] { GUILayout.Width(75) }; + GUILayoutOption[] categoryButtonDimensions = new GUILayoutOption[] { GUILayout.Width(32), GUILayout.Height(32) }; + GUILayoutOption[] buttonDimensions = new GUILayoutOption[] { GUILayout.Width(32), GUILayout.Height(32) }; + GUILayoutOption[] selectorPanelWidth = new GUILayoutOption[] { GUILayout.Width(235) }; + GUILayoutOption[] selectorButtonDimensions = new GUILayoutOption[] { GUILayout.MinWidth(64), GUILayout.MinHeight(64), GUILayout.MaxWidth(64), GUILayout.MaxHeight(64) }; + GUILayoutOption[] previewImageDimensions = new GUILayoutOption[] { GUILayout.Width(100), GUILayout.Height(100) }; + GUILayoutOption[] previewImagePaneDimensions = new GUILayoutOption[] { GUILayout.Height(200), GUILayout.Width(115) }; + GUILayoutOption[] partRequirementsHeight = new GUILayoutOption[] { GUILayout.Height(200) }; + GUILayoutOption[] previewDescriptionHeight = new GUILayoutOption[] { GUILayout.Height(100) }; + GUILayoutOption[] printQueueHeight = new GUILayoutOption[] { GUILayout.Height(165) }; + GUILayoutOption[] partInfoWidth = new GUILayoutOption[] { GUILayout.Width(325) }; + PartCategories currentCategory = PartCategories.Pods; + PartCategories selectedCategory = PartCategories.Pods; + Texture2D[] partImages; + int selectedIndex; + int currentIndex; + Color selectedColor = Color.yellow; + Color backgroundColor; + string categoryName = PartCategories.Pods.ToString(); + bool categoryMousedOver; + double categoryUpdateTime; + #endregion + + #region Constructors + public PrintShopUI() : + base("Print Shop", 635, 620) + { + WindowTitle = titleText; + Resizable = false; + + // Load category icons + loadIcons(); + itemCache = new Dictionary(); + } + #endregion + + #region Overrides + /// + /// Toggles window visibility + /// + /// A flag indicating whether the window shoudld be visible or not. + public override void SetVisible(bool newValue) + { + base.SetVisible(newValue); + updateCategoryParts(); + + if (newValue) + { + previewPartImage = iconSet["Blank"]; + } + } + #endregion + + #region Window Drawing + /// + /// Draws the window + /// + /// An int representing the window ID. + protected override void DrawWindowContents(int windowId) + { + backgroundColor = GUI.backgroundColor; + + GUILayout.BeginVertical(); + + GUILayout.Label("" + categoryName + ""); + + GUILayout.BeginHorizontal(); + + // Draw category selector + drawCategorySelector(); + + GUILayout.BeginVertical(); + GUILayout.BeginHorizontal(); + // Draw parts list + drawPartsList(); + GUILayout.EndHorizontal(); + + // Print status + drawPrintStatus(); + + GUILayout.EndVertical(); + + GUILayout.EndHorizontal(); + + GUILayout.EndVertical(); + } + + private void drawPartsList() + { + // Part buttons + drawPartButtons(); + + // Part info and construction + GUILayout.BeginScrollView(Vector2.zero, partInfoWidth); + + // Part preview info + drawPreviewPartInfo(); + + // Print queue + drawPrintQueue(); + + GUILayout.EndScrollView(); + } + + private void drawPrintStatus() + { + GUILayout.BeginHorizontal(); + // Pause/print button + Texture2D buttonTexture = isPrinting ? iconSet["Pause"] : iconSet["Play"]; + if (GUILayout.Button(buttonTexture, buttonDimensions)) + { + isPrinting = !isPrinting; + onPrintStatusUpdate(isPrinting); + } + + // Cancel print job button + if (GUILayout.Button(iconSet["Trash"], buttonDimensions)) + { + // We always work from the first item in the queue. + printQueue.RemoveAt(0); + } + + GUILayout.BeginVertical(); + // Current print job + string jobTitle = printQueue.Count > 0 ? printQueue[0].availablePart.title : "None"; + GUILayout.Label(Localizer.Format("#LOC_SANDCASTLE_currentJob", new string[1] { jobTitle } )); + + // Job status + GUILayout.Label(Localizer.Format("#LOC_SANDCASTLE_currentJob", new string[1] { jobStatus } )); + GUILayout.EndVertical(); + + GUILayout.EndHorizontal(); + } + + private void drawPrintQueue() + { + GUILayout.Label(Localizer.Format("#LOC_SANDCASTLE_printQueue")); + + List doomed = new List(); + partQueueScrollPos = GUILayout.BeginScrollView(partQueueScrollPos, printQueueHeight); + int count = printQueue.Count; + for (int index = 0; index < count; index++) + { + GUILayout.BeginHorizontal(); + if (GUILayout.Button(iconSet["Trash"], buttonDimensions)) + { + doomed.Add(printQueue[index]); + } + GUILayout.Label("" + printQueue[index].availablePart.title + ""); + GUILayout.EndHorizontal(); + } + GUILayout.EndScrollView(); + + // Clear out any doomed items + count = doomed.Count; + for (int index = 0; index < count; index++) + { + printQueue.Remove(doomed[index]); + } + } + + private void drawPreviewPartInfo() + { + GUILayout.BeginHorizontal(partRequirementsHeight); + + // Preview image + GUILayout.BeginScrollView(Vector2.zero, previewImagePaneDimensions); + GUILayout.Label(previewPartImage, previewImageDimensions); + GUILayout.Label(previewPartMassVolume); + GUILayout.EndScrollView(); + + // Name and requirements + partInfoScrollPos = GUILayout.BeginScrollView(partInfoScrollPos); + GUILayout.Label(previewPartRequirements); + GUILayout.EndScrollView(); + + GUILayout.EndHorizontal(); + + // Part description + partDescriptionScrollPos = GUILayout.BeginScrollView(partDescriptionScrollPos, previewDescriptionHeight); + GUILayout.Label(previewPartDescription); + GUILayout.EndScrollView(); + } + + private void drawPartButtons() + { + partsScrollPos = GUILayout.BeginScrollView(partsScrollPos, selectorPanelWidth); + int column = -1; + for (int index = 0; index < partImages.Length; index++) + { + // Begin a new row + if (column == -1) + { + GUILayout.BeginHorizontal(); + } + + // Increment column + column += 1; + + // Add item to print queue + if (GUILayout.Button(partImages[index], selectorButtonDimensions)) + { + updatePartPreview(index); + BuildItem buildItem = new BuildItem(itemCache[previewPart.name]); + printQueue.Add(buildItem); + } + + // Update part preview + else if (isMouseOver()) + { + updatePartPreview(index); + } + + // Close out the column + if (column == 2) + { + column = -1; + GUILayout.EndHorizontal(); + } + } + + // Make sure we match all our begin and end horizontals. + if (column != -1) + GUILayout.EndHorizontal(); + GUILayout.EndScrollView(); + } + + private void drawCategorySelector() + { + GUILayout.BeginVertical(); + + selectedCategory = currentCategory; + + categoryScrollPos = GUILayout.BeginScrollView(categoryScrollPos, categoryPanelWidth); + + drawCategoryButton(PartCategories.Pods); + drawCategoryButton(PartCategories.FuelTank); + drawCategoryButton(PartCategories.Engine); + drawCategoryButton(PartCategories.Control); + drawCategoryButton(PartCategories.Structural); + drawCategoryButton(PartCategories.Robotics); + drawCategoryButton(PartCategories.Coupling); + drawCategoryButton(PartCategories.Payload); + drawCategoryButton(PartCategories.Ground); + drawCategoryButton(PartCategories.Thermal); + drawCategoryButton(PartCategories.Electrical); + drawCategoryButton(PartCategories.Communication); + drawCategoryButton(PartCategories.Science); + drawCategoryButton(PartCategories.Cargo); + drawCategoryButton(PartCategories.Utility); + + GUILayout.EndScrollView(); + + GUILayout.EndVertical(); + + // Reset background color + GUI.backgroundColor = backgroundColor; + + // Change categories + if (selectedCategory != currentCategory) + { + currentCategory = selectedCategory; + categoryName = currentCategory.ToString(); + updateCategoryParts(); + } + + // Reset category + if (categoryMousedOver && Planetarium.GetUniversalTime() > categoryUpdateTime) + { + categoryMousedOver = false; + categoryName = currentCategory.ToString(); + } + } + + private void drawCategoryButton(PartCategories category) + { + GUI.backgroundColor = currentCategory == category ? selectedColor : backgroundColor; + if (GUILayout.Button(iconSet[category.ToString()], categoryButtonDimensions)) + selectedCategory = category; + if (isMouseOver()) + { + categoryName = category.ToString(); + categoryMousedOver = true; + categoryUpdateTime = Planetarium.GetUniversalTime() + 0.25; + } + } + #endregion + + #region Helpers + private void updatePartPreview(int partIndex) + { + previewPart = filteredParts[partIndex]; + + // Get the build item + BuildItem item; + if (!itemCache.ContainsKey(previewPart.name)) + { + item = new BuildItem(previewPart); + itemCache.Add(previewPart.name, item); + } + item = itemCache[previewPart.name]; + + // Part image + previewPartImage = InventoryUtils.GetTexture(previewPart.name); + + // Part mass and volume + ModuleCargoPart cargoPart = previewPart.partPrefab.FindModuleImplementing(); + previewPartMassVolume = Localizer.Format("#LOC_SANDCASTLE_partMassVolume", + new string[2] { string.Format("{0:n3}", previewPart.partPrefab.mass), string.Format("{0:n3}", cargoPart.packedVolume) }); + + // Part description + previewPartDescription = "" + previewPart.description + ""; + + // Title + StringBuilder requirements = new StringBuilder(); + requirements.AppendLine("" + previewPart.title + ""); + + // Required resources + PartResourceDefinitionList definitions = PartResourceLibrary.Instance.resourceDefinitions; + PartResourceDefinition resourceDef; + int count = item.materials.Count; + double amount = 0; + double maxAmount = 0; + if (count > 0) + { + requirements.AppendLine(" "); + requirements.AppendLine(Localizer.Format("#LOC_SANDCASTLE_requiredResources")); + for (int index = 0; index < count; index++) + { + if (definitions.Contains(item.materials[index].name)) + { + resourceDef = definitions[item.materials[index].name]; + part.GetConnectedResourceTotals(resourceDef.id, out amount, out maxAmount); + if (amount < item.materials[index].amount) + requirements.AppendLine(string.Format("{0:s}: {1:n3}u", resourceDef.displayName, item.materials[index].amount)); + else + requirements.AppendLine(string.Format("{0:s}: {1:n3}u", resourceDef.displayName, item.materials[index].amount)); + } + } + } + + // Required parts + count = item.requiredComponents.Count; + if (count > 0) + { + requirements.AppendLine(" "); + requirements.AppendLine(Localizer.Format("#LOC_SANDCASTLE_requiredParts")); + AvailablePart requiredPart; + for (int index = 0; index < count; index++) + { + requiredPart = PartLoader.getPartInfoByName(item.requiredComponents[index]); + if (InventoryUtils.HasItem(part.vessel, requiredPart.name)) + requirements.AppendLine(requiredPart.title); + else + requirements.AppendLine("" + requiredPart.title + ""); + } + } + + // Write out the part info + previewPartRequirements = "" + requirements.ToString() + ""; + + // Reset our scroll position + partDescriptionScrollPos = Vector2.zero; + partInfoScrollPos = Vector2.zero; + } + + private void updateCategoryParts() + { + // Filter parts for the current category. + filteredParts = new List(); + int count = partsList.Count; + List thumbnails = new List(); + AvailablePart availablePart; + for (int index = 0; index < count; index++) + { + if (partsList[index].category == currentCategory) + { + availablePart = partsList[index]; + filteredParts.Add(availablePart); + thumbnails.Add(InventoryUtils.GetTexture(availablePart.name)); + } + } + + partImages = thumbnails.ToArray(); + selectedIndex = 0; + currentIndex = 0; + partsScrollPos = Vector2.zero; + } + + private void loadIcons() + { + iconSet = new Dictionary(); + + iconSet.Add(PartCategories.Aero.ToString(), loadTexture("Squad/PartList/SimpleIcons/R&D_node_icon_advaerodynamics")); + iconSet.Add(PartCategories.Cargo.ToString(), loadTexture("Squad/PartList/SimpleIcons/deployed_science_part")); + iconSet.Add(PartCategories.Communication.ToString(), loadTexture("Squad/PartList/SimpleIcons/R&D_node_icon_advunmanned")); + iconSet.Add(PartCategories.Control.ToString(), loadTexture("Squad/PartList/SimpleIcons/R&D_node_icon_largecontrol")); + iconSet.Add(PartCategories.Coupling.ToString(), loadTexture("Squad/PartList/SimpleIcons/cs_size3")); + iconSet.Add(PartCategories.Electrical.ToString(), loadTexture("Squad/PartList/SimpleIcons/R&D_node_icon_electrics")); + iconSet.Add(PartCategories.Engine.ToString(), loadTexture("Squad/PartList/SimpleIcons/RDicon_propulsionSystems")); + iconSet.Add(PartCategories.FuelTank.ToString(), loadTexture("Squad/PartList/SimpleIcons/RDicon_fuelSystems-advanced")); + iconSet.Add(PartCategories.Ground.ToString(), loadTexture("Squad/PartList/SimpleIcons/R&D_node_icon_advancedmotors")); + iconSet.Add(PartCategories.Payload.ToString(), loadTexture("Squad/PartList/SimpleIcons/R&D_node_icon_composites")); + iconSet.Add(PartCategories.Pods.ToString(), loadTexture("Squad/PartList/SimpleIcons/RDicon_commandmodules")); + iconSet.Add(PartCategories.Robotics.ToString(), loadTexture("Squad/PartList/SimpleIcons/R&D_node_icon_robotics")); + iconSet.Add(PartCategories.Science.ToString(), loadTexture("Squad/PartList/SimpleIcons/R&D_node_icon_advsciencetech")); + iconSet.Add(PartCategories.Structural.ToString(), loadTexture("Squad/PartList/SimpleIcons/R&D_node_icon_generalconstruction")); + iconSet.Add(PartCategories.Thermal.ToString(), loadTexture("Squad/PartList/SimpleIcons/fuels_monopropellant")); + iconSet.Add(PartCategories.Utility.ToString(), loadTexture("Squad/PartList/SimpleIcons/R&D_node_icon_generic")); + + iconSet.Add("Play", loadTexture("WildBlueIndustries/Sandcastle/Icons/Play")); + iconSet.Add("Pause", loadTexture("WildBlueIndustries/Sandcastle/Icons/Pause")); + iconSet.Add("Trash", loadTexture("WildBlueIndustries/Sandcastle/Icons/Trash")); + iconSet.Add("Blank", loadTexture("WildBlueIndustries/Sandcastle/Icons/Box")); + } + + private Texture2D loadTexture(string path) + { + Texture2D texture = GameDatabase.Instance.GetTexture(path, false); + return texture != null ? texture : new Texture2D(32, 32); + } + + private bool isMouseOver() + { + return (Event.current.type == EventType.Repaint && GUILayoutUtility.GetLastRect().Contains(Event.current.mousePosition)); + } + #endregion + } +} diff --git a/source/Sandcastle/PrintShop/PartModules/WBIPrintShop.cs b/source/Sandcastle/PrintShop/PartModules/WBIPrintShop.cs new file mode 100644 index 0000000..2e99555 --- /dev/null +++ b/source/Sandcastle/PrintShop/PartModules/WBIPrintShop.cs @@ -0,0 +1,490 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Sandcastle.Inventory; +using UnityEngine; +using KSP.Localization; + +namespace Sandcastle.PrintShop +{ + /// + /// Lists the different printer states + /// + public enum WBIPrintStates + { + /// + /// Printer is idle, nothing to print. + /// + Idle, + + /// + /// Printer has an item to print but is paused. + /// + Paused, + + /// + /// Printer is printing something. + /// + Printing + } + + /// + /// Represents a shop that is capable of printing items and placing them in an available inventory. + /// + public class WBIPrintShop: PartModule + { + #region Constants + const double kCatchupTime = 3600; + const float kMsgDuration = 5; + const string kPrintState = "printState"; + const string kPrintShopGroup = "PrintShop"; + #endregion + + #region Fields + /// + /// A flag to enable/disable debug mode. + /// + [KSPField] + public bool debugMode = false; + + /// + /// The maximum volume that the printer can print, in liters. Set to less than 0 for no restrictions. + /// + [KSPField] + public float maxPrintVolume = 500f; + + /// + /// The number of resource units per second that the printer can print. + /// + [KSPField] + public float printSpeedUSec = 1f; + + /// + /// Flag to indicate whether or not to allow specialists to improve the print speed. Exactly how the specialist(s) does that is a trade secret. + /// + [KSPField] + public bool UseSpecialistBonus = true; + + /// + /// Per experience rating, how much to improve the print speed by. + /// The print shop part must have crew capacity. + /// + [KSPField] + public float SpecialistBonus = 0.05f; + + /// + /// The skill required to improve the print speed. + /// + [KSPField] + public string ExperienceEffect = "ConverterSkill"; + + /// + /// Name of the effect to play from the part's EFFECTS node when the printer is running. + /// + [KSPField] + public string runningEffect = string.Empty; + #endregion + + #region Housekeeping + /// + /// Represents the list of build items to print. + /// + public List printQueue; + + /// + /// Current state of the printer. + /// + [KSPField(guiName = "#LOC_SANDCASTLE_printState", guiActive = true, groupName = kPrintShopGroup, groupDisplayName = "#LOC_SANDCASTLE_printShopGroupName")] + public WBIPrintStates printState = WBIPrintStates.Idle; + + /// + /// Describes when the printer was last updated. + /// + [KSPField(isPersistant = true)] + public double lastUpdateTime; + + /// + /// Current job being printed. + /// + [KSPField(isPersistant = true)] + public string currentJob = string.Empty; + + List filteredParts = null; + PrintShopUI shopUI = null; + double printResumeTime = 0; + bool missingRequirements = false; + Dictionary unHighlightList = null; + #endregion + + #region FixedUpdate + public void FixedUpdate() + { + if (!HighLogic.LoadedSceneIsFlight) + return; + + // Handle unhighlight + handleUnhighlightParts(); + + // If the printer is pased then we're done + if (printState == WBIPrintStates.Paused) + { + lastUpdateTime = Planetarium.GetUniversalTime(); + shopUI.jobStatus = printState.ToString(); + part.Effect(runningEffect, 0); + return; + } + + // If there are no items in the print queue then we're done. + if (printQueue.Count == 0) + { + lastUpdateTime = Planetarium.GetUniversalTime(); + printState = WBIPrintStates.Idle; + shopUI.jobStatus = printState.ToString(); + part.Effect(runningEffect, 0); + return; + } + + // Play effects + part.Effect(runningEffect, 1); + + // Handle catchup + handleCatchup(); + + // Process the print queue + processPrintQueue(); + } + #endregion + + #region Overrides + public override void OnStart(StartState state) + { + base.OnStart(state); + if (!HighLogic.LoadedSceneIsFlight) + return; + printResumeTime = Planetarium.GetUniversalTime() + 5; + + // Update the filtered list of cargo parts + filteredParts = InventoryUtils.GetPrintableParts(maxPrintVolume); + + // Watch for game events + GameEvents.onVesselChange.Add(onVesselChange); + } + + public override void OnAwake() + { + base.OnAwake(); + unHighlightList = new Dictionary(); + printQueue = new List(); + shopUI = new PrintShopUI(); + shopUI.part = part; + shopUI.printQueue = printQueue; + shopUI.onPrintStatusUpdate = onPrintStatusUpdate; + } + + public override void OnInactive() + { + base.OnInactive(); + if (shopUI.IsVisible()) + shopUI.SetVisible(false); + } + + public void Destroy() + { + if (shopUI.IsVisible()) + shopUI.SetVisible(false); + GameEvents.onVesselChange.Remove(onVesselChange); + } + + private void onVesselChange(Vessel newVessel) + { + if (shopUI.IsVisible()) + shopUI.SetVisible(false); + } + + public override void OnLoad(ConfigNode node) + { + base.OnLoad(node); + + // Print state + if (node.HasValue(kPrintState)) + printState = (WBIPrintStates)Enum.Parse(typeof(WBIPrintStates), node.GetValue(kPrintState)); + + // Print Queue + if (node.HasNode(BuildItem.kBuildItemNode)) + { + BuildItem buildItem; + ConfigNode[] nodes = node.GetNodes(BuildItem.kBuildItemNode); + for (int index = 0; index < nodes.Length; index++) + { + buildItem = new BuildItem(nodes[index]); + printQueue.Add(buildItem); + } + } + } + + public override void OnSave(ConfigNode node) + { + base.OnSave(node); + + // Print state + node.AddValue(kPrintState, printState.ToString()); + + // Print queue + ConfigNode buildItemNode; + int count = printQueue.Count; + for (int index = 0; index < count; index++) + { + buildItemNode = printQueue[index].Save(); + node.AddNode(buildItemNode); + } + } + #endregion + + #region Events + [KSPEvent(guiActive = true, groupName = kPrintShopGroup, groupDisplayName = "#LOC_SANDCASTLE_printShopGroupName", guiName = "#LOC_SANDCASTLE_openGUI")] + public void OpenGUI() + { + shopUI.partsList = filteredParts; + shopUI.SetVisible(true); + } + #endregion + + #region API + #endregion + + #region Helpers + private void processPrintQueue() + { + // Check the print queue again. + if (printQueue.Count == 0) + { + lastUpdateTime = Planetarium.GetUniversalTime(); + printState = WBIPrintStates.Idle; + return; + } + + // Continue with the printing + printState = WBIPrintStates.Printing; + + // Consume any resources that we require to operate. + if (resHandler.inputResources.Count > 0) + { + string error = string.Empty; + resHandler.UpdateModuleResourceInputs(ref error, 1.0f, 0.1f, true); + int count = resHandler.inputResources.Count; + for (int index = 0; index < count; index++) + { + if (!resHandler.inputResources[index].available) + { + lastUpdateTime = Planetarium.GetUniversalTime(); + shopUI.jobStatus = error; + return; + } + } + } + if (resHandler.outputResources.Count > 0) + resHandler.UpdateModuleResourceOutputs(); + + // Handle the current print job. + handlePrintJob(TimeWarp.fixedDeltaTime); + } + + private void handleCatchup() + { + BuildItem buildItem; + double printTimeRemaining = 0; + double elapsedTime = Planetarium.GetUniversalTime() - lastUpdateTime; + while (elapsedTime > TimeWarp.fixedDeltaTime * 2 && printQueue.Count > 0) + { + // We always work with the first item in the queue. + buildItem = printQueue[0]; + + // Update print state + printState = WBIPrintStates.Printing; + + // Calculate print time remaining + printTimeRemaining = (buildItem.totalUnitsRequired - buildItem.totalUnitsPrinted) * printSpeedUSec; + if (printTimeRemaining > elapsedTime) + printTimeRemaining = elapsedTime; + + // Handle print job + handlePrintJob(printTimeRemaining); + + // Update elapsedTime + elapsedTime -= printTimeRemaining; + + if (printQueue.Count == 0 || missingRequirements) + { + elapsedTime = TimeWarp.fixedDeltaTime; + break; + } + } + } + + private void handleUnhighlightParts() + { + double[] unHighlightTimes = unHighlightList.Keys.ToArray(); + double currentTime = Planetarium.GetUniversalTime(); + List doomed = new List(); + + for (int index = 0; index < unHighlightTimes.Length; index++) + { + if (currentTime >= unHighlightTimes[index]) + { + doomed.Add(unHighlightTimes[index]); + unHighlightList[unHighlightTimes[index]].Highlight(false); + } + } + int count = doomed.Count; + for (int index = 0; index < count; index++) + unHighlightList.Remove(doomed[index]); + } + + private void handlePrintJob(double elapsedTime) + { + // Update states + missingRequirements = false; + shopUI.isPrinting = true; + + // Get the build item + BuildItem buildItem = printQueue[0]; + ModuleCargoPart cargoPart = buildItem.availablePart.partPrefab.FindModuleImplementing(); + + // Make sure that the vessel has enough inventory space + if (!InventoryUtils.HasEnoughSpace(part.vessel, buildItem.availablePart)) + { + shopUI.jobStatus = Localizer.Format("#LOC_SANDCASTLE_needsSpace", new string[1] { string.Format("{0:n3}", cargoPart.packedVolume) }); + missingRequirements = true; + lastUpdateTime = Planetarium.GetUniversalTime(); + return; + } + + // Consume resources + int count = 0; + if (buildItem.totalUnitsPrinted < buildItem.totalUnitsRequired) + { + // Calculate consumptionRate + float consumptionRate = printSpeedUSec * calculateSpecialistBonus() * (float)elapsedTime; + + double amount = 0; + double maxAmount = 0; + ModuleResource material; + count = buildItem.materials.Count; + for (int index = 0; index < count; index++) + { + material = buildItem.materials[index]; + + if (material.amount > 0) + { + // Make sure that we have enough of the resource + part.GetConnectedResourceTotals(material.resourceDef.id, out amount, out maxAmount); + if (amount < consumptionRate) + { + shopUI.jobStatus = Localizer.Format("#LOC_SANDCASTLE_needsResource", new string[1] { material.resourceDef.displayName }); + lastUpdateTime = Planetarium.GetUniversalTime(); + missingRequirements = true; + return; + } + + // Consume the resource + part.RequestResource(material.resourceDef.id, consumptionRate, material.resourceDef.resourceFlowMode); + + material.amount -= consumptionRate; + if (material.amount < 0) + material.amount = 0; + + buildItem.totalUnitsPrinted += consumptionRate; + if (buildItem.totalUnitsPrinted > buildItem.totalUnitsRequired) + buildItem.totalUnitsPrinted = buildItem.totalUnitsRequired; + } + } + } + + // Update progress + double progress = (buildItem.totalUnitsPrinted / buildItem.totalUnitsRequired) * 100; + shopUI.jobStatus = Localizer.Format("#LOC_SANDCASTLE_progress", new string[1] { string.Format("{0:n1}", progress) }); + if (progress < 100) + { + lastUpdateTime = Planetarium.GetUniversalTime(); + return; + } + + // Consume required components + count = buildItem.requiredComponents.Count; + string requiredPart; + List doomed = new List(); + for (int index = 0; index < count; index++) + { + requiredPart = buildItem.requiredComponents[index]; + + if (InventoryUtils.HasItem(part.vessel, requiredPart)) + { + InventoryUtils.RemoveItem(part.vessel, requiredPart); + doomed.Add(requiredPart); + } + else + { + AvailablePart availablePart = PartLoader.getPartInfoByName(requiredPart); + shopUI.jobStatus = Localizer.Format("#LOC_SANDCASTLE_needsPart", new string[1] { availablePart.title }); + lastUpdateTime = Planetarium.GetUniversalTime(); + missingRequirements = true; + return; + } + } + count = doomed.Count; + for (int index = 0; index < count; index++) + buildItem.requiredComponents.Remove(doomed[index]); + + // If we've finished printing then add the item to an inventory. + lastUpdateTime = Planetarium.GetUniversalTime(); + if (buildItem.requiredComponents.Count == 0) + { + // Add the item to an inventory + Part inventoryPart = InventoryUtils.AddItem(part.vessel, buildItem.availablePart, part.FindModuleImplementing()); + ScreenMessages.PostScreenMessage(Localizer.Format("#LOC_SANDCASTLE_storedPart", new string[2] { buildItem.availablePart.title, inventoryPart.partName }), kMsgDuration, ScreenMessageStyle.UPPER_LEFT); + inventoryPart.Highlight(Color.cyan); + unHighlightList.Add(lastUpdateTime + kMsgDuration, inventoryPart); + + // Remove the item from the print queue + printQueue.RemoveAt(0); + } + + } + + private void onPrintStatusUpdate(bool isPrinting) + { + if (isPrinting) + { + printState = printQueue.Count > 0 ? WBIPrintStates.Printing : WBIPrintStates.Idle; + } + else + { + printState = WBIPrintStates.Paused; + } + } + + private float calculateSpecialistBonus() + { + if (!UseSpecialistBonus || part.CrewCapacity == 0 || part.protoModuleCrew.Count == 0) + return 1.0f; + + // Find crew with the required skill. They must be in the part. + int count = part.protoModuleCrew.Count; + ProtoCrewMember astronaut; + int highestRank = 0; + float bonus = 1.0f; + + for (int index = 0; index < count; index++) + { + astronaut = part.protoModuleCrew[index]; + if (astronaut.HasEffect(ExperienceEffect) && astronaut.experienceLevel > highestRank) + highestRank = astronaut.experienceLevel; + if (highestRank >= 5) + break; + } + + return bonus + (highestRank * SpecialistBonus); + } + #endregion + } +} diff --git a/source/Sandcastle/PrintShop/SupportClasses/BuildItem.cs b/source/Sandcastle/PrintShop/SupportClasses/BuildItem.cs new file mode 100644 index 0000000..cbf6946 --- /dev/null +++ b/source/Sandcastle/PrintShop/SupportClasses/BuildItem.cs @@ -0,0 +1,243 @@ +using System; +using System.Collections.Generic; + +namespace Sandcastle.PrintShop +{ + /// + /// Represents an item that needs to be built. + /// + public class BuildItem + { + #region Constants + /// + /// Build item node identifier + /// + public const string kBuildItemNode = "BUILD_ITEM"; + + const string kPartName = "partName"; + const string kTotalUnitsRequired = "totalUnitsRequired"; + const string kTotalUnitsPrinted = "totalUnitsPrinted"; + const string kRequiredComponent = "requiredComponent"; + const string kPrintResource = "PRINT_RESOURCE"; + #endregion + + #region Housekeeping + /// + /// Name of the part being built. + /// + public string partName = string.Empty; + + /// + /// The Available part representing the build item. + /// + public AvailablePart availablePart; + + /// + /// List of resource materials required. Rate in this context represents the amount of the resource required in order to complete the part. + /// + public List materials; + + /// + /// List of parts required to complete the build item. The parts must be in the vessel inventory. + /// + public List requiredComponents; + + /// + /// Total units required to produce the item, determined from all required resources. + /// + public double totalUnitsRequired; + + /// + /// Total units printed to date, determined from all required resources. + /// + public double totalUnitsPrinted; + #endregion + + #region Constructors + /// + /// Constructs a new build item from the supplied config node. + /// + /// A ConfigNode containing data for the build item. + public BuildItem(ConfigNode node) + { + if (node.HasValue(kPartName)) + partName = node.GetValue(kPartName); + + if (node.HasValue(kTotalUnitsRequired)) + double.TryParse(node.GetValue(kTotalUnitsRequired), out totalUnitsRequired); + + if (node.HasValue(kTotalUnitsPrinted)) + double.TryParse(node.GetValue(kTotalUnitsPrinted), out totalUnitsPrinted); + + materials = new List(); + if (node.HasNode(MaterialsList.kResourceNode)) + { + + ConfigNode[] nodes = node.GetNodes(MaterialsList.kResourceNode); + ModuleResource resource; + for (int index = 0; index < nodes.Length; index++) + { + resource = new ModuleResource(); + resource.Load(nodes[index]); + materials.Add(resource); + } + } + + requiredComponents = new List(); + if (node.HasValue(kRequiredComponent)) + { + string[] components = node.GetValues(kRequiredComponent); + for (int index = 0; index < components.Length; index++) + requiredComponents.Add(components[index]); + } + + availablePart = PartLoader.getPartInfoByName(partName); + } + + /// + /// Constructs a build item from the supplied available part. + /// + /// The AvailablePart to base the build item on. + public BuildItem(AvailablePart availablePart) + { + partName = availablePart.name; + this.availablePart = availablePart; + + // Get the materials list + MaterialsList materialsList = MaterialsList.GetListForCategory(availablePart.category.ToString()); + ModuleResource[] resources = materialsList.materials.ToArray(); + ModuleResource resource; + ConfigNode node; + PartResourceDefinitionList definitions = PartResourceLibrary.Instance.resourceDefinitions; + PartResourceDefinition resourceDef; + + // Copy the required materials and tally the total units required. + totalUnitsRequired = 0; + materials = new List(); + for (int index = 0; index < resources.Length; index++) + { + resource = resources[index]; + if (definitions.Contains(resource.name)) + { + resourceDef = definitions[resource.name]; + node = new ConfigNode(MaterialsList.kResourceNode); + resource.Save(node); + + resource = new ModuleResource(); + resource.Load(node); + resource.amount = calculateRequiredAmount(availablePart.partPrefab.mass, resourceDef.density, resource.rate); + totalUnitsRequired += resource.amount; + + materials.Add(resource); + } + } + + // If the part requires special resources, add them too. + if (availablePart.partConfig.HasNode(kPrintResource)) + { + ConfigNode[] nodes = availablePart.partConfig.GetNodes(kPrintResource); + for (int index = 0; index < nodes.Length; index++) + { + resource = new ModuleResource(); + resource.Load(nodes[index]); + if (definitions.Contains(resource.name)) + { + resourceDef = definitions[resource.name]; + resource.amount = calculateRequiredAmount(availablePart.partPrefab.mass, resourceDef.density, resource.rate); + totalUnitsRequired += resource.amount; + + materials.Add(resource); + } + } + } + + // If the part requires additional components, add them too. + requiredComponents = new List(); + if (availablePart.partConfig.HasValue(kRequiredComponent)) + { + string[] components = availablePart.partConfig.GetValues(kRequiredComponent); + for (int index = 0; index < components.Length; index++) + requiredComponents.Add(components[index]); + } + + // Finalize the new item + totalUnitsPrinted = 0; + } + + public BuildItem(BuildItem copyFrom) + { + materials = new List(); + requiredComponents = new List(); + + partName = copyFrom.partName; + availablePart = copyFrom.availablePart; + totalUnitsPrinted = copyFrom.totalUnitsPrinted; + totalUnitsRequired = copyFrom.totalUnitsRequired; + + int count = copyFrom.requiredComponents.Count; + for (int index = 0; index < count; index++) + { + requiredComponents.Add(copyFrom.requiredComponents[index]); + } + + ModuleResource resource; + ConfigNode node; + count = copyFrom.materials.Count; + for (int index = 0; index < count; index++) + { + resource = copyFrom.materials[index]; + node = new ConfigNode(MaterialsList.kResourceNode); + resource.Save(node); + + resource = new ModuleResource(); + resource.Load(node); + materials.Add(resource); + } + } + #endregion + + #region API + /// + /// Saves the build item. + /// + /// A ConfigNode containing serialized data. + public ConfigNode Save() + { + ConfigNode node = new ConfigNode(kBuildItemNode); + + node.AddValue(kPartName, partName); + node.AddValue(kTotalUnitsRequired, totalUnitsRequired.ToString()); + node.AddValue(kTotalUnitsPrinted, totalUnitsPrinted.ToString()); + + // Materials + ModuleResource[] resources = materials.ToArray(); + ConfigNode resourceNode; + for (int index = 0; index < resources.Length; index++) + { + resourceNode = new ConfigNode(MaterialsList.kResourceNode); + resources[index].Save(resourceNode); + node.AddNode(resourceNode); + } + + // Required components + int count = requiredComponents.Count; + for (int index = 0; index < count; index++) + { + node.AddValue(kRequiredComponent, requiredComponents[index]); + } + return node; + } + #endregion + + #region Helpers + double calculateRequiredAmount(double partMass, double resourceDensity, double rate) + { + double multiplier = rate; + if (multiplier < 1) + multiplier = 1; + + return (partMass / resourceDensity) * multiplier; + } + #endregion + } +} diff --git a/source/Sandcastle/PrintShop/SupportClasses/MaterialsList.cs b/source/Sandcastle/PrintShop/SupportClasses/MaterialsList.cs new file mode 100644 index 0000000..4245d60 --- /dev/null +++ b/source/Sandcastle/PrintShop/SupportClasses/MaterialsList.cs @@ -0,0 +1,162 @@ +using System; +using System.Collections.Generic; + +namespace Sandcastle.PrintShop +{ + /// + /// Represents a list of resources needed to build an item of a particular part category. + /// + public class MaterialsList + { + #region constants + /// + /// Node ID for a materials list. + /// + public const string kMaterialsListNode = "MATERIALS_LIST"; + + /// + /// Node ID for tech node materials. Parts in a specific tech node can require additional materials. + /// + public const string kTechNodeMaterials = "TECH_NODE_MATERIALS"; + + /// + /// Name of the default materials list. + /// + public const string kDefaultMaterialsListName = "Default"; + + /// + /// Represents a resource node. + /// + public const string kResourceNode = "RESOURCE"; + + const string kListName = "name"; + const string kDefaultResource = "Ore"; + const string kDefaultRate = "5"; + const string kDefaultFlowMode = "STAGE_PRIORITY_FLOW"; + #endregion + + #region Housekeeping + /// + /// Name of the materials list. This should correspond to one of the part categories. + /// + public string name = string.Empty; + + /// + /// List of resource materials required. + /// + public List materials; + #endregion + + #region Constructors + /// + /// Loads the materials lists that specify what materials are required to produce an item from a particular category. + /// + /// A Dictionary containing the list names as keys and MaterialList objects as values. + public static Dictionary LoadLists() + { + materialsLists = new Dictionary(); + + // Load the materials list for part categories. + loadListsWithID(kMaterialsListNode); + + // Load the optional additional materials lists for tech nodes. + loadListsWithID(kTechNodeMaterials); + + // Make sure we at least have the default list. + if (!materialsLists.ContainsKey(kDefaultMaterialsListName)) + { + materialsLists.Add(kDefaultMaterialsListName, GetDefaultList()); + } + + return materialsLists; + } + #endregion + + #region statics + /// + /// A map of all materials lists, keyed by part category name. + /// + public static Dictionary materialsLists; + + /// + /// Returns the materials list for the requested category, or the default list if the list for the requested category doesn't exist. + /// + /// A string containing the desired category. + /// A MaterialsList if one exists for the desired category, or the default list. + public static MaterialsList GetListForCategory(string categoryName) + { + if (materialsLists.ContainsKey(categoryName)) + return materialsLists[categoryName]; + else if (materialsLists.ContainsKey(kDefaultMaterialsListName)) + return materialsLists[kDefaultMaterialsListName]; + else + { + materialsLists.Add(kDefaultMaterialsListName, GetDefaultList()); + return materialsLists[kDefaultMaterialsListName]; + } + } + + /// + /// Creates the default materials list. + /// + /// A MaterialsList containing the default materials. + public static MaterialsList GetDefaultList() + { + MaterialsList materialsList = new MaterialsList(); + materialsList.name = kDefaultMaterialsListName; + + ConfigNode node = new ConfigNode(kResourceNode); + node.AddValue("name", kDefaultResource); + node.AddValue("rate", kDefaultRate); + + ModuleResource resource = new ModuleResource(); + resource.Load(node); + + materialsList.materials = new List(); + materialsList.materials.Add(resource); + + return materialsList; + } + #endregion + + #region Helpers + private static void loadListsWithID(string nodeID) + { + if (GameDatabase.Instance == null) + return; + ConfigNode[] nodes = GameDatabase.Instance.GetConfigNodes(nodeID); + if (nodes.Length == 0) + return; + + ConfigNode[] resourceNodes; + ConfigNode node; + ModuleResource resource; + MaterialsList materialsList; + + // Load the config nodes. + for (int index = 0; index < nodes.Length; index++) + { + node = nodes[index]; + if (node.HasValue(kListName) && node.HasNode(kResourceNode)) + { + materialsList = new MaterialsList(); + materialsList.materials = new List(); + + materialsList.name = node.GetValue(kListName); + + resourceNodes = node.GetNodes(kResourceNode); + for (int nodeIndex = 0; nodeIndex < resourceNodes.Length; nodeIndex++) + { + resource = new ModuleResource(); + resource.Load(resourceNodes[nodeIndex]); + materialsList.materials.Add(resource); + } + + materialsLists.Add(materialsList.name, materialsList); + } + } + } + #endregion + + } +} diff --git a/source/Sandcastle/Properties/AssemblyInfo.cs b/source/Sandcastle/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..e8fbf72 --- /dev/null +++ b/source/Sandcastle/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Sandcastle")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Sandcastle")] +[assembly: AssemblyCopyright("Copyright © 2021")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("6e7577b1-a073-4a6f-8171-0797eef9044e")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/source/Sandcastle/RunMDSeparator.bat b/source/Sandcastle/RunMDSeparator.bat new file mode 100644 index 0000000..aeda80a --- /dev/null +++ b/source/Sandcastle/RunMDSeparator.bat @@ -0,0 +1 @@ +MarkdownSeparator API.md Wiki \ No newline at end of file diff --git a/source/Sandcastle/RunPowershell.bat b/source/Sandcastle/RunPowershell.bat new file mode 100644 index 0000000..156d8ec --- /dev/null +++ b/source/Sandcastle/RunPowershell.bat @@ -0,0 +1 @@ +Powershell.exe -ExecutionPolicy Unrestricted -file "xmldoc2md.ps1" -xml "xmldoc2md.xml" -xsl "xmldoc2md.xsl" -output "API.md" \ No newline at end of file diff --git a/source/Sandcastle/Sandcastle.csproj b/source/Sandcastle/Sandcastle.csproj new file mode 100644 index 0000000..34935b8 --- /dev/null +++ b/source/Sandcastle/Sandcastle.csproj @@ -0,0 +1,129 @@ + + + + + Debug + AnyCPU + {6E7577B1-A073-4A6F-8171-0797EEF9044E} + Library + Properties + Sandcastle + Sandcastle + v4.5 + 512 + + + true + portable + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + bin\Debug\xmldoc2md.xml + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + ..\..\..\..\..\..\KSPDev\KSP_x64_Data\Managed\Assembly-CSharp.dll + + + ..\..\..\..\..\..\KSPDev\KSP_x64_Data\Managed\Assembly-CSharp-firstpass.dll + + + ..\..\..\..\..\..\KSPDev\KSP_x64_Data\Managed\KSPAssets.dll + + + + + + + + + + + ..\..\..\..\..\..\KSPDev\KSP_x64_Data\Managed\UnityEngine.dll + + + ..\..\..\..\..\..\KSPDev\KSP_x64_Data\Managed\UnityEngine.AnimationModule.dll + + + ..\..\..\..\..\..\KSPDev\KSP_x64_Data\Managed\UnityEngine.AudioModule.dll + + + ..\..\..\..\..\..\KSPDev\KSP_x64_Data\Managed\UnityEngine.CoreModule.dll + + + ..\..\..\..\..\..\KSPDev\KSP_x64_Data\Managed\UnityEngine.ImageConversionModule.dll + + + ..\..\..\..\..\..\KSPDev\KSP_x64_Data\Managed\UnityEngine.IMGUIModule.dll + + + ..\..\..\..\..\..\KSPDev\KSP_x64_Data\Managed\UnityEngine.InputLegacyModule.dll + + + ..\..\..\..\..\..\KSPDev\KSP_x64_Data\Managed\UnityEngine.PhysicsModule.dll + + + ..\..\..\..\..\..\KSPDev\KSP_x64_Data\Managed\UnityEngine.TextRenderingModule.dll + + + ..\..\..\..\..\..\KSPDev\KSP_x64_Data\Managed\UnityEngine.UI.dll + + + ..\..\..\..\..\..\KSPDev\KSP_x64_Data\Managed\UnityEngine.UIElementsModule.dll + + + ..\..\..\..\..\..\KSPDev\KSP_x64_Data\Managed\UnityEngine.UIModule.dll + + + ..\..\..\..\..\..\KSPDev\KSP_x64_Data\Managed\UnityEngine.UnityWebRequestWWWModule.dll + + + + + + + + + + + + + + + + + Always + + + Always + + + + + Always + + + Always + + + Always + + + + + + xcopy /Y "$(TargetPath)" "C:\KSPDev\GameData\WildBlueIndustries\Sandcastle\Plugin\" +xcopy /Y "$(TargetDir)$(TargetName).pdb" "C:\KSPDev\GameData\WildBlueIndustries\Sandcastle\Plugin\" +xcopy /Y "$(TargetDir)$(TargetName).dll" "C:\KSPDev\GameData\WildBlueIndustries\Sandcastle\Plugin\" + + \ No newline at end of file diff --git a/source/Sandcastle/Scenario/SandcastleScenario.cs b/source/Sandcastle/Scenario/SandcastleScenario.cs new file mode 100644 index 0000000..5a14711 --- /dev/null +++ b/source/Sandcastle/Scenario/SandcastleScenario.cs @@ -0,0 +1,36 @@ +using System; +using System.Collections.Generic; +using System.Collections; +using System.Linq; +using System.Text; +using System.IO; +using UnityEngine; +using KSP.IO; +using KSP.UI.Screens; +using Sandcastle.PrintShop; +using Sandcastle.Inventory; + +namespace Sandcastle +{ + [KSPScenario(ScenarioCreationOptions.AddToAllGames, GameScenes.SPACECENTER, GameScenes.EDITOR, GameScenes.FLIGHT, GameScenes.TRACKSTATION)] + public class SandcastleScenario: ScenarioModule + { + #region Housekeeping + public static SandcastleScenario shared; + #endregion + + #region Overrides + public override void OnAwake() + { + base.OnAwake(); + shared = this; + + if (HighLogic.LoadedSceneIsFlight) + { + MaterialsList.LoadLists(); + InventoryUtils.FindThumbnailPaths(); + } + } + #endregion + } +} \ No newline at end of file diff --git a/source/Sandcastle/Utilities/Dialog.cs b/source/Sandcastle/Utilities/Dialog.cs new file mode 100644 index 0000000..9efbc83 --- /dev/null +++ b/source/Sandcastle/Utilities/Dialog.cs @@ -0,0 +1,285 @@ +/* + * Window.cs + * + * Thunder Aerospace Corporation's library for the Kerbal Space Program, by Taranis Elsu + * + * (C) Copyright 2013, Taranis Elsu + * + * Kerbal Space Program is Copyright (C) 2013 Squad. See http://kerbalspaceprogram.com/. This + * project is in no way associated with nor endorsed by Squad. + * + * This code is licensed under the Attribution-NonCommercial-ShareAlike 3.0 (CC BY-NC-SA 3.0) + * creative commons license. See + * for full details. + * + * Attribution — You are free to modify this code, so long as you mention that the resulting + * work is based upon or adapted from this code. + * + * Non-commercial - You may not use this work for commercial purposes. + * + * Share Alike — If you alter, transform, or build upon this work, you may distribute the + * resulting work only under the same or similar license to the CC BY-NC-SA 3.0 license. + * + * Note that Thunder Aerospace Corporation is a ficticious entity created for entertainment + * purposes. It is in no way meant to represent a real entity. Any similarity to a real entity + * is purely coincidental. + */ + +using KSP.IO; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using UnityEngine; +using KSP.UI.Dialogs; + +namespace Sandcastle +{ + public interface IManagedWindow + { + bool IsVisible(); + void DrawWindow(); + } + + public abstract class Dialog : MonoBehaviour, IManagedWindow + { + private int windowId; + private string configNodeName; + private bool mouseDown; + protected bool visible; + + protected GUIStyle closeButtonStyle; + private GUIStyle resizeStyle; + private GUIContent resizeContent; + + public Rect windowPos; + public string WindowTitle; + public bool Resizable { get; set; } + public bool HideCloseButton { get; set; } + + protected Dialog(string windowTitle, float defaultWidth, float defaultHeight) + { + this.WindowTitle = windowTitle; + this.windowId = windowTitle.GetHashCode() + new System.Random().Next(65536) + System.Reflection.Assembly.GetExecutingAssembly().GetName().Name.GetHashCode(); + + configNodeName = windowTitle.Replace(" ", ""); + + windowPos = new Rect((Screen.width - defaultWidth) / 2, (Screen.height - defaultHeight) / 2, defaultWidth, defaultHeight); + mouseDown = false; + visible = false; + + var texture = DialogUtils.LoadImage(IOUtils.GetFilePathFor(typeof(T), "resize.png")); + resizeContent = (texture != null) ? new GUIContent(texture, "Drag to resize the window.") : new GUIContent("R", "Drag to resize the window."); + + Resizable = true; + HideCloseButton = false; + } + + public bool IsVisible() + { + return visible; + } + + public virtual void SetVisible(bool newValue) + { + this.visible = newValue; + + if (newValue) + { + DialogManager.Instance.RegisterWindow(this); + InputLockManager.SetControlLock(ControlTypes.ALLBUTCAMERAS, "WindowLock" + this.windowId); + if (HighLogic.LoadedSceneIsEditor) + { + EditorLogic.fetch.Lock(true, true, true, "WindowLock" + this.windowId); + InputLockManager.SetControlLock(ControlTypes.EDITOR_ICON_HOVER | + ControlTypes.EDITOR_ICON_PICK | + ControlTypes.EDITOR_TAB_SWITCH | + ControlTypes.EDITOR_PAD_PICK_PLACE | + ControlTypes.EDITOR_PAD_PICK_COPY | + ControlTypes.EDITOR_GIZMO_TOOLS | + ControlTypes.EDITOR_ROOT_REFLOW | + ControlTypes.EDITOR_SYM_SNAP_UI | + ControlTypes.EDITOR_UNDO_REDO, "EditorLock" + this.windowId); + } + } + else + { + DialogManager.Instance.UnregisterWindow(this); + if (InputLockManager.GetControlLock("WindowLock" + this.windowId) != ControlTypes.None) + InputLockManager.RemoveControlLock("WindowLock" + this.windowId); + if (InputLockManager.GetControlLock("EditorLock" + this.windowId) != ControlTypes.None) + InputLockManager.RemoveControlLock("EditorLock" + this.windowId); + } + } + + public void ToggleVisible() + { + SetVisible(!visible); + } + + public void SetSize(int width, int height) + { + windowPos.width = width; + windowPos.height = height; + } + + public virtual ConfigNode Load(ConfigNode config) + { + if (config.HasNode(configNodeName)) + { + ConfigNode windowConfig = config.GetNode(configNodeName); + + windowPos.x = DialogUtils.GetValue(windowConfig, "x", windowPos.x); + windowPos.y = DialogUtils.GetValue(windowConfig, "y", windowPos.y); + windowPos.width = DialogUtils.GetValue(windowConfig, "width", windowPos.width); + windowPos.height = DialogUtils.GetValue(windowConfig, "height", windowPos.height); + + bool newValue = DialogUtils.GetValue(windowConfig, "visible", visible); + SetVisible(newValue); + + return windowConfig; + } + else + { + return null; + } + } + + public virtual ConfigNode Save(ConfigNode config) + { + ConfigNode windowConfig; + if (config.HasNode(configNodeName)) + { + windowConfig = config.GetNode(configNodeName); + windowConfig.ClearData(); + } + else + { + windowConfig = config.AddNode(configNodeName); + } + + windowConfig.AddValue("visible", visible); + windowConfig.AddValue("x", windowPos.x); + windowConfig.AddValue("y", windowPos.y); + windowConfig.AddValue("width", windowPos.width); + windowConfig.AddValue("height", windowPos.height); + return windowConfig; + } + + //Note: parent object needs to call DrawWindow in its OnGUI method. + public virtual void DrawWindow() + { + if (visible) + { + bool paused = false; + if (HighLogic.LoadedSceneIsFlight) + { + try + { + paused = PauseMenu.isOpen || FlightResultsDialog.isDisplaying; + } + catch (Exception) + { + // ignore the error and assume the pause menu is not open + } + } + + if (!paused) + { + GUI.skin = HighLogic.Skin; + ConfigureStyles(); + + windowPos = DialogUtils.EnsureVisible(windowPos); + windowPos = GUILayout.Window(windowId, windowPos, PreDrawWindowContents, WindowTitle, GUILayout.ExpandWidth(true), + GUILayout.ExpandHeight(true), GUILayout.MinWidth(64), GUILayout.MinHeight(64)); + } + + Vector3 mousePosition = Input.mousePosition; + if (windowPos.Contains(mousePosition)) + { + InputLockManager.SetControlLock(ControlTypes.ALLBUTCAMERAS, "WindowLock" + this.windowId); + } + else + { + InputLockManager.RemoveControlLock("WindowLock" + this.windowId); + } + } + } + + protected virtual void ConfigureStyles() + { + if (closeButtonStyle == null) + { + closeButtonStyle = new GUIStyle(GUI.skin.button); + closeButtonStyle.padding = new RectOffset(5, 5, 3, 0); + closeButtonStyle.margin = new RectOffset(1, 1, 1, 1); + closeButtonStyle.stretchWidth = false; + closeButtonStyle.stretchHeight = false; + closeButtonStyle.alignment = TextAnchor.MiddleCenter; + + resizeStyle = new GUIStyle(GUI.skin.button); + resizeStyle.alignment = TextAnchor.MiddleCenter; + resizeStyle.padding = new RectOffset(1, 1, 1, 1); + } + } + + private void PreDrawWindowContents(int windowId) + { + DrawWindowContents(windowId); + + if (!HideCloseButton) + { + if (GUI.Button(new Rect(windowPos.width - 24, 4, 20, 20), "X", closeButtonStyle)) + { + SetVisible(false); + } + } + + if (Resizable) + { + var resizeRect = new Rect(windowPos.width - 16, windowPos.height - 16, 16, 16); + GUI.Label(resizeRect, resizeContent, resizeStyle); + + HandleWindowEvents(resizeRect); + } + +// preventClickthrough(); + + GUI.DragWindow(); + } + + protected abstract void DrawWindowContents(int windowId); + + private void HandleWindowEvents(Rect resizeRect) + { + var theEvent = Event.current; + if (theEvent != null) + { + if (!mouseDown) + { + if (theEvent.type == EventType.MouseDown && theEvent.button == 0 && resizeRect.Contains(theEvent.mousePosition)) + { + mouseDown = true; + theEvent.Use(); + } + } + else if (theEvent.type != EventType.Layout) + { + if (Input.GetMouseButton(0)) + { + // Flip the mouse Y so that 0 is at the top + float mouseY = Screen.height - Input.mousePosition.y; + + windowPos.width = Mathf.Clamp(Input.mousePosition.x - windowPos.x + (resizeRect.width / 2), 50, Screen.width - windowPos.x); + windowPos.height = Mathf.Clamp(mouseY - windowPos.y + (resizeRect.height / 2), 50, Screen.height - windowPos.y); + } + else + { + mouseDown = false; + } + } + } + } + } + +} diff --git a/source/Sandcastle/Utilities/DialogManager.cs b/source/Sandcastle/Utilities/DialogManager.cs new file mode 100644 index 0000000..71ccb7d --- /dev/null +++ b/source/Sandcastle/Utilities/DialogManager.cs @@ -0,0 +1,61 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using UnityEngine; +using KSP.IO; + +/* +Source code copyrighgt 2015, by Michael Billard (Angel-125) +License: GNU General Public License Version 3 +License URL: http://www.gnu.org/licenses/ +If you want to use this code, give me a shout on the KSP forums! :) +Wild Blue Industries is trademarked by Michael Billard and may be used for non-commercial purposes. All other rights reserved. +Note that Wild Blue Industries is a ficticious entity +created for entertainment purposes. It is in no way meant to represent a real entity. +Any similarity to a real entity is purely coincidental. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ +namespace Sandcastle +{ + [KSPAddon(KSPAddon.Startup.AllGameScenes, false)] + public class DialogManager : MonoBehaviour + { + + public static DialogManager Instance; + List managedWindows = new List(); + + public void Awake() + { + Instance = this; + } + + public void OnGUI() + { + int totalWindows = managedWindows.Count; + if (totalWindows == 0) + return; + IManagedWindow managedWindow; + + for (int index = 0; index < totalWindows; index++) + { + managedWindow = managedWindows[index]; + if (managedWindow.IsVisible()) + managedWindow.DrawWindow(); + } + } + + public void RegisterWindow(IManagedWindow managedWindow) + { + if (managedWindows.Contains(managedWindow) == false) + managedWindows.Add(managedWindow); + } + + public void UnregisterWindow(IManagedWindow managedWindow) + { + if (managedWindows.Contains(managedWindow)) + managedWindows.Remove(managedWindow); + } + } +} diff --git a/source/Sandcastle/Utilities/DialogUils.cs b/source/Sandcastle/Utilities/DialogUils.cs new file mode 100644 index 0000000..337618d --- /dev/null +++ b/source/Sandcastle/Utilities/DialogUils.cs @@ -0,0 +1,405 @@ +/* + * WindowUtils.cs + * + * Thunder Aerospace Corporation's library for the Kerbal Space Program, by Taranis Elsu + * + * (C) Copyright 2013, Taranis Elsu + * + * Kerbal Space Program is Copyright (C) 2013 Squad. See http://kerbalspaceprogram.com/. This + * project is in no way associated with nor endorsed by Squad. + * + * This code is licensed under the Attribution-NonCommercial-ShareAlike 3.0 (CC BY-NC-SA 3.0) + * creative commons license. See + * for full details. + * + * Attribution — You are free to modify this code, so long as you mention that the resulting + * work is based upon or adapted from this code. + * + * Non-commercial - You may not use this work for commercial purposes. + * + * Share Alike — If you alter, transform, or build upon this work, you may distribute the + * resulting work only under the same or similar license to the CC BY-NC-SA 3.0 license. + * + * Note that Thunder Aerospace Corporation is a ficticious entity created for entertainment + * purposes. It is in no way meant to represent a real entity. Any similarity to a real entity + * is purely coincidental. + */ + +using KSP.IO; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using UnityEngine; + +namespace Sandcastle +{ + public static class DialogUtils + { + const double SECONDS_PER_MINUTE = 60.0; + const double MINUTES_PER_HOUR = 60.0; + static double HOURS_PER_DAY = (GameSettings.KERBIN_TIME) ? 6.0 : 24.0; + public static double SECONDS_PER_DAY = SECONDS_PER_MINUTE*MINUTES_PER_HOUR*HOURS_PER_DAY; + + public static double ToDegrees(double radians) + { + return radians * 180.0 / Math.PI; + } + + public static double ToRadians(double degrees) + { + return degrees * Math.PI / 180.0; + } + + public static Rect EnsureVisible(Rect pos, float min = 16.0f) + { + float xMin = min - pos.width; + float xMax = Screen.width - min; + float yMin = min - pos.height; + float yMax = Screen.height - min; + + pos.x = Mathf.Clamp(pos.x, xMin, xMax); + pos.y = Mathf.Clamp(pos.y, yMin, yMax); + + return pos; + } + + public static Rect EnsureCompletelyVisible(Rect pos) + { + float xMin = 0; + float xMax = Screen.width - pos.width; + float yMin = 0; + float yMax = Screen.height - pos.height; + + pos.x = Mathf.Clamp(pos.x, xMin, xMax); + pos.y = Mathf.Clamp(pos.y, yMin, yMax); + + return pos; + } + + public static Rect ClampToScreenEdge(Rect pos) + { + float topSeparation = Math.Abs(pos.y); + float bottomSeparation = Math.Abs(Screen.height - pos.y - pos.height); + float leftSeparation = Math.Abs(pos.x); + float rightSeparation = Math.Abs(Screen.width - pos.x - pos.width); + + if (topSeparation <= bottomSeparation && topSeparation <= leftSeparation && topSeparation <= rightSeparation) + { + pos.y = 0; + } + else if (leftSeparation <= topSeparation && leftSeparation <= bottomSeparation && leftSeparation <= rightSeparation) + { + pos.x = 0; + } + else if (bottomSeparation <= topSeparation && bottomSeparation <= leftSeparation && bottomSeparation <= rightSeparation) + { + pos.y = Screen.height - pos.height; + } + else if (rightSeparation <= topSeparation && rightSeparation <= bottomSeparation && rightSeparation <= leftSeparation) + { + pos.x = Screen.width - pos.width; + } + + return pos; + } + + public static Texture2D LoadImage(string filename) + { + if (File.Exists(filename)) + { + var bytes = File.ReadAllBytes(filename); + Texture2D texture = new Texture2D(16, 16, TextureFormat.ARGB32, false); + texture.LoadRawTextureData(bytes); + return texture; + } + else + { + return null; + } + } + + public static bool GetValue(ConfigNode config, string name, bool currentValue) + { + bool newValue; + if (config.HasValue(name) && bool.TryParse(config.GetValue(name), out newValue)) + { + return newValue; + } + else + { + return currentValue; + } + } + + public static int GetValue(ConfigNode config, string name, int currentValue) + { + int newValue; + if (config.HasValue(name) && int.TryParse(config.GetValue(name), out newValue)) + { + return newValue; + } + else + { + return currentValue; + } + } + + public static float GetValue(ConfigNode config, string name, float currentValue) + { + float newValue; + if (config.HasValue(name) && float.TryParse(config.GetValue(name), out newValue)) + { + return newValue; + } + else + { + return currentValue; + } + } + + public static double GetValue(ConfigNode config, string name, double currentValue) + { + double newValue; + if (config.HasValue(name) && double.TryParse(config.GetValue(name), out newValue)) + { + return newValue; + } + else + { + return currentValue; + } + } + + public static string GetValue(ConfigNode config, string name, string currentValue) + { + if (config.HasValue(name)) + { + return config.GetValue(name); + } + else + { + return currentValue; + } + } + + public static T GetValue(ConfigNode config, string name, T currentValue) where T : IComparable, IFormattable, IConvertible + { + if (config.HasValue(name)) + { + string stringValue = config.GetValue(name); + if (Enum.IsDefined(typeof(T), stringValue)) + { + return (T)Enum.Parse(typeof(T), stringValue); + } + } + + return currentValue; + } + + public static double ShowTextField(string label, GUIStyle labelStyle, double currentValue, int maxLength, GUIStyle editStyle, params GUILayoutOption[] options) + { + GUILayout.BeginHorizontal(); + GUILayout.Label(label, labelStyle); + GUILayout.FlexibleSpace(); + string result = GUILayout.TextField(currentValue.ToString(), maxLength, editStyle, options); + GUILayout.EndHorizontal(); + + double newValue; + if (double.TryParse(result, out newValue)) + { + return newValue; + } + else + { + return currentValue; + } + } + + public static double ShowTextField(double currentValue, int maxLength, GUIStyle style, params GUILayoutOption[] options) + { + double newValue; + string result = GUILayout.TextField(currentValue.ToString(), maxLength, style, options); + if (double.TryParse(result, out newValue)) + { + return newValue; + } + else + { + return currentValue; + } + } + + public static float ShowTextField(float currentValue, int maxLength, GUIStyle style, params GUILayoutOption[] options) + { + float newValue; + string result = GUILayout.TextField(currentValue.ToString(), maxLength, style, options); + if (float.TryParse(result, out newValue)) + { + return newValue; + } + else + { + return currentValue; + } + } + + public static bool ShowToggle(string label, GUIStyle labelStyle, bool currentValue) + { + GUILayout.BeginHorizontal(); + GUILayout.Label(label, labelStyle); + GUILayout.FlexibleSpace(); + bool result = GUILayout.Toggle(currentValue, ""); + GUILayout.EndHorizontal(); + + return result; + } + + public static string FormatTime(double value, int numDecimals = 0) + { + + + string sign = ""; + if (value < 0.0) + { + sign = "-"; + value = -value; + } + + double seconds = value; + + long minutes = (long)(seconds / SECONDS_PER_MINUTE); + seconds -= (long)(minutes * SECONDS_PER_MINUTE); + + long hours = (long)(minutes / MINUTES_PER_HOUR); + minutes -= (long)(hours * MINUTES_PER_HOUR); + + long days = (long)(hours / HOURS_PER_DAY); + hours -= (long)(days * HOURS_PER_DAY); + + if (days > 0) + { + return sign + days.ToString("#0") + "d " + + hours.ToString("00") + ":" + + minutes.ToString("00") + ":" + + seconds.ToString("00"); + } + else if (hours > 0) + { + return sign + hours.ToString("#0") + ":" + + minutes.ToString("00") + ":" + + seconds.ToString("00"); + } + else + { + string format = "00"; + if (numDecimals > 0) + { + format += "." + new String('0', numDecimals); + } + + return sign + minutes.ToString("#0") + ":" + + seconds.ToString(format); + } + } + + public static string FormatValue(double value, int numDecimals = 2) + { + string sign = ""; + if (value < 0.0) + { + sign = "-"; + value = -value; + } + + string format = "0"; + if (numDecimals > 0) + { + format += "." + new String('0', numDecimals); + } + + if (value > 1000000000.0) + { + return sign + (value / 1000000000.0).ToString(format) + " G"; + } + else if (value > 1000000.0) + { + return sign + (value / 1000000.0).ToString(format) + " M"; + } + else if (value > 1000.0) + { + return sign + (value / 1000.0).ToString(format) + " k"; + } + else if (value < 0.000000001) + { + return sign + (value * 1000000000.0).ToString(format) + " n"; + } + else if (value < 0.000001) + { + return sign + (value * 1000000.0).ToString(format) + " µ"; + } + else if (value < 0.001) + { + return sign + (value * 1000.0).ToString(format) + " m"; + } + else + { + return sign + value.ToString(format) + " "; + } + } + + public static string GetDllVersion(T t) + { + System.Reflection.Assembly assembly = t.GetType().Assembly; + System.Diagnostics.FileVersionInfo fvi = System.Diagnostics.FileVersionInfo.GetVersionInfo(assembly.Location); + return fvi.FileVersion; + } + + public static GUIStyle GetVersionStyle() + { + GUIStyle versionStyle = new GUIStyle(GUI.skin.label); + versionStyle.alignment = TextAnchor.MiddleLeft; + versionStyle.fontSize = 10; + versionStyle.fontStyle = FontStyle.Normal; + versionStyle.normal.textColor = Color.white; + versionStyle.margin.top = 0; + versionStyle.margin.bottom = 0; + versionStyle.padding.top = 0; + versionStyle.padding.bottom = 0; + versionStyle.wordWrap = false; + return versionStyle; + } + //return a day-hour-minute-seconds-time format for the delivery time + public static string DeliveryTimeString(double deliveryTime, double currentTime) + { + int days; + int hours; + int minutes; + int seconds; + + double time; + if (deliveryTime > currentTime) + time = deliveryTime - currentTime; + else + time = currentTime - deliveryTime; + + + days = (int)Math.Floor(time / 21600); + time = time - (days * 21600); + + hours = (int)Math.Floor(time / 3600); + time = time - (hours * 3600); + + minutes = (int)Math.Floor(time / 60); + time = time - (minutes * 60); + + seconds = (int)Math.Floor(time); + + if (deliveryTime > currentTime) + return (days + "d" + hours + "h" + minutes + "m" + seconds + "s"); + else + return ("-" + days + "d" + hours + "h" + minutes + "m" + seconds + "s"); + + } + } +} diff --git a/source/Sandcastle/bin/Debug/Assembly-CSharp-firstpass.dll b/source/Sandcastle/bin/Debug/Assembly-CSharp-firstpass.dll new file mode 100644 index 0000000..3fa579e Binary files /dev/null and b/source/Sandcastle/bin/Debug/Assembly-CSharp-firstpass.dll differ diff --git a/source/Sandcastle/bin/Debug/Assembly-CSharp.dll b/source/Sandcastle/bin/Debug/Assembly-CSharp.dll new file mode 100644 index 0000000..1961860 Binary files /dev/null and b/source/Sandcastle/bin/Debug/Assembly-CSharp.dll differ diff --git a/source/Sandcastle/bin/Debug/Ionic.Zip.dll b/source/Sandcastle/bin/Debug/Ionic.Zip.dll new file mode 100644 index 0000000..95fa928 Binary files /dev/null and b/source/Sandcastle/bin/Debug/Ionic.Zip.dll differ diff --git a/source/Sandcastle/bin/Debug/KSPAssets.XmlSerializers.dll b/source/Sandcastle/bin/Debug/KSPAssets.XmlSerializers.dll new file mode 100644 index 0000000..f28444d Binary files /dev/null and b/source/Sandcastle/bin/Debug/KSPAssets.XmlSerializers.dll differ diff --git a/source/Sandcastle/bin/Debug/KSPAssets.dll b/source/Sandcastle/bin/Debug/KSPAssets.dll new file mode 100644 index 0000000..22a5a1a Binary files /dev/null and b/source/Sandcastle/bin/Debug/KSPAssets.dll differ diff --git a/source/Sandcastle/bin/Debug/KSPTrackIR.dll b/source/Sandcastle/bin/Debug/KSPTrackIR.dll new file mode 100644 index 0000000..1f876b2 Binary files /dev/null and b/source/Sandcastle/bin/Debug/KSPTrackIR.dll differ diff --git a/source/Sandcastle/bin/Debug/MarkdownSeparator.exe b/source/Sandcastle/bin/Debug/MarkdownSeparator.exe new file mode 100644 index 0000000..5cfe397 Binary files /dev/null and b/source/Sandcastle/bin/Debug/MarkdownSeparator.exe differ diff --git a/source/Sandcastle/bin/Debug/Mono.Cecil.dll b/source/Sandcastle/bin/Debug/Mono.Cecil.dll new file mode 100644 index 0000000..f55f7a5 Binary files /dev/null and b/source/Sandcastle/bin/Debug/Mono.Cecil.dll differ diff --git a/source/Sandcastle/bin/Debug/RunMDSeparator.bat b/source/Sandcastle/bin/Debug/RunMDSeparator.bat new file mode 100644 index 0000000..aeda80a --- /dev/null +++ b/source/Sandcastle/bin/Debug/RunMDSeparator.bat @@ -0,0 +1 @@ +MarkdownSeparator API.md Wiki \ No newline at end of file diff --git a/source/Sandcastle/bin/Debug/RunPowershell.bat b/source/Sandcastle/bin/Debug/RunPowershell.bat new file mode 100644 index 0000000..156d8ec --- /dev/null +++ b/source/Sandcastle/bin/Debug/RunPowershell.bat @@ -0,0 +1 @@ +Powershell.exe -ExecutionPolicy Unrestricted -file "xmldoc2md.ps1" -xml "xmldoc2md.xml" -xsl "xmldoc2md.xsl" -output "API.md" \ No newline at end of file diff --git a/source/Sandcastle/bin/Debug/Sandcastle.dll b/source/Sandcastle/bin/Debug/Sandcastle.dll new file mode 100644 index 0000000..d076160 Binary files /dev/null and b/source/Sandcastle/bin/Debug/Sandcastle.dll differ diff --git a/source/Sandcastle/bin/Debug/Sandcastle.pdb b/source/Sandcastle/bin/Debug/Sandcastle.pdb new file mode 100644 index 0000000..ab03904 Binary files /dev/null and b/source/Sandcastle/bin/Debug/Sandcastle.pdb differ diff --git a/source/Sandcastle/bin/Debug/TDx.TDxInput.dll b/source/Sandcastle/bin/Debug/TDx.TDxInput.dll new file mode 100644 index 0000000..b4a8b44 Binary files /dev/null and b/source/Sandcastle/bin/Debug/TDx.TDxInput.dll differ diff --git a/source/Sandcastle/bin/Debug/Unity.Analytics.DataPrivacy.dll b/source/Sandcastle/bin/Debug/Unity.Analytics.DataPrivacy.dll new file mode 100644 index 0000000..e269c5f Binary files /dev/null and b/source/Sandcastle/bin/Debug/Unity.Analytics.DataPrivacy.dll differ diff --git a/source/Sandcastle/bin/Debug/Unity.Analytics.StandardEvents.dll b/source/Sandcastle/bin/Debug/Unity.Analytics.StandardEvents.dll new file mode 100644 index 0000000..b8e7ea7 Binary files /dev/null and b/source/Sandcastle/bin/Debug/Unity.Analytics.StandardEvents.dll differ diff --git a/source/Sandcastle/bin/Debug/UnityEngine.AIModule.dll b/source/Sandcastle/bin/Debug/UnityEngine.AIModule.dll new file mode 100644 index 0000000..08a5cee Binary files /dev/null and b/source/Sandcastle/bin/Debug/UnityEngine.AIModule.dll differ diff --git a/source/Sandcastle/bin/Debug/UnityEngine.ARModule.dll b/source/Sandcastle/bin/Debug/UnityEngine.ARModule.dll new file mode 100644 index 0000000..a84c32c Binary files /dev/null and b/source/Sandcastle/bin/Debug/UnityEngine.ARModule.dll differ diff --git a/source/Sandcastle/bin/Debug/UnityEngine.AccessibilityModule.dll b/source/Sandcastle/bin/Debug/UnityEngine.AccessibilityModule.dll new file mode 100644 index 0000000..7a288c0 Binary files /dev/null and b/source/Sandcastle/bin/Debug/UnityEngine.AccessibilityModule.dll differ diff --git a/source/Sandcastle/bin/Debug/UnityEngine.AndroidJNIModule.dll b/source/Sandcastle/bin/Debug/UnityEngine.AndroidJNIModule.dll new file mode 100644 index 0000000..2a73c5a Binary files /dev/null and b/source/Sandcastle/bin/Debug/UnityEngine.AndroidJNIModule.dll differ diff --git a/source/Sandcastle/bin/Debug/UnityEngine.AnimationModule.dll b/source/Sandcastle/bin/Debug/UnityEngine.AnimationModule.dll new file mode 100644 index 0000000..cdc6db0 Binary files /dev/null and b/source/Sandcastle/bin/Debug/UnityEngine.AnimationModule.dll differ diff --git a/source/Sandcastle/bin/Debug/UnityEngine.AssetBundleModule.dll b/source/Sandcastle/bin/Debug/UnityEngine.AssetBundleModule.dll new file mode 100644 index 0000000..1384caa Binary files /dev/null and b/source/Sandcastle/bin/Debug/UnityEngine.AssetBundleModule.dll differ diff --git a/source/Sandcastle/bin/Debug/UnityEngine.AudioModule.dll b/source/Sandcastle/bin/Debug/UnityEngine.AudioModule.dll new file mode 100644 index 0000000..e459887 Binary files /dev/null and b/source/Sandcastle/bin/Debug/UnityEngine.AudioModule.dll differ diff --git a/source/Sandcastle/bin/Debug/UnityEngine.ClothModule.dll b/source/Sandcastle/bin/Debug/UnityEngine.ClothModule.dll new file mode 100644 index 0000000..8f5ce4d Binary files /dev/null and b/source/Sandcastle/bin/Debug/UnityEngine.ClothModule.dll differ diff --git a/source/Sandcastle/bin/Debug/UnityEngine.ClusterInputModule.dll b/source/Sandcastle/bin/Debug/UnityEngine.ClusterInputModule.dll new file mode 100644 index 0000000..ccabd89 Binary files /dev/null and b/source/Sandcastle/bin/Debug/UnityEngine.ClusterInputModule.dll differ diff --git a/source/Sandcastle/bin/Debug/UnityEngine.ClusterRendererModule.dll b/source/Sandcastle/bin/Debug/UnityEngine.ClusterRendererModule.dll new file mode 100644 index 0000000..bf12d7b Binary files /dev/null and b/source/Sandcastle/bin/Debug/UnityEngine.ClusterRendererModule.dll differ diff --git a/source/Sandcastle/bin/Debug/UnityEngine.CoreModule.dll b/source/Sandcastle/bin/Debug/UnityEngine.CoreModule.dll new file mode 100644 index 0000000..908e3c8 Binary files /dev/null and b/source/Sandcastle/bin/Debug/UnityEngine.CoreModule.dll differ diff --git a/source/Sandcastle/bin/Debug/UnityEngine.CrashReportingModule.dll b/source/Sandcastle/bin/Debug/UnityEngine.CrashReportingModule.dll new file mode 100644 index 0000000..2108c82 Binary files /dev/null and b/source/Sandcastle/bin/Debug/UnityEngine.CrashReportingModule.dll differ diff --git a/source/Sandcastle/bin/Debug/UnityEngine.DSPGraphModule.dll b/source/Sandcastle/bin/Debug/UnityEngine.DSPGraphModule.dll new file mode 100644 index 0000000..25f982e Binary files /dev/null and b/source/Sandcastle/bin/Debug/UnityEngine.DSPGraphModule.dll differ diff --git a/source/Sandcastle/bin/Debug/UnityEngine.DirectorModule.dll b/source/Sandcastle/bin/Debug/UnityEngine.DirectorModule.dll new file mode 100644 index 0000000..e4544e7 Binary files /dev/null and b/source/Sandcastle/bin/Debug/UnityEngine.DirectorModule.dll differ diff --git a/source/Sandcastle/bin/Debug/UnityEngine.GameCenterModule.dll b/source/Sandcastle/bin/Debug/UnityEngine.GameCenterModule.dll new file mode 100644 index 0000000..c4d2044 Binary files /dev/null and b/source/Sandcastle/bin/Debug/UnityEngine.GameCenterModule.dll differ diff --git a/source/Sandcastle/bin/Debug/UnityEngine.GridModule.dll b/source/Sandcastle/bin/Debug/UnityEngine.GridModule.dll new file mode 100644 index 0000000..6f9df6a Binary files /dev/null and b/source/Sandcastle/bin/Debug/UnityEngine.GridModule.dll differ diff --git a/source/Sandcastle/bin/Debug/UnityEngine.IMGUIModule.dll b/source/Sandcastle/bin/Debug/UnityEngine.IMGUIModule.dll new file mode 100644 index 0000000..f1d0b5f Binary files /dev/null and b/source/Sandcastle/bin/Debug/UnityEngine.IMGUIModule.dll differ diff --git a/source/Sandcastle/bin/Debug/UnityEngine.ImageConversionModule.dll b/source/Sandcastle/bin/Debug/UnityEngine.ImageConversionModule.dll new file mode 100644 index 0000000..8bd6acb Binary files /dev/null and b/source/Sandcastle/bin/Debug/UnityEngine.ImageConversionModule.dll differ diff --git a/source/Sandcastle/bin/Debug/UnityEngine.InputLegacyModule.dll b/source/Sandcastle/bin/Debug/UnityEngine.InputLegacyModule.dll new file mode 100644 index 0000000..728614c Binary files /dev/null and b/source/Sandcastle/bin/Debug/UnityEngine.InputLegacyModule.dll differ diff --git a/source/Sandcastle/bin/Debug/UnityEngine.InputModule.dll b/source/Sandcastle/bin/Debug/UnityEngine.InputModule.dll new file mode 100644 index 0000000..4642b98 Binary files /dev/null and b/source/Sandcastle/bin/Debug/UnityEngine.InputModule.dll differ diff --git a/source/Sandcastle/bin/Debug/UnityEngine.JSONSerializeModule.dll b/source/Sandcastle/bin/Debug/UnityEngine.JSONSerializeModule.dll new file mode 100644 index 0000000..26f19b4 Binary files /dev/null and b/source/Sandcastle/bin/Debug/UnityEngine.JSONSerializeModule.dll differ diff --git a/source/Sandcastle/bin/Debug/UnityEngine.LocalizationModule.dll b/source/Sandcastle/bin/Debug/UnityEngine.LocalizationModule.dll new file mode 100644 index 0000000..deef003 Binary files /dev/null and b/source/Sandcastle/bin/Debug/UnityEngine.LocalizationModule.dll differ diff --git a/source/Sandcastle/bin/Debug/UnityEngine.ParticleSystemModule.dll b/source/Sandcastle/bin/Debug/UnityEngine.ParticleSystemModule.dll new file mode 100644 index 0000000..b0028a8 Binary files /dev/null and b/source/Sandcastle/bin/Debug/UnityEngine.ParticleSystemModule.dll differ diff --git a/source/Sandcastle/bin/Debug/UnityEngine.PerformanceReportingModule.dll b/source/Sandcastle/bin/Debug/UnityEngine.PerformanceReportingModule.dll new file mode 100644 index 0000000..c259518 Binary files /dev/null and b/source/Sandcastle/bin/Debug/UnityEngine.PerformanceReportingModule.dll differ diff --git a/source/Sandcastle/bin/Debug/UnityEngine.Physics2DModule.dll b/source/Sandcastle/bin/Debug/UnityEngine.Physics2DModule.dll new file mode 100644 index 0000000..e57970b Binary files /dev/null and b/source/Sandcastle/bin/Debug/UnityEngine.Physics2DModule.dll differ diff --git a/source/Sandcastle/bin/Debug/UnityEngine.PhysicsModule.dll b/source/Sandcastle/bin/Debug/UnityEngine.PhysicsModule.dll new file mode 100644 index 0000000..207949f Binary files /dev/null and b/source/Sandcastle/bin/Debug/UnityEngine.PhysicsModule.dll differ diff --git a/source/Sandcastle/bin/Debug/UnityEngine.ScreenCaptureModule.dll b/source/Sandcastle/bin/Debug/UnityEngine.ScreenCaptureModule.dll new file mode 100644 index 0000000..ebd8202 Binary files /dev/null and b/source/Sandcastle/bin/Debug/UnityEngine.ScreenCaptureModule.dll differ diff --git a/source/Sandcastle/bin/Debug/UnityEngine.SharedInternalsModule.dll b/source/Sandcastle/bin/Debug/UnityEngine.SharedInternalsModule.dll new file mode 100644 index 0000000..80733d0 Binary files /dev/null and b/source/Sandcastle/bin/Debug/UnityEngine.SharedInternalsModule.dll differ diff --git a/source/Sandcastle/bin/Debug/UnityEngine.SpriteMaskModule.dll b/source/Sandcastle/bin/Debug/UnityEngine.SpriteMaskModule.dll new file mode 100644 index 0000000..93bfc60 Binary files /dev/null and b/source/Sandcastle/bin/Debug/UnityEngine.SpriteMaskModule.dll differ diff --git a/source/Sandcastle/bin/Debug/UnityEngine.SpriteShapeModule.dll b/source/Sandcastle/bin/Debug/UnityEngine.SpriteShapeModule.dll new file mode 100644 index 0000000..377034a Binary files /dev/null and b/source/Sandcastle/bin/Debug/UnityEngine.SpriteShapeModule.dll differ diff --git a/source/Sandcastle/bin/Debug/UnityEngine.StreamingModule.dll b/source/Sandcastle/bin/Debug/UnityEngine.StreamingModule.dll new file mode 100644 index 0000000..82c6dd6 Binary files /dev/null and b/source/Sandcastle/bin/Debug/UnityEngine.StreamingModule.dll differ diff --git a/source/Sandcastle/bin/Debug/UnityEngine.TerrainModule.dll b/source/Sandcastle/bin/Debug/UnityEngine.TerrainModule.dll new file mode 100644 index 0000000..e0ae7d1 Binary files /dev/null and b/source/Sandcastle/bin/Debug/UnityEngine.TerrainModule.dll differ diff --git a/source/Sandcastle/bin/Debug/UnityEngine.TerrainPhysicsModule.dll b/source/Sandcastle/bin/Debug/UnityEngine.TerrainPhysicsModule.dll new file mode 100644 index 0000000..1174bc2 Binary files /dev/null and b/source/Sandcastle/bin/Debug/UnityEngine.TerrainPhysicsModule.dll differ diff --git a/source/Sandcastle/bin/Debug/UnityEngine.TextCoreModule.dll b/source/Sandcastle/bin/Debug/UnityEngine.TextCoreModule.dll new file mode 100644 index 0000000..878a1f6 Binary files /dev/null and b/source/Sandcastle/bin/Debug/UnityEngine.TextCoreModule.dll differ diff --git a/source/Sandcastle/bin/Debug/UnityEngine.TextRenderingModule.dll b/source/Sandcastle/bin/Debug/UnityEngine.TextRenderingModule.dll new file mode 100644 index 0000000..a0ee03b Binary files /dev/null and b/source/Sandcastle/bin/Debug/UnityEngine.TextRenderingModule.dll differ diff --git a/source/Sandcastle/bin/Debug/UnityEngine.TilemapModule.dll b/source/Sandcastle/bin/Debug/UnityEngine.TilemapModule.dll new file mode 100644 index 0000000..1f3106f Binary files /dev/null and b/source/Sandcastle/bin/Debug/UnityEngine.TilemapModule.dll differ diff --git a/source/Sandcastle/bin/Debug/UnityEngine.UI.dll b/source/Sandcastle/bin/Debug/UnityEngine.UI.dll new file mode 100644 index 0000000..f949722 Binary files /dev/null and b/source/Sandcastle/bin/Debug/UnityEngine.UI.dll differ diff --git a/source/Sandcastle/bin/Debug/UnityEngine.UIElementsModule.dll b/source/Sandcastle/bin/Debug/UnityEngine.UIElementsModule.dll new file mode 100644 index 0000000..3e0db93 Binary files /dev/null and b/source/Sandcastle/bin/Debug/UnityEngine.UIElementsModule.dll differ diff --git a/source/Sandcastle/bin/Debug/UnityEngine.UIModule.dll b/source/Sandcastle/bin/Debug/UnityEngine.UIModule.dll new file mode 100644 index 0000000..0f24b24 Binary files /dev/null and b/source/Sandcastle/bin/Debug/UnityEngine.UIModule.dll differ diff --git a/source/Sandcastle/bin/Debug/UnityEngine.UNETModule.dll b/source/Sandcastle/bin/Debug/UnityEngine.UNETModule.dll new file mode 100644 index 0000000..90e6429 Binary files /dev/null and b/source/Sandcastle/bin/Debug/UnityEngine.UNETModule.dll differ diff --git a/source/Sandcastle/bin/Debug/UnityEngine.UnityAnalyticsModule.dll b/source/Sandcastle/bin/Debug/UnityEngine.UnityAnalyticsModule.dll new file mode 100644 index 0000000..04c4e74 Binary files /dev/null and b/source/Sandcastle/bin/Debug/UnityEngine.UnityAnalyticsModule.dll differ diff --git a/source/Sandcastle/bin/Debug/UnityEngine.UnityConnectModule.dll b/source/Sandcastle/bin/Debug/UnityEngine.UnityConnectModule.dll new file mode 100644 index 0000000..4da27d0 Binary files /dev/null and b/source/Sandcastle/bin/Debug/UnityEngine.UnityConnectModule.dll differ diff --git a/source/Sandcastle/bin/Debug/UnityEngine.UnityWebRequestAssetBundleModule.dll b/source/Sandcastle/bin/Debug/UnityEngine.UnityWebRequestAssetBundleModule.dll new file mode 100644 index 0000000..1194ccb Binary files /dev/null and b/source/Sandcastle/bin/Debug/UnityEngine.UnityWebRequestAssetBundleModule.dll differ diff --git a/source/Sandcastle/bin/Debug/UnityEngine.UnityWebRequestAudioModule.dll b/source/Sandcastle/bin/Debug/UnityEngine.UnityWebRequestAudioModule.dll new file mode 100644 index 0000000..8f23dbc Binary files /dev/null and b/source/Sandcastle/bin/Debug/UnityEngine.UnityWebRequestAudioModule.dll differ diff --git a/source/Sandcastle/bin/Debug/UnityEngine.UnityWebRequestModule.dll b/source/Sandcastle/bin/Debug/UnityEngine.UnityWebRequestModule.dll new file mode 100644 index 0000000..5ab8f31 Binary files /dev/null and b/source/Sandcastle/bin/Debug/UnityEngine.UnityWebRequestModule.dll differ diff --git a/source/Sandcastle/bin/Debug/UnityEngine.UnityWebRequestTextureModule.dll b/source/Sandcastle/bin/Debug/UnityEngine.UnityWebRequestTextureModule.dll new file mode 100644 index 0000000..3a5adf9 Binary files /dev/null and b/source/Sandcastle/bin/Debug/UnityEngine.UnityWebRequestTextureModule.dll differ diff --git a/source/Sandcastle/bin/Debug/UnityEngine.UnityWebRequestWWWModule.dll b/source/Sandcastle/bin/Debug/UnityEngine.UnityWebRequestWWWModule.dll new file mode 100644 index 0000000..f11f4cd Binary files /dev/null and b/source/Sandcastle/bin/Debug/UnityEngine.UnityWebRequestWWWModule.dll differ diff --git a/source/Sandcastle/bin/Debug/UnityEngine.VFXModule.dll b/source/Sandcastle/bin/Debug/UnityEngine.VFXModule.dll new file mode 100644 index 0000000..bb07597 Binary files /dev/null and b/source/Sandcastle/bin/Debug/UnityEngine.VFXModule.dll differ diff --git a/source/Sandcastle/bin/Debug/UnityEngine.VRModule.dll b/source/Sandcastle/bin/Debug/UnityEngine.VRModule.dll new file mode 100644 index 0000000..865e268 Binary files /dev/null and b/source/Sandcastle/bin/Debug/UnityEngine.VRModule.dll differ diff --git a/source/Sandcastle/bin/Debug/UnityEngine.VehiclesModule.dll b/source/Sandcastle/bin/Debug/UnityEngine.VehiclesModule.dll new file mode 100644 index 0000000..211f1de Binary files /dev/null and b/source/Sandcastle/bin/Debug/UnityEngine.VehiclesModule.dll differ diff --git a/source/Sandcastle/bin/Debug/UnityEngine.VideoModule.dll b/source/Sandcastle/bin/Debug/UnityEngine.VideoModule.dll new file mode 100644 index 0000000..5707566 Binary files /dev/null and b/source/Sandcastle/bin/Debug/UnityEngine.VideoModule.dll differ diff --git a/source/Sandcastle/bin/Debug/UnityEngine.WindModule.dll b/source/Sandcastle/bin/Debug/UnityEngine.WindModule.dll new file mode 100644 index 0000000..7d9b4b2 Binary files /dev/null and b/source/Sandcastle/bin/Debug/UnityEngine.WindModule.dll differ diff --git a/source/Sandcastle/bin/Debug/UnityEngine.XRModule.dll b/source/Sandcastle/bin/Debug/UnityEngine.XRModule.dll new file mode 100644 index 0000000..502e47d Binary files /dev/null and b/source/Sandcastle/bin/Debug/UnityEngine.XRModule.dll differ diff --git a/source/Sandcastle/bin/Debug/UnityEngine.dll b/source/Sandcastle/bin/Debug/UnityEngine.dll new file mode 100644 index 0000000..bc73a68 Binary files /dev/null and b/source/Sandcastle/bin/Debug/UnityEngine.dll differ diff --git a/source/Sandcastle/bin/Debug/xmldoc2md.ps1 b/source/Sandcastle/bin/Debug/xmldoc2md.ps1 new file mode 100644 index 0000000..f1cebc0 --- /dev/null +++ b/source/Sandcastle/bin/Debug/xmldoc2md.ps1 @@ -0,0 +1,18 @@ +# xmldoc2md.ps1 +# By Jaime Olivares +# URL: http://github.com/jaime-olivares/xmldoc2md + +param ( + [string]$xml = $(throw "-xml is required."), + [string]$xsl = $(throw "-xsl is required."), + [string]$output = $(throw "-output is required.") +) + +# var = new XslCompiledTransform(true); +$xslt = New-Object -TypeName "System.Xml.Xsl.XslCompiledTransform" + +# xslt.Load(stylesheet); +$xslt.Load($xsl) + +# xslt.Transform(sourceFile, null, sw); +$xslt.Transform($xml, $output) diff --git a/source/Sandcastle/bin/Debug/xmldoc2md.xml b/source/Sandcastle/bin/Debug/xmldoc2md.xml new file mode 100644 index 0000000..e60aabd --- /dev/null +++ b/source/Sandcastle/bin/Debug/xmldoc2md.xml @@ -0,0 +1,342 @@ + + + + Sandcastle + + + + + An inventory helper class + + + + + Gets an inventory with enough storage space and storage mass for the desired part. + + The vessel to query. + The AvailablePart to check for space. + A ModuleInventoryPart if space can be found or null if not. + + + + Determines whether or not the supplied inventory has space for the desired part. + + A ModuleInventoryPart to check for space. + An AvailablePart to check to see if it fits. + true if the inventory has space for the part, false if not. + + + + Determines whether or not the vessel has enough storage space. + + The vessel to query + The AvailablePart to check for space. + true if there is enough space, false if not. + + + + Determines whether or not the vessel has the item in question. + + The vessel to query. + The name of the part to look for + true if the vessel has the part, false if not. + + + + Removes the item from the vessel if it exists. + + The vessel to query. + The name of the part to remove. + + + + Adds the item to the vessel inventory if there is enough room. + + The vessel to query. + The part to add to the inventory + The preferred inventory to store the part in. + The Part that the item was stored in, or null if no place could be found for the part. + + + + Searches the game folder for thumbnail images. + + + + + Retrieves the thumbnail texture that depicts the specified part name. + + A string containing the name of the part. + A Texture2D if the texture exists, or a blank texture if not. + + + + Retrieves a list of parts that can be printed by the specified max print volume. + + A float containing the max possible print volume. + A List of AvailablePart objects that can be printed. + + + + Retrieves the thumbnail texture that depicts the specified part name. + + A string containing the name of the part. + A Texture2D if the texture exists, or a blank texture if not. + + + + Callback to let the controller know about the print state. + + + + + Represents the Print Shop UI + + + + + Title of the selection dialog. + + + + + Complete list of printable parts. + + + + + Represents the list of build items to print. + + + + + Status of the current print job. + + + + + Callback to let the controller know about the print state. + + + + + Flag indicating that the printer is printing + + + + + The Part associated with the UI. + + + + + Toggles window visibility + + A flag indicating whether the window shoudld be visible or not. + + + + Draws the window + + An int representing the window ID. + + + + Represents an item that needs to be built. + + + + + Build item node identifier + + + + + Name of the part being built. + + + + + The Available part representing the build item. + + + + + List of resource materials required. Rate in this context represents the amount of the resource required in order to complete the part. + + + + + List of parts required to complete the build item. The parts must be in the vessel inventory. + + + + + Total units required to produce the item, determined from all required resources. + + + + + Total units printed to date, determined from all required resources. + + + + + Constructs a new build item from the supplied config node. + + A ConfigNode containing data for the build item. + + + + Constructs a build item from the supplied available part. + + The AvailablePart to base the build item on. + + + + Saves the build item. + + A ConfigNode containing serialized data. + + + + Represents a list of resources needed to build an item of a particular part category. + + + + + Node ID for a materials list. + + + + + Node ID for tech node materials. Parts in a specific tech node can require additional materials. + + + + + Name of the default materials list. + + + + + Represents a resource node. + + + + + Name of the materials list. This should correspond to one of the part categories. + + + + + List of resource materials required. + + + + + Loads the materials lists that specify what materials are required to produce an item from a particular category. + + A Dictionary containing the list names as keys and MaterialList objects as values. + + + + A map of all materials lists, keyed by part category name. + + + + + Returns the materials list for the requested category, or the default list if the list for the requested category doesn't exist. + + A string containing the desired category. + A MaterialsList if one exists for the desired category, or the default list. + + + + Creates the default materials list. + + A MaterialsList containing the default materials. + + + + Lists the different printer states + + + + + Printer is idle, nothing to print. + + + + + Printer has an item to print but is paused. + + + + + Printer is printing something. + + + + + Represents a shop that is capable of printing items and placing them in an available inventory. + + + + + A flag to enable/disable debug mode. + + + + + The maximum volume that the printer can print, in liters. Set to less than 0 for no restrictions. + + + + + The number of resource units per second that the printer can print. + + + + + Flag to indicate whether or not to allow specialists to improve the print speed. Exactly how the specialist(s) does that is a trade secret. + + + + + Per experience rating, how much to improve the print speed by. + The print shop part must have crew capacity. + + + + + The skill required to improve the print speed. + + + + + Name of the effect to play from the part's EFFECTS node when the printer is running. + + + + + Represents the list of build items to print. + + + + + Current state of the printer. + + + + + Describes when the printer was last updated. + + + + + Current job being printed. + + + + diff --git a/source/Sandcastle/bin/Debug/xmldoc2md.xsl b/source/Sandcastle/bin/Debug/xmldoc2md.xsl new file mode 100644 index 0000000..8940b4d --- /dev/null +++ b/source/Sandcastle/bin/Debug/xmldoc2md.xsl @@ -0,0 +1,182 @@ + + + + + + + + + + + + # + + + + + + + + + + + + + + + + + + + + + # + + + + + + + ## Fields + + + + ### + + + + + + + + + ## Properties + + + + ### + + + + + + + + + ## Methods + + + + + + + + ### Constructor + + + + + ### + + + + + + + + + + + + + + > #### Parameters + + + + + > #### Return value + + + + + > #### Exceptions + + + + + > #### Example + > + + + + + + + + + + + + + + + + + + ` + + ` + + + + ``` + + ``` + + + + > **:** + + + + [External file]({@file}) + + + + + + + + > **:** + + + + * + + * + + + + **Permission:** ** + + + + > + + + + + > *See: * + + + + > *See also: + + + + diff --git a/source/Sandcastle/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache b/source/Sandcastle/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache new file mode 100644 index 0000000..8ff4f47 Binary files /dev/null and b/source/Sandcastle/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache differ diff --git a/source/Sandcastle/obj/Debug/Sandcastle.csproj.CopyComplete b/source/Sandcastle/obj/Debug/Sandcastle.csproj.CopyComplete new file mode 100644 index 0000000..e69de29 diff --git a/source/Sandcastle/obj/Debug/Sandcastle.csproj.CoreCompileInputs.cache b/source/Sandcastle/obj/Debug/Sandcastle.csproj.CoreCompileInputs.cache new file mode 100644 index 0000000..de2db6e --- /dev/null +++ b/source/Sandcastle/obj/Debug/Sandcastle.csproj.CoreCompileInputs.cache @@ -0,0 +1 @@ +f6cbeeac25b24327b4a5d93583fe9194b60a9289 diff --git a/source/Sandcastle/obj/Debug/Sandcastle.csproj.FileListAbsolute.txt b/source/Sandcastle/obj/Debug/Sandcastle.csproj.FileListAbsolute.txt new file mode 100644 index 0000000..05cb5b2 --- /dev/null +++ b/source/Sandcastle/obj/Debug/Sandcastle.csproj.FileListAbsolute.txt @@ -0,0 +1,77 @@ +C:\Projects\KSP\WildBlueIndustries\Sandcastle\source\Sandcastle\obj\Debug\Sandcastle.csprojAssemblyReference.cache +C:\Projects\KSP\WildBlueIndustries\Sandcastle\source\Sandcastle\obj\Debug\Sandcastle.csproj.CoreCompileInputs.cache +C:\Projects\KSP\WildBlueIndustries\Sandcastle\source\Sandcastle\bin\Debug\MarkdownSeparator.exe +C:\Projects\KSP\WildBlueIndustries\Sandcastle\source\Sandcastle\bin\Debug\xmldoc2md.xsl +C:\Projects\KSP\WildBlueIndustries\Sandcastle\source\Sandcastle\bin\Debug\RunMDSeparator.bat +C:\Projects\KSP\WildBlueIndustries\Sandcastle\source\Sandcastle\bin\Debug\RunPowershell.bat +C:\Projects\KSP\WildBlueIndustries\Sandcastle\source\Sandcastle\bin\Debug\xmldoc2md.ps1 +C:\Projects\KSP\WildBlueIndustries\Sandcastle\source\Sandcastle\bin\Debug\xmldoc2md.xml +C:\Projects\KSP\WildBlueIndustries\Sandcastle\source\Sandcastle\bin\Debug\Sandcastle.dll +C:\Projects\KSP\WildBlueIndustries\Sandcastle\source\Sandcastle\bin\Debug\Sandcastle.pdb +C:\Projects\KSP\WildBlueIndustries\Sandcastle\source\Sandcastle\bin\Debug\Assembly-CSharp-firstpass.dll +C:\Projects\KSP\WildBlueIndustries\Sandcastle\source\Sandcastle\bin\Debug\Assembly-CSharp.dll +C:\Projects\KSP\WildBlueIndustries\Sandcastle\source\Sandcastle\bin\Debug\KSPAssets.dll +C:\Projects\KSP\WildBlueIndustries\Sandcastle\source\Sandcastle\bin\Debug\UnityEngine.AnimationModule.dll +C:\Projects\KSP\WildBlueIndustries\Sandcastle\source\Sandcastle\bin\Debug\UnityEngine.AudioModule.dll +C:\Projects\KSP\WildBlueIndustries\Sandcastle\source\Sandcastle\bin\Debug\UnityEngine.CoreModule.dll +C:\Projects\KSP\WildBlueIndustries\Sandcastle\source\Sandcastle\bin\Debug\UnityEngine.dll +C:\Projects\KSP\WildBlueIndustries\Sandcastle\source\Sandcastle\bin\Debug\UnityEngine.ImageConversionModule.dll +C:\Projects\KSP\WildBlueIndustries\Sandcastle\source\Sandcastle\bin\Debug\UnityEngine.IMGUIModule.dll +C:\Projects\KSP\WildBlueIndustries\Sandcastle\source\Sandcastle\bin\Debug\UnityEngine.InputLegacyModule.dll +C:\Projects\KSP\WildBlueIndustries\Sandcastle\source\Sandcastle\bin\Debug\UnityEngine.PhysicsModule.dll +C:\Projects\KSP\WildBlueIndustries\Sandcastle\source\Sandcastle\bin\Debug\UnityEngine.TextRenderingModule.dll +C:\Projects\KSP\WildBlueIndustries\Sandcastle\source\Sandcastle\bin\Debug\UnityEngine.UI.dll +C:\Projects\KSP\WildBlueIndustries\Sandcastle\source\Sandcastle\bin\Debug\UnityEngine.UIElementsModule.dll +C:\Projects\KSP\WildBlueIndustries\Sandcastle\source\Sandcastle\bin\Debug\UnityEngine.UIModule.dll +C:\Projects\KSP\WildBlueIndustries\Sandcastle\source\Sandcastle\bin\Debug\UnityEngine.UnityWebRequestWWWModule.dll +C:\Projects\KSP\WildBlueIndustries\Sandcastle\source\Sandcastle\bin\Debug\UnityEngine.ParticleSystemModule.dll +C:\Projects\KSP\WildBlueIndustries\Sandcastle\source\Sandcastle\bin\Debug\UnityEngine.UnityWebRequestModule.dll +C:\Projects\KSP\WildBlueIndustries\Sandcastle\source\Sandcastle\bin\Debug\KSPTrackIR.dll +C:\Projects\KSP\WildBlueIndustries\Sandcastle\source\Sandcastle\bin\Debug\UnityEngine.AssetBundleModule.dll +C:\Projects\KSP\WildBlueIndustries\Sandcastle\source\Sandcastle\bin\Debug\Mono.Cecil.dll +C:\Projects\KSP\WildBlueIndustries\Sandcastle\source\Sandcastle\bin\Debug\UnityEngine.VehiclesModule.dll +C:\Projects\KSP\WildBlueIndustries\Sandcastle\source\Sandcastle\bin\Debug\Ionic.Zip.dll +C:\Projects\KSP\WildBlueIndustries\Sandcastle\source\Sandcastle\bin\Debug\Unity.Analytics.DataPrivacy.dll +C:\Projects\KSP\WildBlueIndustries\Sandcastle\source\Sandcastle\bin\Debug\UnityEngine.ScreenCaptureModule.dll +C:\Projects\KSP\WildBlueIndustries\Sandcastle\source\Sandcastle\bin\Debug\Unity.Analytics.StandardEvents.dll +C:\Projects\KSP\WildBlueIndustries\Sandcastle\source\Sandcastle\bin\Debug\UnityEngine.UnityAnalyticsModule.dll +C:\Projects\KSP\WildBlueIndustries\Sandcastle\source\Sandcastle\bin\Debug\UnityEngine.VRModule.dll +C:\Projects\KSP\WildBlueIndustries\Sandcastle\source\Sandcastle\bin\Debug\UnityEngine.UnityWebRequestTextureModule.dll +C:\Projects\KSP\WildBlueIndustries\Sandcastle\source\Sandcastle\bin\Debug\UnityEngine.UnityWebRequestAudioModule.dll +C:\Projects\KSP\WildBlueIndustries\Sandcastle\source\Sandcastle\bin\Debug\UnityEngine.UnityWebRequestAssetBundleModule.dll +C:\Projects\KSP\WildBlueIndustries\Sandcastle\source\Sandcastle\bin\Debug\TDx.TDxInput.dll +C:\Projects\KSP\WildBlueIndustries\Sandcastle\source\Sandcastle\bin\Debug\UnityEngine.Physics2DModule.dll +C:\Projects\KSP\WildBlueIndustries\Sandcastle\source\Sandcastle\bin\Debug\UnityEngine.SharedInternalsModule.dll +C:\Projects\KSP\WildBlueIndustries\Sandcastle\source\Sandcastle\bin\Debug\UnityEngine.AccessibilityModule.dll +C:\Projects\KSP\WildBlueIndustries\Sandcastle\source\Sandcastle\bin\Debug\UnityEngine.AIModule.dll +C:\Projects\KSP\WildBlueIndustries\Sandcastle\source\Sandcastle\bin\Debug\UnityEngine.AndroidJNIModule.dll +C:\Projects\KSP\WildBlueIndustries\Sandcastle\source\Sandcastle\bin\Debug\UnityEngine.ClusterInputModule.dll +C:\Projects\KSP\WildBlueIndustries\Sandcastle\source\Sandcastle\bin\Debug\UnityEngine.DirectorModule.dll +C:\Projects\KSP\WildBlueIndustries\Sandcastle\source\Sandcastle\bin\Debug\UnityEngine.DSPGraphModule.dll +C:\Projects\KSP\WildBlueIndustries\Sandcastle\source\Sandcastle\bin\Debug\UnityEngine.GridModule.dll +C:\Projects\KSP\WildBlueIndustries\Sandcastle\source\Sandcastle\bin\Debug\UnityEngine.JSONSerializeModule.dll +C:\Projects\KSP\WildBlueIndustries\Sandcastle\source\Sandcastle\bin\Debug\UnityEngine.LocalizationModule.dll +C:\Projects\KSP\WildBlueIndustries\Sandcastle\source\Sandcastle\bin\Debug\UnityEngine.SpriteMaskModule.dll +C:\Projects\KSP\WildBlueIndustries\Sandcastle\source\Sandcastle\bin\Debug\UnityEngine.SpriteShapeModule.dll +C:\Projects\KSP\WildBlueIndustries\Sandcastle\source\Sandcastle\bin\Debug\UnityEngine.StreamingModule.dll +C:\Projects\KSP\WildBlueIndustries\Sandcastle\source\Sandcastle\bin\Debug\UnityEngine.TerrainModule.dll +C:\Projects\KSP\WildBlueIndustries\Sandcastle\source\Sandcastle\bin\Debug\UnityEngine.TerrainPhysicsModule.dll +C:\Projects\KSP\WildBlueIndustries\Sandcastle\source\Sandcastle\bin\Debug\UnityEngine.TilemapModule.dll +C:\Projects\KSP\WildBlueIndustries\Sandcastle\source\Sandcastle\bin\Debug\UnityEngine.UnityConnectModule.dll +C:\Projects\KSP\WildBlueIndustries\Sandcastle\source\Sandcastle\bin\Debug\UnityEngine.VFXModule.dll +C:\Projects\KSP\WildBlueIndustries\Sandcastle\source\Sandcastle\bin\Debug\UnityEngine.VideoModule.dll +C:\Projects\KSP\WildBlueIndustries\Sandcastle\source\Sandcastle\bin\Debug\UnityEngine.WindModule.dll +C:\Projects\KSP\WildBlueIndustries\Sandcastle\source\Sandcastle\bin\Debug\UnityEngine.ClothModule.dll +C:\Projects\KSP\WildBlueIndustries\Sandcastle\source\Sandcastle\bin\Debug\UnityEngine.GameCenterModule.dll +C:\Projects\KSP\WildBlueIndustries\Sandcastle\source\Sandcastle\bin\Debug\UnityEngine.InputModule.dll +C:\Projects\KSP\WildBlueIndustries\Sandcastle\source\Sandcastle\bin\Debug\UnityEngine.TextCoreModule.dll +C:\Projects\KSP\WildBlueIndustries\Sandcastle\source\Sandcastle\bin\Debug\UnityEngine.UNETModule.dll +C:\Projects\KSP\WildBlueIndustries\Sandcastle\source\Sandcastle\bin\Debug\UnityEngine.XRModule.dll +C:\Projects\KSP\WildBlueIndustries\Sandcastle\source\Sandcastle\bin\Debug\UnityEngine.ARModule.dll +C:\Projects\KSP\WildBlueIndustries\Sandcastle\source\Sandcastle\bin\Debug\UnityEngine.ClusterRendererModule.dll +C:\Projects\KSP\WildBlueIndustries\Sandcastle\source\Sandcastle\bin\Debug\UnityEngine.CrashReportingModule.dll +C:\Projects\KSP\WildBlueIndustries\Sandcastle\source\Sandcastle\bin\Debug\UnityEngine.PerformanceReportingModule.dll +C:\Projects\KSP\WildBlueIndustries\Sandcastle\source\Sandcastle\bin\Debug\KSPAssets.XmlSerializers.dll +C:\Projects\KSP\WildBlueIndustries\Sandcastle\source\Sandcastle\obj\Debug\Sandcastle.csproj.CopyComplete +C:\Projects\KSP\WildBlueIndustries\Sandcastle\source\Sandcastle\obj\Debug\Sandcastle.dll +C:\Projects\KSP\WildBlueIndustries\Sandcastle\source\Sandcastle\obj\Debug\Sandcastle.pdb diff --git a/source/Sandcastle/obj/Debug/Sandcastle.csprojAssemblyReference.cache b/source/Sandcastle/obj/Debug/Sandcastle.csprojAssemblyReference.cache new file mode 100644 index 0000000..a4b2b17 Binary files /dev/null and b/source/Sandcastle/obj/Debug/Sandcastle.csprojAssemblyReference.cache differ diff --git a/source/Sandcastle/obj/Debug/Sandcastle.dll b/source/Sandcastle/obj/Debug/Sandcastle.dll new file mode 100644 index 0000000..d076160 Binary files /dev/null and b/source/Sandcastle/obj/Debug/Sandcastle.dll differ diff --git a/source/Sandcastle/obj/Debug/Sandcastle.pdb b/source/Sandcastle/obj/Debug/Sandcastle.pdb new file mode 100644 index 0000000..ab03904 Binary files /dev/null and b/source/Sandcastle/obj/Debug/Sandcastle.pdb differ diff --git a/source/Sandcastle/obj/Debug/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs b/source/Sandcastle/obj/Debug/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs new file mode 100644 index 0000000..e69de29 diff --git a/source/Sandcastle/obj/Debug/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs b/source/Sandcastle/obj/Debug/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs new file mode 100644 index 0000000..e69de29 diff --git a/source/Sandcastle/obj/Debug/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs b/source/Sandcastle/obj/Debug/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs new file mode 100644 index 0000000..e69de29 diff --git a/source/Sandcastle/xmldoc2md.ps1 b/source/Sandcastle/xmldoc2md.ps1 new file mode 100644 index 0000000..f1cebc0 --- /dev/null +++ b/source/Sandcastle/xmldoc2md.ps1 @@ -0,0 +1,18 @@ +# xmldoc2md.ps1 +# By Jaime Olivares +# URL: http://github.com/jaime-olivares/xmldoc2md + +param ( + [string]$xml = $(throw "-xml is required."), + [string]$xsl = $(throw "-xsl is required."), + [string]$output = $(throw "-output is required.") +) + +# var = new XslCompiledTransform(true); +$xslt = New-Object -TypeName "System.Xml.Xsl.XslCompiledTransform" + +# xslt.Load(stylesheet); +$xslt.Load($xsl) + +# xslt.Transform(sourceFile, null, sw); +$xslt.Transform($xml, $output) diff --git a/source/Sandcastle/xmldoc2md.xsl b/source/Sandcastle/xmldoc2md.xsl new file mode 100644 index 0000000..8940b4d --- /dev/null +++ b/source/Sandcastle/xmldoc2md.xsl @@ -0,0 +1,182 @@ + + + + + + + + + + + + # + + + + + + + + + + + + + + + + + + + + + # + + + + + + + ## Fields + + + + ### + + + + + + + + + ## Properties + + + + ### + + + + + + + + + ## Methods + + + + + + + + ### Constructor + + + + + ### + + + + + + + + + + + + + + > #### Parameters + + + + + > #### Return value + + + + + > #### Exceptions + + + + + > #### Example + > + + + + + + + + + + + + + + + + + + ` + + ` + + + + ``` + + ``` + + + + > **:** + + + + [External file]({@file}) + + + + + + + + > **:** + + + + * + + * + + + + **Permission:** ** + + + + > + + + + + > *See: * + + + + > *See also: + + + +