Fixed NullRef whilst loading the action menu.
--- a/KerbalEngineer/Flight/ActionMenu.cs
+++ b/KerbalEngineer/Flight/ActionMenu.cs
@@ -20,7 +20,6 @@
#region Using Directives
using System;
-using System.Threading;
using UnityEngine;
@@ -41,29 +40,45 @@
#endregion
- #region Initialisation
-
- private void Awake()
+ #region Methods: protected
+
+ protected void Awake()
{
try
{
GameEvents.onGUIApplicationLauncherReady.Add(this.OnGuiAppLauncherReady);
- Logger.Log("ActionMenu was created.");
- }
- catch (Exception ex)
- {
- Logger.Exception(ex);
- }
- }
-
- #endregion
-
- #region Updating
-
- private void Update()
- {
- try
- {
+ }
+ catch (Exception ex)
+ {
+ Logger.Exception(ex);
+ }
+ Logger.Log("ActionMenu was created.");
+ }
+
+ protected void OnDestroy()
+ {
+ try
+ {
+ GameEvents.onGUIApplicationLauncherReady.Remove(this.OnGuiAppLauncherReady);
+ GameEvents.onHideUI.Remove(this.OnHide);
+ GameEvents.onShowUI.Remove(this.OnShow);
+ ApplicationLauncher.Instance.RemoveModApplication(this.button);
+ }
+ catch (Exception ex)
+ {
+ Logger.Exception(ex);
+ }
+ Logger.Log("ActionMenu was destroyed.");
+ }
+
+ protected void Update()
+ {
+ try
+ {
+ if (this.button == null)
+ {
+ return;
+ }
if (FlightEngineerCore.Instance != null && this.button.State == RUIToggleButton.ButtonState.DISABLED)
{
this.button.Enable();
@@ -81,7 +96,20 @@
#endregion
- #region Callbacks
+ #region Methods: private
+
+ private void OnFalse()
+ {
+ try
+ {
+ this.actionMenuGui.enabled = false;
+ this.actionMenuGui.StayOpen = false;
+ }
+ catch (Exception ex)
+ {
+ Logger.Exception(ex);
+ }
+ }
private void OnGuiAppLauncherReady()
{
@@ -108,94 +136,61 @@
}
}
+ private void OnHide()
+ {
+ try
+ {
+ this.actionMenuGui.Hidden = true;
+ }
+ catch (Exception ex)
+ {
+ Logger.Exception(ex);
+ }
+ }
+
+ private void OnHover()
+ {
+ try
+ {
+ this.actionMenuGui.enabled = true;
+ this.actionMenuGui.Hovering = true;
+ }
+ catch (Exception ex)
+ {
+ Logger.Exception(ex);
+ }
+ }
+
+ private void OnHoverOut()
+ {
+ try
+ {
+ this.actionMenuGui.Hovering = false;
+ }
+ catch (Exception ex)
+ {
+ Logger.Exception(ex);
+ }
+ }
+
+ private void OnShow()
+ {
+ try
+ {
+ this.actionMenuGui.Hidden = false;
+ }
+ catch (Exception ex)
+ {
+ Logger.Exception(ex);
+ }
+ }
+
private void OnTrue()
{
try
{
this.actionMenuGui.enabled = true;
this.actionMenuGui.StayOpen = true;
- }
- catch (Exception ex)
- {
- Logger.Exception(ex);
- }
- }
-
- private void OnFalse()
- {
- try
- {
- this.actionMenuGui.enabled = false;
- this.actionMenuGui.StayOpen = false;
- }
- catch (Exception ex)
- {
- Logger.Exception(ex);
- }
- }
-
- private void OnHover()
- {
- try
- {
- this.actionMenuGui.enabled = true;
- this.actionMenuGui.Hovering = true;
- }
- catch (Exception ex)
- {
- Logger.Exception(ex);
- }
- }
-
- private void OnHoverOut()
- {
- try
- {
- this.actionMenuGui.Hovering = false;
- }
- catch (Exception ex)
- {
- Logger.Exception(ex);
- }
- }
-
- private void OnHide()
- {
- try
- {
- this.actionMenuGui.Hidden = true;
- }
- catch (Exception ex)
- {
- Logger.Exception(ex);
- }
- }
-
- private void OnShow()
- {
- try
- {
- this.actionMenuGui.Hidden = false;
- }
- catch (Exception ex)
- {
- Logger.Exception(ex);
- }
- }
-
- #endregion
-
- #region Destruction
-
- private void OnDestroy()
- {
- try
- {
- GameEvents.onGUIApplicationLauncherReady.Remove(this.OnGuiAppLauncherReady);
- GameEvents.onHideUI.Remove(this.OnHide);
- GameEvents.onShowUI.Remove(this.OnShow);
- ApplicationLauncher.Instance.RemoveModApplication(this.button);
- Logger.Log("ActionMenu was destroyed.");
}
catch (Exception ex)
{
--- a/Output/CHANGES.txt
+++ b/Output/CHANGES.txt
@@ -7,6 +7,7 @@
- Relative Speed
Fixed: An issue where deltaV would not be calculated whilst flying.
+ Fixed: NullRef whilst loading the in flight Action Menu.
1.0.7.1
Changed: Reversed Intake Air readout from 'S/D' to 'D/S' for easier reading.
Binary files a/Output/KerbalEngineer/KerbalEngineer.dll and b/Output/KerbalEngineer/KerbalEngineer.dll differ