Skip to content

Commit

Permalink
Add new LegacyOrbitLineColor setting (#19)
Browse files Browse the repository at this point in the history
  • Loading branch information
FrostBird347 authored Feb 25, 2020
1 parent d0bb32d commit 2f8b1a7
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 1 deletion.
1 change: 1 addition & 0 deletions GameData/CommNetConstellation/Localization/en-us.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ Localization
#CNC_ConstellationControl_vesselSetup_title = Vessel - <color=#00ff00>Setup</color>
#CNC_ConstellationControl_GroundStationEdit_title = Ground station - <color=#00ff00>Edit</color>
#CNC_ConstellationControl_toggleStationButton = Hide all station markers
#CNC_ConstellationControl_toggleOrbitButton = Toggle colorized orbits

#CNC_ConstellationEdit_description = You are creating a new constellation.
#CNC_ConstellationEdit_description2 = You are editing Constellation '<<1>>'.
Expand Down
1 change: 1 addition & 0 deletions GameData/CommNetConstellation/Localization/zh-cn.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ Localization
#CNC_ConstellationControl_vesselSetup_title = 载具 - <color=#00ff00>配置</color>
#CNC_ConstellationControl_GroundStationEdit_title = 地面站 - <color=#00ff00>编辑</color>
#CNC_ConstellationControl_toggleStationButton = 隐藏所有地面站标记
#CNC_ConstellationControl_toggleOrbitButton = Toggle colorized orbits

#CNC_ConstellationEdit_description = 你正在建立一个新的星座.
#CNC_ConstellationEdit_description2 = 你在编辑星座 '<<1>>'.
Expand Down
3 changes: 2 additions & 1 deletion GameData/CommNetConstellation/cnc_settings.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ CommNetConstellationSettings
DefaultPublicName = Public Broadcasting
DefaultPublicColor = 0.65, 0.65, 0.65, 1
DistanceToHideGroundStations = 8000000
LegacyOrbitLineColor = False
Constellations
{
Constellation
Expand All @@ -26,4 +27,4 @@ CommNetConstellationSettings
}
}
}
}
}
1 change: 1 addition & 0 deletions src/CommNetConstellation/CNCSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ public class Settings
[Persistent] public string DefaultPublicName;
[Persistent] public Color DefaultPublicColor;
[Persistent] public float DistanceToHideGroundStations;
[Persistent] public bool LegacyOrbitLineColor;
[Persistent(collectionIndex = "Constellation")] public List<Constellation> Constellations;
[Persistent(collectionIndex = "GroundStation")] public List<CNCCommNetHome> GroundStations;
//-----
Expand Down
4 changes: 4 additions & 0 deletions src/CommNetConstellation/CommNetLayer/CNCCommNetScenario.cs
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,9 @@ public override void OnLoad(ConfigNode gameNode)
case "HideGroundStations":
this.hideGroundStations = Boolean.Parse(value.value);
break;
case "LegacyOrbitLineColor":
CNCSettings.Instance.LegacyOrbitLineColor = Boolean.Parse(value.value);
break;
}
}

Expand Down Expand Up @@ -261,6 +264,7 @@ public override void OnSave(ConfigNode gameNode)
gameNode.AddValue("DisplayModeTracking", CNCCommNetUI.CustomModeTrackingStation);
gameNode.AddValue("DisplayModeFlight", CNCCommNetUI.CustomModeFlightMap);
gameNode.AddValue("HideGroundStations", this.hideGroundStations);
gameNode.AddValue("LegacyOrbitLineColor", CNCSettings.Instance.LegacyOrbitLineColor);

//Constellations
if (gameNode.HasNode("Constellations"))
Expand Down
12 changes: 12 additions & 0 deletions src/CommNetConstellation/CommNetLayer/CNCCommNetUI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,21 @@ private void OnMapNodeUpdateVisible(MapNode node, MapNode.IconData iconData)
if(thisVessel != null && node.mapObject.type == MapObject.ObjectType.Vessel)
{
if (thisVessel.getStrongestFrequency() < 0) // blind vessel
{
iconData.color = Color.grey;
}
else
{
iconData.color = Constellation.getColor(thisVessel.getStrongestFrequency());
if (CNCSettings.Instance.LegacyOrbitLineColor)
{
thisVessel.Vessel.orbitRenderer.orbitColor = iconData.color.linear;
}
else
{
thisVessel.Vessel.orbitRenderer.orbitColor = new Color(0.355f, 0.355f, 0.355f, 1f); //stock color
}
}
}
}

Expand Down
3 changes: 3 additions & 0 deletions src/CommNetConstellation/UI/ConstellationControlDialog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,11 @@ private List<DialogGUIBase> getConstellationContentLayout()
List<DialogGUIBase> constellationComponments = new List<DialogGUIBase>();

DialogGUIButton createButton = new DialogGUIButton(Localizer.Format("#CNC_ConstellationControl_createButton"), newConstellationClick, false);//"New constellation"
DialogGUIToggleButton toggleOrbitButton = new DialogGUIToggleButton(CNCSettings.Instance.LegacyOrbitLineColor, Localizer.Format("#CNC_ConstellationControl_toggleOrbitButton"), delegate (bool b) { CNCSettings.Instance.LegacyOrbitLineColor = !CNCSettings.Instance.LegacyOrbitLineColor; }, 35, 25);//"Toggle colorized orbits"
DialogGUIHorizontalLayout creationGroup = new DialogGUIHorizontalLayout(true, false, 4, new RectOffset(), TextAnchor.MiddleLeft, new DialogGUIBase[] { new DialogGUIFlexibleSpace(), createButton, new DialogGUIFlexibleSpace() });
DialogGUIHorizontalLayout toggleGroup = new DialogGUIHorizontalLayout(true, false, 4, new RectOffset(), TextAnchor.MiddleLeft, new DialogGUIBase[] { new DialogGUIFlexibleSpace(), toggleOrbitButton, new DialogGUIFlexibleSpace() });
constellationComponments.Add(creationGroup);
constellationComponments.Add(toggleGroup);

for (int i = 0; i < CNCCommNetScenario.Instance.constellations.Count; i++)
constellationComponments.Add(createConstellationRow(CNCCommNetScenario.Instance.constellations[i]));
Expand Down

0 comments on commit 2f8b1a7

Please sign in to comment.