コード例 #1
0
 public static void CaptureThumbnail(ShipConstruct ship, int resolution,
                                     float elevation, float azimuth, float pitch, float heading, float fov, string saveFolder, string craftName)
 {
     Log.Info("CaptureThumbnail  elevation: " + elevation.ToString() + "  azimuth: " + azimuth.ToString() + "pitch: " + pitch.ToString() +
              "   heading: " + heading.ToString() + "  fov: " + fov.ToString());
     CraftThumbnail.TakeSnaphot(ship, resolution, saveFolder, craftName, elevation, azimuth, pitch, heading, fov);
 }
コード例 #2
0
 /// <summary>
 /// Generates a thumbnail exactly like the one KSP generates automatically.
 /// Behaves exactly like ShipConstruction.CaptureThumbnail() but allows customizing the resolution.
 /// </summary>
 public static void CaptureThumbnail(ShipConstruct ship, int resolution, string saveFolder, string craftName)
 {
     if (ship.shipFacility != EditorFacility.VAB)
     {
         CraftThumbnail.TakeSnaphot(ship, resolution, saveFolder, craftName, 35, 135, 35, 135, 0.9f);
     }
     else
     {
         CraftThumbnail.TakeSnaphot(ship, resolution, saveFolder, craftName, 45, 45, 45, 45, 0.9f);
     }
 }
コード例 #3
0
        private Texture2D CreateThumbnail(ShipConstruct ship)
        {
            var folderPath = "thumbs";

            CraftThumbnail.TakeSnaphot(ship, 256, folderPath, ship.shipName);
            var fileName
                = $"{HighLogic.SaveFolder}_{ship.shipFacility}_{ship.shipName}.png";
            var filePath = Path.Combine(KSPUtil.ApplicationRootPath, folderPath, fileName);

            _fileNameCache.Add(ship.shipName, filePath);
            return(LoadThumbnail(filePath));
        }