diff --git a/PAPIPlugin/Impl/PAPITypeManager.cs b/PAPIPlugin/Impl/PAPITypeManager.cs index ea26484..4d9fa2b 100644 --- a/PAPIPlugin/Impl/PAPITypeManager.cs +++ b/PAPIPlugin/Impl/PAPITypeManager.cs @@ -23,6 +23,10 @@ public class PAPITypeManager : ILightTypeManager private bool _guiInitialized = false; + private double _initialGlideslopeValue = PAPIArray.DefaultTargetGlidePath; + + private double _initialTargetGlideslopeValue = PAPIArray.DefaultGlideslopeTolerance; + #region ILightTypeManager Members public void Initialize(ILightGroup group) @@ -31,26 +35,33 @@ public void Initialize(ILightGroup group) foreach (var lightArray in group.LightArrays.OfType()) { - Util.LogInfo(lightArray); _papiArrays.Add(lightArray); + + _initialTargetGlideslopeValue = lightArray.GlideslopeTolerance; + _initialGlideslopeValue = lightArray.TargetGlideslope; } group.LightArrayAdded += (sender, arguments) => - { - var papi = arguments.Array as PAPIArray; - if (papi != null) { + var papi = arguments.Array as PAPIArray; + if (papi == null) + { + return; + } + _papiArrays.Add(papi); - } - }; + + _initialTargetGlideslopeValue = papi.GlideslopeTolerance; + _initialGlideslopeValue = papi.TargetGlideslope; + }; } public void OnGui(int windowID) { if (!_guiInitialized) { - _glideslopeField = new EditableGUIField(PAPIArray.DefaultTargetGlidePath, DoubleConvertDelegate); - _glideslopeToleranceField = new EditableGUIField(PAPIArray.DefaultGlideslopeTolerance, DoubleConvertDelegate); + _glideslopeField = new EditableGUIField(_initialGlideslopeValue, DoubleConvertDelegate); + _glideslopeToleranceField = new EditableGUIField(_initialTargetGlideslopeValue, DoubleConvertDelegate); _guiInitialized = true; } @@ -63,7 +74,7 @@ public void OnGui(int windowID) #endregion - private void DoDegreeField(string name, EditableGUIField field) + private static void DoDegreeField(string name, EditableGUIField field) { GUILayout.BeginHorizontal(); { diff --git a/assets/GameData/PAPIPlugin/lights.cfg b/assets/GameData/PAPIPlugin/lights.cfg index ea467e4..61e9fc6 100644 --- a/assets/GameData/PAPIPlugin/lights.cfg +++ b/assets/GameData/PAPIPlugin/lights.cfg @@ -8,7 +8,7 @@ LightGroup Type = PAPIArray Namespace = PAPIPlugin.Arrays - Latitude = -0.0468 + Latitude = -0.054 Longitude = -74.701944 Heading = 270 @@ -27,9 +27,17 @@ LightGroup Type = PAPIArray Namespace = PAPIPlugin.Arrays - Latitude = -0.036 + Latitude = -0.044 Longitude = -74.511944 Heading = 90 + + // Example values + GlideslopeTolerance = 1.5 + TargetGlideslope = 6 + HeightAboveTerrain = 5 + PartCount = 4 + LightRadius = 8 + LightDistance = 6 } }