Skip to content

Commit a477bcf

Browse files
committed
Merge pull request #9 from asarium/develop
Merge changes for release v0.3.1
2 parents 345a8cd + b4dd080 commit a477bcf

2 files changed

Lines changed: 30 additions & 11 deletions

File tree

PAPIPlugin/Impl/PAPITypeManager.cs

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ public class PAPITypeManager : ILightTypeManager
2323

2424
private bool _guiInitialized = false;
2525

26+
private double _initialGlideslopeValue = PAPIArray.DefaultTargetGlidePath;
27+
28+
private double _initialTargetGlideslopeValue = PAPIArray.DefaultGlideslopeTolerance;
29+
2630
#region ILightTypeManager Members
2731

2832
public void Initialize(ILightGroup group)
@@ -31,26 +35,33 @@ public void Initialize(ILightGroup group)
3135

3236
foreach (var lightArray in group.LightArrays.OfType<PAPIArray>())
3337
{
34-
Util.LogInfo(lightArray);
3538
_papiArrays.Add(lightArray);
39+
40+
_initialTargetGlideslopeValue = lightArray.GlideslopeTolerance;
41+
_initialGlideslopeValue = lightArray.TargetGlideslope;
3642
}
3743

3844
group.LightArrayAdded += (sender, arguments) =>
39-
{
40-
var papi = arguments.Array as PAPIArray;
41-
if (papi != null)
4245
{
46+
var papi = arguments.Array as PAPIArray;
47+
if (papi == null)
48+
{
49+
return;
50+
}
51+
4352
_papiArrays.Add(papi);
44-
}
45-
};
53+
54+
_initialTargetGlideslopeValue = papi.GlideslopeTolerance;
55+
_initialGlideslopeValue = papi.TargetGlideslope;
56+
};
4657
}
4758

4859
public void OnGui(int windowID)
4960
{
5061
if (!_guiInitialized)
5162
{
52-
_glideslopeField = new EditableGUIField<double>(PAPIArray.DefaultTargetGlidePath, DoubleConvertDelegate);
53-
_glideslopeToleranceField = new EditableGUIField<double>(PAPIArray.DefaultGlideslopeTolerance, DoubleConvertDelegate);
63+
_glideslopeField = new EditableGUIField<double>(_initialGlideslopeValue, DoubleConvertDelegate);
64+
_glideslopeToleranceField = new EditableGUIField<double>(_initialTargetGlideslopeValue, DoubleConvertDelegate);
5465

5566
_guiInitialized = true;
5667
}
@@ -63,7 +74,7 @@ public void OnGui(int windowID)
6374

6475
#endregion
6576

66-
private void DoDegreeField<T>(string name, EditableGUIField<T> field)
77+
private static void DoDegreeField<T>(string name, EditableGUIField<T> field)
6778
{
6879
GUILayout.BeginHorizontal();
6980
{

assets/GameData/PAPIPlugin/lights.cfg

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ LightGroup
88
Type = PAPIArray
99
Namespace = PAPIPlugin.Arrays
1010

11-
Latitude = -0.0468
11+
Latitude = -0.054
1212
Longitude = -74.701944
1313

1414
Heading = 270
@@ -27,9 +27,17 @@ LightGroup
2727
Type = PAPIArray
2828
Namespace = PAPIPlugin.Arrays
2929

30-
Latitude = -0.036
30+
Latitude = -0.044
3131
Longitude = -74.511944
3232

3333
Heading = 90
34+
35+
// Example values
36+
GlideslopeTolerance = 1.5
37+
TargetGlideslope = 6
38+
HeightAboveTerrain = 5
39+
PartCount = 4
40+
LightRadius = 8
41+
LightDistance = 6
3442
}
3543
}

0 commit comments

Comments
 (0)