Fixes and improvements for AppLauncher buttons.
[AntennaRange.git] / ARFlightController.cs
blob:a/ARFlightController.cs -> blob:b/ARFlightController.cs
--- a/ARFlightController.cs
+++ b/ARFlightController.cs
@@ -43,6 +43,7 @@
 
 		#region Fields
 		protected Dictionary<ConnectionStatus, string> connectionTextures;
+		protected Dictionary<ConnectionStatus, Texture> appLauncherTextures;
 
 		protected IButton toolbarButton;
 
@@ -61,6 +62,14 @@
 			get
 			{
 				return this.connectionTextures[this.currentConnectionStatus];
+			}
+		}
+
+		protected Texture currentAppLauncherTexture
+		{
+			get
+			{
+				return this.appLauncherTextures[this.currentConnectionStatus];
 			}
 		}
 
@@ -115,6 +124,15 @@
 			this.connectionTextures[ConnectionStatus.None] = "AntennaRange/Textures/toolbarIconNoConnection";
 			this.connectionTextures[ConnectionStatus.Suboptimal] = "AntennaRange/Textures/toolbarIconSubOptimal";
 			this.connectionTextures[ConnectionStatus.Optimal] = "AntennaRange/Textures/toolbarIcon";
+
+			this.appLauncherTextures = new Dictionary<ConnectionStatus, Texture>();
+
+			this.appLauncherTextures[ConnectionStatus.None] =
+				GameDatabase.Instance.GetTexture("AntennaRange/Textures/appLauncherIconNoConnection", false);
+			this.appLauncherTextures[ConnectionStatus.Suboptimal] =
+				GameDatabase.Instance.GetTexture("AntennaRange/Textures/appLauncherIconSubOptimal", false);
+			this.appLauncherTextures[ConnectionStatus.Optimal] =
+				GameDatabase.Instance.GetTexture("AntennaRange/Textures/appLauncherIcon", false);
 
 			if (ToolbarManager.ToolbarAvailable)
 			{
@@ -136,7 +154,7 @@
 			{
 				this.appLauncherButton = ApplicationLauncher.Instance.AddModApplication(
 					ApplicationLauncher.AppScenes.FLIGHT,
-					GameDatabase.Instance.GetTexture("AntennaRange/Textures/toolbarIconNoConnection", false)
+					this.appLauncherTextures[ConnectionStatus.None]
 				);
 			}
 
@@ -240,8 +258,7 @@
 				}
 				if (this.appLauncherButton != null)
 				{
-					this.appLauncherButton.SetTexture(
-						GameDatabase.Instance.GetTexture(this.currentConnectionTexture, false));
+					this.appLauncherButton.SetTexture(this.currentAppLauncherTexture);
 				}
 			}