Skip to content

Commit

Permalink
additional fix for mods with weird callbacks
Browse files Browse the repository at this point in the history
  • Loading branch information
radistmorse committed Jun 15, 2020
1 parent 7dca403 commit a8bd839
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
8 changes: 4 additions & 4 deletions AdjustableModPanel.version
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,22 @@
"VERSION": {
"MAJOR": 1,
"MINOR": 5,
"PATCH": 4,
"PATCH": 5,
"BUILD": 0
},
"KSP_VERSION": {
"MAJOR": 1,
"MINOR": 8,
"MINOR": 9,
"PATCH": 0
},
"KSP_VERSION_MIN": {
"MAJOR": 1,
"MINOR": 8,
"MINOR": 9,
"PATCH": 0
},
"KSP_VERSION_MAX": {
"MAJOR": 1,
"MINOR": 8,
"MINOR": 9,
"PATCH": 99
}
}
10 changes: 8 additions & 2 deletions ModPanelComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,14 @@ public void Update () {
if (texture == null)
continue;

var func = button.onTrue.GetInvocationList ()[1];
var method = func.Method.Name;
// try any non-null callback in order
var func = new Callback[] { button.onTrue, button.onHover, button.onLeftClick, button.onEnable, button.onFalse, button.onHoverOut, button.onDisable }
.Select(cb => cb.GetInvocationList().Skip(1).FirstOrDefault()).Where(m => m != null).FirstOrDefault(); var method = func.Method.Name;

// button with no callbacks. Ignore.
if (func == null)
continue;

var module = func.Method.Module.Name;
if (module.EndsWith (".dll"))
module = module.Substring (0, module.Length - 4);
Expand Down
4 changes: 2 additions & 2 deletions Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.5.4.0")]
[assembly: AssemblyFileVersion("1.5.4.0")]
[assembly: AssemblyVersion("1.5.5.0")]
[assembly: AssemblyFileVersion("1.5.5.0")]

0 comments on commit a8bd839

Please sign in to comment.