Skip to content
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
29 changes: 20 additions & 9 deletions PAPIPlugin/Impl/PAPITypeManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -31,26 +35,33 @@ public void Initialize(ILightGroup group)

foreach (var lightArray in group.LightArrays.OfType<PAPIArray>())
{
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<double>(PAPIArray.DefaultTargetGlidePath, DoubleConvertDelegate);
_glideslopeToleranceField = new EditableGUIField<double>(PAPIArray.DefaultGlideslopeTolerance, DoubleConvertDelegate);
_glideslopeField = new EditableGUIField<double>(_initialGlideslopeValue, DoubleConvertDelegate);
_glideslopeToleranceField = new EditableGUIField<double>(_initialTargetGlideslopeValue, DoubleConvertDelegate);

_guiInitialized = true;
}
Expand All @@ -63,7 +74,7 @@ public void OnGui(int windowID)

#endregion

private void DoDegreeField<T>(string name, EditableGUIField<T> field)
private static void DoDegreeField<T>(string name, EditableGUIField<T> field)
{
GUILayout.BeginHorizontal();
{
Expand Down
12 changes: 10 additions & 2 deletions assets/GameData/PAPIPlugin/lights.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ LightGroup
Type = PAPIArray
Namespace = PAPIPlugin.Arrays

Latitude = -0.0468
Latitude = -0.054
Longitude = -74.701944

Heading = 270
Expand All @@ -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
}
}