Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Version 11rc4 #130

Merged
merged 8 commits into from
Apr 19, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion SCANassets/SCANsat.version
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"MAJOR":1,
"MINOR":1,
"PATCH":1,
"BUILD":3
"BUILD":4
},
"KSP_VERSION":{
"MAJOR":0,
Expand Down
6 changes: 3 additions & 3 deletions SCANmechjeb/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@
// 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.1.3.0")]
[assembly: AssemblyFileVersion("1.1.3.0")]
[assembly: AssemblyInformationalVersion ("v11rc3")]
[assembly: AssemblyVersion("1.1.4.0")]
[assembly: AssemblyFileVersion("1.1.4.0")]
[assembly: AssemblyInformationalVersion ("v11rc4")]

[assembly: KSPAssembly ("SCANmechjeb", 0, 1)]
[assembly: KSPAssemblyDependency ("SCANsat", 1, 1)]
Expand Down
11 changes: 9 additions & 2 deletions SCANsat/CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
Version 11.3 - 2014-4-18
Version 11.4 - 2015-4-18
------------------------

- Make slope and biome color selection persistent

- Update resource selection when syncing zoom map to big map

Version 11.3 - 2015-4-18
------------------------

- Color management options for slope maps
Expand All @@ -20,7 +27,7 @@ Version 11.3 - 2014-4-18
- Tweaks to Zoom Map synchronization
- Click the zoom scale indicator to refresh the zoom map and re-sync with the current settings of the big map

Version 11.2 - 2014-4-12
Version 11.2 - 2015-4-12
------------------------

- Fix a bug preventing maps from working in sandbox or science mode saves
Expand Down
6 changes: 3 additions & 3 deletions SCANsat/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
// and "{Major}.{Minor}.{Build}.*" will update just the revision.
[assembly: AssemblyVersion ("1.1.3.0")]
[assembly: AssemblyFileVersion ("1.1.3.0")]
[assembly: AssemblyInformationalVersion ("v11rc3")]
[assembly: AssemblyVersion ("1.1.4.0")]
[assembly: AssemblyFileVersion ("1.1.4.0")]
[assembly: AssemblyInformationalVersion ("v11rc4")]

[assembly: KSPAssembly ("SCANsat", 1, 1)]

Expand Down
11 changes: 0 additions & 11 deletions SCANsat/SCAN_Color_Config.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,16 +55,6 @@ internal SCAN_Color_Config(string filepath, string node)

public override void OnDecodeFromConfigNode()
{
SCANUtil.SCANdebugLog("SCANsat Color Config Decode");
SCANUtil.SCANdebugLog("-------->Default Min Height Range => {0}", defaultMinHeightRange);
SCANUtil.SCANdebugLog("-------->Default Max Height Range => {0}", defaultMaxHeightRange);
SCANUtil.SCANdebugLog("-------->Default Palette => {0}", defaultPalette);
SCANUtil.SCANdebugLog("-------->Low Biome Color => {0}", lowBiomeColor);
SCANUtil.SCANdebugLog("-------->High Biome Color => {0}", highBiomeColor);
SCANUtil.SCANdebugLog("-------->Biome Transparency => {0}", biomeTransparency);
SCANUtil.SCANdebugLog("-------->Stock Biome => {0}", stockBiomeMap);
SCANUtil.SCANdebugLog("-------->Low Slope Color => {0}", bottomLowSlopeColor);
SCANUtil.SCANdebugLog("-------->High Slope Color => {0}", bottemHighSlopeColor);
SCANcontroller.setMasterTerrainNodes(SCANsat_Altimetry);
SCANcontroller.setMasterResourceNodes(SCANsat_Resources);
}
Expand All @@ -73,7 +63,6 @@ public override void OnEncodeToConfigNode()
{
SCANUtil.SCANlog("Saving SCANsat configuration file...");
SCANUtil.SCANlog("SCANcolors.cfg saved to ---> {0}", FilePath);
SCANUtil.SCANdebugLog("Saving Config Master Node");
SCANsat_Altimetry = SCANcontroller.EncodeTerrainConfigs;
SCANsat_Resources = SCANcontroller.EncodeResourceConfigs;

Expand Down
6 changes: 3 additions & 3 deletions SCANsat/SCAN_Platform/Extensions/Colors/UnityEngine.Color_.cs
Original file line number Diff line number Diff line change
Expand Up @@ -170,9 +170,9 @@ public static string ToHex(this Color c) {
}

public static string ToRGBString(this Color c) {
return c.r.ToString("F3")
+ c.g.ToString("F3")
+ c.b.ToString("F3");
return c.r.ToString("F4") + ","
+ c.g.ToString("F4") + ","
+ c.b.ToString("F4");
}

public static Color FromHex(this Color c, string s) {
Expand Down
11 changes: 5 additions & 6 deletions SCANsat/SCAN_UI/SCANcolorSelection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,16 @@ protected override void Start()
slopeColorPickerLow = new SCANuiColorPicker(SCANcontroller.controller.lowSlopeColorOne, SCANcontroller.controller.highSlopeColorOne, true);
slopeColorPickerHigh = new SCANuiColorPicker(SCANcontroller.controller.lowSlopeColorTwo, SCANcontroller.controller.highSlopeColorTwo, true);

slopeColorPickerLow.updateOldSwatches();
slopeColorPickerHigh.updateOldSwatches();

bTrans = SCANcontroller.controller.biomeTransparency;
biomeTransSlider = new SCANuiSlider(0, 80, bTrans, "Ter. Trans: ", "%", 0);

biomeColorPicker = new SCANuiColorPicker(SCANcontroller.controller.lowBiomeColor, SCANcontroller.controller.highBiomeColor, true);

biomeColorPicker.updateOldSwatches();

if (SCANconfigLoader.GlobalResource)
{
loadedResources = SCANcontroller.setLoadedResourceList();
Expand Down Expand Up @@ -532,16 +537,10 @@ private void windowTabs(int id)
if (GUILayout.Button("Slope"))
{
windowMode = 1;

//slopeColorPicker.updateOldSwatches();
}
if (GUILayout.Button("Biome"))
{
windowMode = 2;

fineControlMode = oldFineControl = false;

biomeColorPicker.updateOldSwatches();
}
if (SCANconfigLoader.GlobalResource)
{
Expand Down
31 changes: 22 additions & 9 deletions SCANsat/SCAN_UI/SCANzoomWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -113,21 +113,34 @@ public void setMapCenter(double lat, double lon, SCANmap big)
Visible = true;
bigmap = big;

SCANdata dat = SCANUtil.getData(bigmap.Body);
if (dat == null)
dat = new SCANdata(bigmap.Body);

data = dat;
b = data.Body;

spotmap.MapScale = 10;
spotmap.setBody(b);
SCANcontroller.controller.MechJebSelecting = false;
SCANcontroller.controller.MechJebSelectingActive = false;

if (bigmap.Projection == MapProjection.Polar)
spotmap.setProjection(MapProjection.Polar);
else
spotmap.setProjection(MapProjection.Rectangular);

if (bigmap.Body != b)
{
SCANdata dat = SCANUtil.getData(bigmap.Body);
if (dat == null)
dat = new SCANdata(bigmap.Body);

data = dat;
b = data.Body;

spotmap.setBody(b);
}

if (SCANconfigLoader.GlobalResource)
{
spotmap.Resource = bigmap.Resource;
spotmap.Resource.CurrentBodyConfig(b.name);
}

spotmap.MapScale = 10;

spotmap.centerAround(lon, lat);
spotmap.resetMap(bigmap.MType, false);
}
Expand Down
141 changes: 78 additions & 63 deletions SCANsat/SCANcontroller.cs
Original file line number Diff line number Diff line change
Expand Up @@ -110,18 +110,14 @@ public static SCANcontroller controller
public bool useStockBiomes = false;
[KSPField(isPersistant = true)]
public float biomeTransparency = 40;
[KSPField(isPersistant = true)]

/* Biome and slope colors can't be serialized properly as a KSP Field */
public Color lowBiomeColor = palette.xkcd_CamoGreen;
[KSPField(isPersistant = true)]
public Color highBiomeColor = palette.xkcd_Marigold;
[KSPField(isPersistant = true)]
public Color lowSlopeColorOne = palette.xkcd_PukeGreen;
[KSPField(isPersistant = true)]
public Color highSlopeColorOne = palette.xkcd_Yellow;
[KSPField(isPersistant = true)]
public Color lowSlopeColorTwo = palette.xkcd_PukeGreen;
[KSPField(isPersistant = true)]
public Color highSlopeColorTwo = palette.xkcd_Yellow;
public Color lowSlopeColorTwo = palette.xkcd_Yellow;
public Color highSlopeColorTwo = palette.xkcd_OrangeRed;

/* Available resources for overlays; loaded from SCANsat configs; only loaded once */
private static Dictionary<string, SCANresourceGlobal> masterResourceNodes = new Dictionary<string,SCANresourceGlobal>();
Expand Down Expand Up @@ -524,6 +520,21 @@ public SCANwaypoint MechJebTarget

public override void OnLoad(ConfigNode node)
{
try
{
lowBiomeColor = ConfigNode.ParseColor(node.GetValue("lowBiomeColor"));
highBiomeColor = ConfigNode.ParseColor(node.GetValue("highBiomeColor"));
lowSlopeColorOne = ConfigNode.ParseColor(node.GetValue("lowSlopeColorOne"));
highSlopeColorOne = ConfigNode.ParseColor(node.GetValue("highSlopeColorOne"));
lowSlopeColorTwo = ConfigNode.ParseColor(node.GetValue("lowSlopeColorTwo"));
highSlopeColorTwo = ConfigNode.ParseColor(node.GetValue("highSlopeColorTwo"));
}
catch (Exception e)
{
SCANUtil.SCANlog("Error While Loading SCANsat Colors: {0}", e);
}


ConfigNode node_vessels = node.GetNode("Scanners");
if (node_vessels != null)
{
Expand Down Expand Up @@ -675,70 +686,74 @@ public override void OnLoad(ConfigNode node)

public override void OnSave(ConfigNode node)
{
if (HighLogic.LoadedScene != GameScenes.EDITOR)
node.AddValue("lowBiomeColor", ConfigNode.WriteColor(lowBiomeColor));
node.AddValue("highBiomeColor", ConfigNode.WriteColor(highBiomeColor));
node.AddValue("lowSlopeColorOne", ConfigNode.WriteColor(lowSlopeColorOne));
node.AddValue("highSlopeColorOne", ConfigNode.WriteColor(highSlopeColorOne));
node.AddValue("lowSlopeColorTwo", ConfigNode.WriteColor(lowSlopeColorTwo));
node.AddValue("highSlopeColorTwo", ConfigNode.WriteColor(highSlopeColorTwo));

ConfigNode node_vessels = new ConfigNode("Scanners");
foreach (Guid id in knownVessels.Keys)
{
ConfigNode node_vessels = new ConfigNode("Scanners");
foreach (Guid id in knownVessels.Keys)
ConfigNode node_vessel = new ConfigNode("Vessel");
node_vessel.AddValue("guid", id.ToString());
if (knownVessels[id].vessel != null) node_vessel.AddValue("name", knownVessels[id].vessel.vesselName); // not read
foreach (SCANsensor sensor in knownVessels[id].sensors.Values)
{
ConfigNode node_vessel = new ConfigNode("Vessel");
node_vessel.AddValue("guid", id.ToString());
if (knownVessels[id].vessel != null) node_vessel.AddValue("name", knownVessels[id].vessel.vesselName); // not read
foreach (SCANsensor sensor in knownVessels[id].sensors.Values)
{
ConfigNode node_sensor = new ConfigNode("Sensor");
node_sensor.AddValue("type", (int)sensor.sensor);
node_sensor.AddValue("fov", sensor.fov);
node_sensor.AddValue("min_alt", sensor.min_alt);
node_sensor.AddValue("max_alt", sensor.max_alt);
node_sensor.AddValue("best_alt", sensor.best_alt);
node_vessel.AddNode(node_sensor);
}
node_vessels.AddNode(node_vessel);
ConfigNode node_sensor = new ConfigNode("Sensor");
node_sensor.AddValue("type", (int)sensor.sensor);
node_sensor.AddValue("fov", sensor.fov);
node_sensor.AddValue("min_alt", sensor.min_alt);
node_sensor.AddValue("max_alt", sensor.max_alt);
node_sensor.AddValue("best_alt", sensor.best_alt);
node_vessel.AddNode(node_sensor);
}
node.AddNode(node_vessels);
if (body_data != null)
node_vessels.AddNode(node_vessel);
}
node.AddNode(node_vessels);
if (body_data != null)
{
ConfigNode node_progress = new ConfigNode("Progress");
foreach (string body_name in body_data.Keys)
{
ConfigNode node_progress = new ConfigNode("Progress");
foreach (string body_name in body_data.Keys)
{
ConfigNode node_body = new ConfigNode("Body");
SCANdata body_scan = body_data[body_name];
node_body.AddValue("Name", body_name);
node_body.AddValue("Disabled", body_scan.Disabled);
node_body.AddValue("MinHeightRange", body_scan.TerrainConfig.MinTerrain);
node_body.AddValue("MaxHeightRange", body_scan.TerrainConfig.MaxTerrain);
if (body_scan.TerrainConfig.ClampTerrain != null)
node_body.AddValue("ClampHeight", body_scan.TerrainConfig.ClampTerrain);
node_body.AddValue("PaletteName", body_scan.TerrainConfig.ColorPal.name);
node_body.AddValue("PaletteSize", body_scan.TerrainConfig.PalSize);
node_body.AddValue("PaletteReverse", body_scan.TerrainConfig.PalRev);
node_body.AddValue("PaletteDiscrete", body_scan.TerrainConfig.PalDis);
node_body.AddValue("Map", body_scan.integerSerialize());
node_progress.AddNode(node_body);
}
node.AddNode(node_progress);
ConfigNode node_body = new ConfigNode("Body");
SCANdata body_scan = body_data[body_name];
node_body.AddValue("Name", body_name);
node_body.AddValue("Disabled", body_scan.Disabled);
node_body.AddValue("MinHeightRange", body_scan.TerrainConfig.MinTerrain);
node_body.AddValue("MaxHeightRange", body_scan.TerrainConfig.MaxTerrain);
if (body_scan.TerrainConfig.ClampTerrain != null)
node_body.AddValue("ClampHeight", body_scan.TerrainConfig.ClampTerrain);
node_body.AddValue("PaletteName", body_scan.TerrainConfig.ColorPal.name);
node_body.AddValue("PaletteSize", body_scan.TerrainConfig.PalSize);
node_body.AddValue("PaletteReverse", body_scan.TerrainConfig.PalRev);
node_body.AddValue("PaletteDiscrete", body_scan.TerrainConfig.PalDis);
node_body.AddValue("Map", body_scan.integerSerialize());
node_progress.AddNode(node_body);
}
if (resourceTypes.Count > 0 && masterResourceNodes.Count > 0)
node.AddNode(node_progress);
}
if (resourceTypes.Count > 0 && masterResourceNodes.Count > 0)
{
ConfigNode node_resources = new ConfigNode("SCANResources");
foreach (SCANresourceGlobal r in masterResourceNodes.Values)
{
ConfigNode node_resources = new ConfigNode("SCANResources");
foreach (SCANresourceGlobal r in masterResourceNodes.Values)
if (r != null)
{
if (r != null)
{
SCANUtil.SCANdebugLog("Saving Resource: {0}", r.Name);
ConfigNode node_resource_type = new ConfigNode("ResourceType");
node_resource_type.AddValue("Resource", r.Name);
node_resource_type.AddValue("MinColor", ConfigNode.WriteColor(r.MinColor));
node_resource_type.AddValue("MaxColor", ConfigNode.WriteColor(r.MaxColor));
node_resource_type.AddValue("Transparency", r.Transparency);

string rMinMax = saveResources(r);
node_resource_type.AddValue("MinMaxValues", rMinMax);
node_resources.AddNode(node_resource_type);
}
SCANUtil.SCANdebugLog("Saving Resource: {0}", r.Name);
ConfigNode node_resource_type = new ConfigNode("ResourceType");
node_resource_type.AddValue("Resource", r.Name);
node_resource_type.AddValue("MinColor", ConfigNode.WriteColor(r.MinColor));
node_resource_type.AddValue("MaxColor", ConfigNode.WriteColor(r.MaxColor));
node_resource_type.AddValue("Transparency", r.Transparency);

string rMinMax = saveResources(r);
node_resource_type.AddValue("MinMaxValues", rMinMax);
node_resources.AddNode(node_resource_type);
}
node.AddNode(node_resources);
}
node.AddNode(node_resources);
}
}

Expand Down