Skip to content

Commit

Permalink
Fixed issue with symmetric parts config window
Browse files Browse the repository at this point in the history
 Fixed issue with showing config window for multiple parts
  • Loading branch information
linuxgurugamer committed Jan 15, 2021
1 parent 1c79f96 commit eece6c0
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 9 deletions.
4 changes: 4 additions & 0 deletions ChangeLog.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
ChangeLog

0.5.0.4
Fixed issue with symmetric parts config window
Fixed issue with showing config window for multiple parts

0.5.0.3
Fixed missing rope when returning to vessel (using AirPark)

Expand Down
2 changes: 1 addition & 1 deletion GameData/KerBalloons/KerBalloons.version
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"MAJOR": 0,
"MINOR": 5,
"PATCH": 0,
"BUILD": 2
"BUILD": 3
},
"KSP_VERSION": {
"MAJOR": 1,
Expand Down
2 changes: 1 addition & 1 deletion KerBalloons.version
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"MAJOR": 0,
"MINOR": 5,
"PATCH": 0,
"BUILD": 3
"BUILD": 4
},
"KSP_VERSION": {
"MAJOR": 1,
Expand Down
2 changes: 1 addition & 1 deletion Kerballoons/AssemblyVersion.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@

using System.Reflection;

[assembly: AssemblyVersion("0.5.0.2")]
[assembly: AssemblyVersion("0.5.0.3")]
31 changes: 25 additions & 6 deletions Kerballoons/ModuleKerBalloon.cs
Original file line number Diff line number Diff line change
Expand Up @@ -175,16 +175,31 @@ public override void OnStart(StartState state)
int winId = WindowHelper.NextWindowId("ModuleKerBalloonConfig");
int infoId = WindowHelper.NextWindowId("ModuleKerBalloonInfo");
bool visibleShowInfo = false;
bool visible = false;
bool visibleConfig = false;
[KSPEvent(guiActive = false, guiActiveEditor = true, guiName = "Configure Balloon")]
public void ConfigureBalloon()
{
ConfigureWinPos();
ConfigureWinPos(true);
}

void ConfigureWinPos()
static readonly object locked = new object();

void ConfigureWinPos(bool ignoreLock = false)
{
visible = true;
if (!ignoreLock)
{
uint activePartId = part.persistentId;
lock (locked)
{
foreach (var p in part.symmetryCounterparts)
{
if (p.persistentId < activePartId)
return;
}
}
}
winId = WindowHelper.NextWindowId("ModuleKerBalloonConfig" + part.persistentId);
visibleConfig = true;
winRect.x = Mouse.screenPos.x;
winRect.y = Mouse.screenPos.y;

Expand All @@ -200,7 +215,7 @@ void OnGUI()
GUI.skin = HighLogic.Skin;
infoRect = ClickThruBlocker.GUILayoutWindow(infoId, infoRect, InfoBalloonWin, "KerBalloon");
}
if (visible && HighLogic.LoadedSceneIsEditor)
if (visibleConfig && HighLogic.LoadedSceneIsEditor)
{
if (!visibleShowInfo && !HighLogic.CurrentGame.Parameters.CustomParams<KerBSettings>().altskin)
GUI.skin = HighLogic.Skin;
Expand Down Expand Up @@ -263,6 +278,8 @@ void SetValues(BalloonInfo b)

List<string> availPayloads = new List<string>();
int selectedPayload = 0;


void ConfigBalloonWin(int id)
{
GUILayout.BeginHorizontal();
Expand Down Expand Up @@ -337,7 +354,7 @@ void ConfigBalloonWin(int id)
}
GUILayout.FlexibleSpace();
if (GUILayout.Button("Close"))
visible = false;
visibleConfig = false;
GUI.DragWindow();
}

Expand Down Expand Up @@ -580,6 +597,8 @@ static public GameObject getChildGameObject(GameObject fromGameObject, string wi
public void ShowInfo()
{
visibleShowInfo = !visibleShowInfo;
availPlanets.Clear();
availPayloads.Clear();
}

Vector2 infoPos;
Expand Down

0 comments on commit eece6c0

Please sign in to comment.