Throughout: Change in-module "_Active" references to "toggleActive" property.
--- a/VOID_CareerStatus.cs
+++ b/VOID_CareerStatus.cs
@@ -46,11 +46,11 @@
{
if (delta > 0)
{
- return string.Format(string.Intern("<color='green'>{0:#,#.##}↑</color>"), delta);
+ return string.Format("<color='green'>{0:#,#.##}↑</color>", delta);
}
else if (delta < 0)
{
- return string.Format(string.Intern("<color='red'>{0:#,#.##}↓</color>"), delta);
+ return string.Format("<color='red'>{0:#,#.##}↓</color>", delta);
}
else
{
@@ -63,41 +63,41 @@
return formatDelta((double)delta);
}
- private int fontSize;
- private Texture2D origFundsGreen;
- private Texture2D origFundsRed;
- private Texture2D origRepGreen;
- private Texture2D origRepRed;
- private Texture2D origScience;
-
- public Texture2D fundsIconGreen
- {
- get;
- private set;
- }
-
- public Texture2D fundsIconRed
- {
- get;
- private set;
- }
-
- public Texture2D reputationIconGreen
- {
- get;
- private set;
- }
-
- public Texture2D reputationIconRed
- {
- get;
- private set;
- }
-
- public Texture2D scienceIcon
- {
- get;
- private set;
+ private GUIContent fundsContent;
+ private GUIContent repContent;
+ private GUIContent scienceContent;
+
+ private Texture2D fundsIconGreen;
+ private Texture2D fundsIconRed;
+ private Texture2D reputationIconGreen;
+ private Texture2D reputationIconRed;
+ private Texture2D scienceIcon;
+
+ public override bool toggleActive
+ {
+ get
+ {
+ switch (HighLogic.CurrentGame.Mode)
+ {
+ case Game.Modes.CAREER:
+ case Game.Modes.SCIENCE_SANDBOX:
+ return base.toggleActive;
+ default:
+ return false;
+ }
+ }
+ set
+ {
+ switch (HighLogic.CurrentGame.Mode)
+ {
+ case Game.Modes.CAREER:
+ case Game.Modes.SCIENCE_SANDBOX:
+ base.toggleActive = value;
+ break;
+ default:
+ return;
+ }
+ }
}
public double lastFundsChange
@@ -120,100 +120,68 @@
public double currentFunds
{
- get
- {
- if (Funding.Instance != null)
- {
- return Funding.Instance.Funds;
- }
- else
- {
- return double.NaN;
- }
- }
+ get;
+ private set;
}
public float currentReputation
{
- get
- {
- if (Reputation.Instance != null)
- {
- return Reputation.Instance.reputation;
- }
- else
- {
- return float.NaN;
- }
- }
+ get;
+ private set;
}
public float currentScience
{
- get
- {
- if (ResearchAndDevelopment.Instance != null)
- {
- return ResearchAndDevelopment.Instance.Science;
- }
- else
- {
- return float.NaN;
- }
- }
+ get;
+ private set;
}
public override void ModuleWindow(int _)
{
-
- /*if (this.fontSize != this.core.Skin.label.fontSize)
- {
- this.fontSize = this.core.Skin.label.fontSize;
-
- this.fundsIconGreen = this.origFundsGreen.Clone().ResizeByHeight(this.fontSize);
- this.fundsIconRed = this.origFundsRed.Clone().ResizeByHeight(this.fontSize);
- this.reputationIconGreen = this.origRepGreen.Clone().ResizeByHeight(this.fontSize);
- this.reputationIconRed = this.origRepRed.Clone().ResizeByHeight(this.fontSize);
- this.scienceIcon = this.origScience.Clone().ResizeByHeight(this.fontSize);
-
- GC.Collect();
- }*/
-
GUILayout.BeginVertical();
- // VOID_Data.fundingStatus.DoGUIHorizontal();
-
GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
-
GUILayout.Label(VOID_Data.fundingStatus.Label);
GUILayout.FlexibleSpace();
- // GUILayout.Label(this.fundsIconGreen);
- GUILayout.Label(VOID_Data.fundingStatus.Value, GUILayout.ExpandWidth(false));
-
+ this.fundsContent.text = VOID_Data.fundingStatus.Value;
+ GUILayout.Label(this.fundsContent, GUILayout.ExpandWidth(false));
GUILayout.EndHorizontal();
- VOID_Data.reputationStatus.DoGUIHorizontal();
-
- VOID_Data.scienceStatus.DoGUIHorizontal();
+ GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
+ GUILayout.Label(VOID_Data.reputationStatus.Label);
+ GUILayout.FlexibleSpace();
+ this.repContent.text = VOID_Data.reputationStatus.Value;
+ GUILayout.Label(this.repContent, GUILayout.ExpandWidth(false));
+ GUILayout.EndHorizontal();
+
+ GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
+ GUILayout.Label(VOID_Data.scienceStatus.Label);
+ GUILayout.FlexibleSpace();
+ this.scienceContent.text = VOID_Data.scienceStatus.Value;
+ GUILayout.Label(this.scienceContent, GUILayout.ExpandWidth(false));
+ GUILayout.EndHorizontal();
GUILayout.EndVertical();
GUI.DragWindow();
}
- private void onFundsChange(double delta)
- {
- this.lastFundsChange = delta;
- }
-
- private void onRepChange(float delta)
- {
- this.lastRepChange = delta;
- }
-
- private void onScienceChange(float delta)
- {
- this.lastScienceChange = delta;
+ private void onFundsChange(double newValue)
+ {
+ this.lastFundsChange = newValue - this.currentFunds;
+ this.currentFunds = newValue;
+ }
+
+ private void onRepChange(float newValue)
+ {
+ this.lastRepChange = newValue - this.currentReputation;
+ this.currentReputation = newValue;
+ }
+
+ private void onScienceChange(float newValue)
+ {
+ this.lastScienceChange = newValue - this.currentScience;
+ this.currentScience = newValue;
}
/*
@@ -228,46 +196,34 @@
VOID_CareerStatus.Instance = this;
this._Name = "Career Status";
- this.fontSize = int.MinValue;
GameEvents.OnFundsChanged.Add(this.onFundsChange);
GameEvents.OnReputationChanged.Add(this.onRepChange);
GameEvents.OnScienceChanged.Add(this.onScienceChange);
- foreach (Texture2D tex in Resources.FindObjectsOfTypeAll<Texture2D>())
- {
- if (
- this.origFundsGreen != null &&
- this.origFundsRed != null &&
- this.origRepGreen != null &&
- this.origRepRed != null &&
- this.origScience != null
- )
- {
- break;
- }
-
- switch (tex.name)
- {
- case "UiElements_05":
- this.fundsIconGreen = this.origFundsGreen = tex;
- break;
- case "UiElements_06":
- this.fundsIconRed = this.origFundsRed = tex;
- break;
- case "UiElements_07":
- this.reputationIconGreen = this.origRepGreen = tex;
- break;
- case "UiElements_08":
- this.reputationIconRed = this.origRepRed = tex;
- break;
- case "UiElements_12":
- this.scienceIcon = this.origScience = tex;
- break;
- default:
- continue;
- }
- }
+ bool texturesLoaded;
+
+ texturesLoaded = IOTools.LoadTexture(out this.fundsIconGreen, "VOID/Textures/fundsgreen.png", 10, 18);
+ texturesLoaded &= IOTools.LoadTexture(out this.fundsIconRed, "VOID/Textures/fundsred.png", 10, 18);
+ texturesLoaded &= IOTools.LoadTexture(out this.reputationIconGreen, "VOID/Textures/repgreen.png", 16, 18);
+ texturesLoaded &= IOTools.LoadTexture(out this.reputationIconRed, "VOID/Textures/repred.png", 16, 18);
+ texturesLoaded &= IOTools.LoadTexture(out this.scienceIcon, "VOID/Textures/science.png", 16, 18);
+
+ this.fundsContent = new GUIContent();
+ this.repContent = new GUIContent();
+ this.scienceContent = new GUIContent();
+
+ if (texturesLoaded)
+ {
+ this.fundsContent.image = this.fundsIconGreen;
+ this.repContent.image = this.reputationIconGreen;
+ this.scienceContent.image = this.scienceIcon;
+ }
+
+ this.currentFunds = Funding.Instance != null ? Funding.Instance.Funds : double.NaN;
+ this.currentReputation = Reputation.Instance != null ? Reputation.Instance.reputation : float.NaN;
+ this.currentScience = ResearchAndDevelopment.Instance != null ?
+ ResearchAndDevelopment.Instance.Science : float.NaN;
}
~VOID_CareerStatus()
@@ -291,8 +247,8 @@
return string.Empty;
}
- return string.Format("√{0} ({1})",
- VOID_CareerStatus.Instance.currentFunds,
+ return string.Format("{0} ({1})",
+ VOID_CareerStatus.Instance.currentFunds.ToString("#,#.##"),
VOID_CareerStatus.formatDelta(VOID_CareerStatus.Instance.lastFundsChange)
);
}
@@ -308,7 +264,7 @@
}
return string.Format("{0} ({1})",
- VOID_CareerStatus.Instance.currentReputation,
+ VOID_CareerStatus.Instance.currentReputation.ToString("#,#.##"),
VOID_CareerStatus.formatDelta(VOID_CareerStatus.Instance.lastRepChange)
);
}
@@ -324,7 +280,7 @@
}
return string.Format("{0} ({1})",
- VOID_CareerStatus.Instance.currentScience,
+ VOID_CareerStatus.Instance.currentScience.ToString("#,#.##"),
VOID_CareerStatus.formatDelta(VOID_CareerStatus.Instance.lastScienceChange)
);
}
--- a/VOID_Core.cs
+++ b/VOID_Core.cs
@@ -966,7 +966,7 @@
this.ToolbarButton.TexturePath = texturePath;
}
- this.VOIDIconTexture = GameDatabase.Instance.GetTexture(texturePath, false);
+ this.VOIDIconTexture = GameDatabase.Instance.GetTexture(texturePath.Replace("icon", "appIcon"), false);
if (this.AppLauncherButton != null)
{
@@ -1052,7 +1052,7 @@
this.VoidVersion = string.Format("{0}.{1}.{2}", version.Major, version.Minor, version.MajorRevision);
- this._Active.value = true;
+ this.toggleActive = true;
this._skinName = this.defaultSkin;
this._skinIdx = int.MinValue;
--- a/VOID_EditorHUD.cs
+++ b/VOID_EditorHUD.cs
@@ -120,7 +120,7 @@
{
this._Name = "Heads-Up Display";
- this._Active.value = true;
+ this.toggleActive = true;
this.textColors.Add(Color.green);
this.textColors.Add(Color.black);
@@ -164,6 +164,8 @@
return;
}
+ GUI.skin = this.core.Skin;
+
Rect hudPos = new Rect (hudLeft, 48, 300, 32);
hudString = new StringBuilder();
--- a/VOID_HUD.cs
+++ b/VOID_HUD.cs
@@ -85,7 +85,7 @@
{
this._Name = "Heads-Up Display";
- this._Active.value = true;
+ this.toggleActive = true;
this._colorIndex = 0;
@@ -216,6 +216,8 @@
this.core.LabelStyles["hud"].normal.textColor = textColors [ColorIndex];
+ GUI.skin = this.core.Skin;
+
if ((TimeWarp.WarpMode == TimeWarp.Modes.LOW) || (TimeWarp.CurrentRate <= TimeWarp.MaxPhysicsRate))
{
SimManager.RequestSimulation();
--- a/VOID_HUDAdvanced.cs
+++ b/VOID_HUDAdvanced.cs
@@ -78,7 +78,7 @@
{
this._Name = "Advanced Heads-Up Display";
- this._Active.value = true;
+ this.toggleActive = true;
this.leftHUDdefaultPos = new Rect(
Screen.width * .5f - (float)GameSettings.UI_SIZE * .25f - 300f,
--- a/VOID_Rendezvous.cs
+++ b/VOID_Rendezvous.cs
@@ -130,7 +130,7 @@
GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
GUILayout.Label(" ", GUILayout.ExpandWidth(true));
- if (GUILayout.Button("Close", GUILayout.ExpandWidth(false))) this._Active = false;
+ if (GUILayout.Button("Close", GUILayout.ExpandWidth(false))) this.toggleActive = false;
GUILayout.EndHorizontal();
GUILayout.EndVertical();
--- a/VOID_VesselInfo.cs
+++ b/VOID_VesselInfo.cs
@@ -66,7 +66,9 @@
VOID_Data.totalMass.DoGUIHorizontal ("F3");
- VOID_Data.comboResourceMass.DoGUIHorizontal ();
+ VOID_Data.stageResourceMass.DoGUIHorizontal("F2");
+
+ VOID_Data.resourceMass.DoGUIHorizontal("F2");
VOID_Data.stageDeltaV.DoGUIHorizontal (3, false);
@@ -131,7 +133,7 @@
);
public static readonly VOID_DoubleValue stageResourceMass = new VOID_DoubleValue(
- "Resource Mass (Current Stage)",
+ "Resource Mass (Stage)",
delegate()
{
if (SimManager.LastStage == null)
--- a/VOID_VesselRegister.cs
+++ b/VOID_VesselRegister.cs
@@ -142,7 +142,7 @@
if (_selectedVessel != v)
{
_selectedVessel = v; //set clicked vessel as selected_vessel
- this._Active.value = true; //turn bool on to open the window if closed
+ this.toggleActive = true; //turn bool on to open the window if closed
}
else
{