Deploy reworking, round 2.
Binary files /dev/null and b/GameData/VOID/Plugins/VOID.dll differ
Binary files /dev/null and b/GameData/VOID/Plugins/VesselSimulator.dll differ
--- /dev/null
+++ b/GameData/VOID/Textures/ATM_VOID.cfg
@@ -1,1 +1,16 @@
+ACTIVE_TEXTURE_MANAGER_CONFIG
+{
+ folder = VOID
+ enabled = true
+ OVERRIDES
+ {
+ VOID/.*
+ {
+ compress = true
+ mipmaps = false
+ scale = 1
+ max_size = 0
+ }
+ }
+}
Binary files /dev/null and b/GameData/VOID/Textures/fundsgreen.png differ
Binary files /dev/null and b/GameData/VOID/Textures/fundsred.png differ
Binary files /dev/null and b/GameData/VOID/Textures/repgreen.png differ
Binary files /dev/null and b/GameData/VOID/Textures/repred.png differ
Binary files /dev/null and b/GameData/VOID/Textures/science.png differ
Binary files /dev/null and b/GameData/VOID/Textures/void_appIcon_dark.png differ
Binary files /dev/null and b/GameData/VOID/Textures/void_appIcon_dark_glow.png differ
Binary files /dev/null and b/GameData/VOID/Textures/void_appIcon_light.png differ
Binary files /dev/null and b/GameData/VOID/Textures/void_appIcon_light_glow.png differ
Binary files /dev/null and b/GameData/VOID/Textures/void_icon_dark.png differ
Binary files /dev/null and b/GameData/VOID/Textures/void_icon_dark_glow.png differ
Binary files /dev/null and b/GameData/VOID/Textures/void_icon_light.png differ
Binary files /dev/null and b/GameData/VOID/Textures/void_icon_light_glow.png differ
--- a/Properties/AssemblyInfo.cs
+++ b/Properties/AssemblyInfo.cs
@@ -39,7 +39,7 @@
// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
// and "{Major}.{Minor}.{Build}.*" will update just the revision.
-[assembly: AssemblyVersion("0.16.*")]
+[assembly: AssemblyVersion("0.16.4.*")]
// The following attributes are used to specify the signing key for the assembly,
// if desired. See the Mono documentation for more information about signing.
//[assembly: AssemblyDelaySign(false)]
--- a/VOID.csproj
+++ b/VOID.csproj
@@ -54,7 +54,7 @@
<ConsolePause>false</ConsolePause>
<CustomCommands>
<CustomCommands>
- <Command type="AfterBuild" command="cp -afv ${TargetFile} /opt/games/KSP_linux/GameData/${ProjectName}/Plugins/" />
+ <Command type="AfterBuild" command="cp -afv ${TargetFile} ${ProjectDir}/GameData/${ProjectName}/Plugins/" />
</CustomCommands>
</CustomCommands>
</PropertyGroup>
@@ -67,7 +67,7 @@
<ConsolePause>false</ConsolePause>
<CustomCommands>
<CustomCommands>
- <Command type="AfterBuild" command="cp -afv ${TargetFile} /opt/games/KSP_linux/GameData/${ProjectName}/Plugins/" />
+ <Command type="AfterBuild" command="cp -afv ${TargetFile} ${ProjectDir}/GameData/${ProjectName}/Plugins/" />
</CustomCommands>
</CustomCommands>
</PropertyGroup>
@@ -132,5 +132,8 @@
<Name>VesselSimulator</Name>
</ProjectReference>
</ItemGroup>
+ <ItemGroup>
+ <None Include="GameData\VOID\Textures\ATM_VOID.cfg" />
+ </ItemGroup>
</Project>
--- a/VOID_Core.cs
+++ b/VOID_Core.cs
@@ -1139,7 +1139,7 @@
this.vesselSimActive = true;
- this.UseToolbarManager = false;
+ this.UseToolbarManager = ToolbarManager.ToolbarAvailable;
this.LoadConfig();
--- a/VOID_EditorHUD.cs
+++ b/VOID_EditorHUD.cs
@@ -42,11 +42,11 @@
/*
* Fields
* */
- [AVOID_SaveValue("ehudWindowPos")]
- protected VOID_SaveValue<Rect> ehudWindowPos;
-
protected HUDWindow ehudWindow;
protected EditorVesselOverlays _vesselOverlays;
+
+ [AVOID_SaveValue("snapToLeft")]
+ protected VOID_SaveValue<bool> snapToLeft;
/*
* Properties
@@ -101,12 +101,14 @@
this.toggleActive = true;
+ this.snapToLeft.value = true;
+
this.ehudWindow = new HUDWindow(
+ "editorHUD",
this.ehudWindowFunc,
new Rect(EditorPanels.Instance.partsPanelWidth + 10f, 125f, 300f, 64f)
);
this.Windows.Add(this.ehudWindow);
- this.ehudWindowPos = this.ehudWindow.WindowPos;
Tools.PostDebugMessage (this.GetType().Name + ": Constructed.");
}
@@ -120,7 +122,7 @@
return;
}
- // GUI.skin = AssetBase.GetGUISkin("KSP window 2");
+ VOID_Styles.labelHud.alignment = TextAnchor.UpperLeft;
hudString.Append("Total Mass: ");
hudString.Append(this.core.LastStage.totalMass.ToString("F3"));
@@ -148,8 +150,16 @@
hudString.Append("Bottom Stage T/W Ratio: ");
hudString.Append(this.core.LastStage.thrustToWeight.ToString("F3"));
+ Tools.PostDebugMessage(this,
+ "CoMmarker.gameObject.activeInHierarchy: {0};" +
+ "CoTmarker.gameObject.activeInHierarchy: {1}",
+ this.CoMmarker.gameObject.activeInHierarchy,
+ this.CoTmarker.gameObject.activeInHierarchy
+ );
+
if (this.CoMmarker.gameObject.activeInHierarchy && this.CoTmarker.gameObject.activeInHierarchy)
{
+ Tools.PostDebugMessage(this, "CoM and CoT markers are active, doing thrust offset.");
hudString.Append('\n');
hudString.Append("Thrust Offset: ");
@@ -159,8 +169,19 @@
this.CoMmarker.posMarkerObject.transform.position - this.CoTmarker.posMarkerObject.transform.position
).ToString("F3"));
}
-
- GUILayout.Label(hudString.ToString(), VOID_Styles.labelHud, GUILayout.ExpandWidth(true));
+ #if DEBUG
+ else
+ {
+ Tools.PostDebugMessage(this, "CoM and CoT markers are not active, thrust offset skipped.");
+ }
+ #endif
+
+ GUILayout.Label(
+ hudString.ToString(),
+ VOID_Styles.labelHud,
+ GUILayout.ExpandWidth(true),
+ GUILayout.ExpandHeight(true)
+ );
if (!this.positionsLocked)
{
@@ -189,8 +210,6 @@
{
return;
}
-
- bool snapToEdge = Mathf.Abs(this.ehudWindowPos.value.xMin - hudLeft) < 15f;
Tools.PostDebugMessage(this,
"EditorPartList topLeft.parent.parent.position: {0}\n" +
@@ -200,20 +219,27 @@
EditorPartList.Instance.transformTopLeft.parent.parent.position,
EditorPartList.Instance.transformTopLeft.parent.position,
EditorPartList.Instance.transformTopLeft.position,
- snapToEdge, this.ehudWindowPos.value.xMin, hudLeft
+ this.snapToLeft, this.ehudWindow.WindowPos.xMin, hudLeft
);
base.DrawGUI();
Rect hudPos = this.ehudWindow.WindowPos;
- hudPos.xMin = hudLeft;
+ if (this.snapToLeft && this.positionsLocked)
+ {
+ hudPos.xMin = hudLeft;
+ }
+ else
+ {
+ hudPos.xMin = Mathf.Max(hudLeft, hudPos.xMin);
+ }
+
hudPos.width = this.ehudWindow.defaultWindowPos.width;
- this.ehudWindowPos.value = hudPos;
-
- this.ehudWindow.WindowPos = this.ehudWindowPos;
-
+ this.ehudWindow.WindowPos = hudPos;
+
+ this.snapToLeft = Mathf.Abs(this.ehudWindow.WindowPos.xMin - hudLeft) < 15f;
}
}
}
--- a/VOID_HUD.cs
+++ b/VOID_HUD.cs
@@ -41,13 +41,8 @@
/*
* Fields
* */
- [AVOID_SaveValue("leftHUDPos")]
- protected VOID_SaveValue<Rect> leftHUDPos;
- [AVOID_SaveValue("rightHUDPos")]
- protected VOID_SaveValue<Rect> rightHUDPos;
-
- protected HUDWindow leftWindow;
- protected HUDWindow rightWindow;
+ protected HUDWindow leftHUD;
+ protected HUDWindow rightHUD;
/*
* Properties
@@ -62,25 +57,13 @@
this.toggleActive = true;
- this.leftWindow = new HUDWindow(this.leftHUDWindow, new Rect(Screen.width * .375f - 300f, 0f, 300f, 90f));
- this.Windows.Add(this.leftWindow);
+ this.leftHUD = new HUDWindow("leftHUD", this.leftHUDWindow, new Rect(Screen.width * .375f - 300f, 0f, 300f, 90f));
+ this.Windows.Add(this.leftHUD);
- this.leftHUDPos = this.leftWindow.WindowPos;
-
- this.rightWindow = new HUDWindow(this.rightHUDWindow, new Rect(Screen.width * .625f, 0f, 300f, 90f));
- this.Windows.Add(this.rightWindow);
-
- this.rightHUDPos = this.rightWindow.WindowPos;
+ this.rightHUD = new HUDWindow("rightHUD", this.rightHUDWindow, new Rect(Screen.width * .625f, 0f, 300f, 90f));
+ this.Windows.Add(this.rightHUD);
Tools.PostDebugMessage ("VOID_HUD: Constructed.");
- }
-
- public override void DrawGUI()
- {
- base.DrawGUI();
-
- this.leftHUDPos.value = this.leftWindow.WindowPos;
- this.rightHUDPos.value = this.rightWindow.WindowPos;
}
protected void leftHUDWindow(int id)
@@ -120,7 +103,12 @@
leftHUD.Append(string.Intern("-- POWER LOST --"));
}
- GUILayout.Label(leftHUD.ToString(), VOID_Styles.labelHud, GUILayout.ExpandWidth(true));
+ GUILayout.Label(
+ leftHUD.ToString(),
+ VOID_Styles.labelHud,
+ GUILayout.ExpandWidth(true),
+ GUILayout.ExpandHeight(true)
+ );
if (!this.positionsLocked)
{
@@ -181,7 +169,12 @@
}
- GUILayout.Label(rightHUD.ToString(), VOID_Styles.labelHud, GUILayout.ExpandWidth(true));
+ GUILayout.Label(
+ rightHUD.ToString(),
+ VOID_Styles.labelHud,
+ GUILayout.ExpandWidth(true),
+ GUILayout.ExpandHeight(true)
+ );
if (!this.positionsLocked)
{
--- a/VOID_HUDAdvanced.cs
+++ b/VOID_HUDAdvanced.cs
@@ -47,11 +47,6 @@
protected HUDWindow leftHUD;
protected HUDWindow rightHUD;
- [AVOID_SaveValue("leftHUDPos")]
- protected VOID_SaveValue<Rect> leftHUDPos;
- [AVOID_SaveValue("rightHUDPos")]
- protected VOID_SaveValue<Rect> rightHUDPos;
-
/*
* Properties
* */
@@ -81,23 +76,24 @@
this.toggleActive = true;
- this.leftHUD = new HUDWindow(this.leftHUDWindow, new Rect(
- Screen.width * .5f - (float)GameSettings.UI_SIZE * .25f - 300f,
- Screen.height - 200f,
- 300f, 90f)
+ this.leftHUD = new HUDWindow("leftHUD",
+ this.leftHUDWindow,
+ new Rect(
+ Screen.width * .5f - (float)GameSettings.UI_SIZE * .25f - 300f,
+ Screen.height - 200f,
+ 300f, 90f)
);
this.Windows.Add(this.leftHUD);
- this.leftHUDPos = this.leftHUD.WindowPos;
-
- this.rightHUD = new HUDWindow(this.rightHUDWindow, new Rect(
- Screen.width * .5f + (float)GameSettings.UI_SIZE * .25f,
- Screen.height - 200f,
- 300f, 90f)
+ this.rightHUD = new HUDWindow(
+ "rightHUD",
+ this.rightHUDWindow,
+ new Rect(
+ Screen.width * .5f + (float)GameSettings.UI_SIZE * .25f,
+ Screen.height - 200f,
+ 300f, 90f)
);
this.Windows.Add(this.rightHUD);
-
- this.rightHUDPos = this.rightHUD.WindowPos;
this.positionsLocked = true;
@@ -153,7 +149,12 @@
leftHUD.Append(string.Intern("-- POWER LOST --"));
}
- GUILayout.Label(leftHUD.ToString(), VOID_Styles.labelHud, GUILayout.ExpandWidth(true));
+ GUILayout.Label(
+ leftHUD.ToString(),
+ VOID_Styles.labelHud,
+ GUILayout.ExpandWidth(true),
+ GUILayout.ExpandHeight(true)
+ );
if (!this.positionsLocked)
{
@@ -212,7 +213,12 @@
rightHUD.Append(string.Intern("-- POWER LOST --"));
}
- GUILayout.Label(rightHUD.ToString(), VOID_Styles.labelHud, GUILayout.ExpandWidth(true));
+ GUILayout.Label(
+ rightHUD.ToString(),
+ VOID_Styles.labelHud,
+ GUILayout.ExpandWidth(true),
+ GUILayout.ExpandHeight(true)
+ );
if (!this.positionsLocked)
{
@@ -235,14 +241,28 @@
}
}
+ if (VOID_Data.upcomingManeuverNodes < 1 && this.Windows.Contains(this.rightHUD))
+ {
+ this.Windows.Remove(this.rightHUD);
+ }
+ else if (VOID_Data.upcomingManeuverNodes > 0 && !this.Windows.Contains(this.rightHUD))
+ {
+ this.Windows.Add(this.rightHUD);
+ }
+
base.DrawGUI();
-
- this.leftHUDPos.value = this.leftHUD.WindowPos;
- this.rightHUDPos.value = this.rightHUD.WindowPos;
}
public override void DrawConfigurables()
{
+ if (GUILayout.Button(string.Intern("Reset Advanced HUD Positions"), GUILayout.ExpandWidth(false)))
+ {
+ foreach (HUDWindow window in this.Windows)
+ {
+ window.WindowPos = new Rect(window.defaultWindowPos);
+ }
+ }
+
this.positionsLocked = GUILayout.Toggle(this.positionsLocked,
string.Intern("Lock Advanced HUD Positions"),
GUILayout.ExpandWidth(false));
--- a/VOID_HUDModule.cs
+++ b/VOID_HUDModule.cs
@@ -106,7 +106,7 @@
foreach (HUDWindow window in this.Windows)
{
- window.WindowPos = GUI.Window(
+ window.WindowPos = GUILayout.Window(
this.core.windowID,
window.WindowPos,
VOID_Tools.GetWindowHandler(window.WindowFunction),
@@ -135,12 +135,41 @@
string.Intern("Lock HUD Positions"),
GUILayout.ExpandWidth(false));
}
+
+ public override void LoadConfig()
+ {
+ base.LoadConfig();
+
+ var config = KSP.IO.PluginConfiguration.CreateForType<VOID_Core>();
+ config.load();
+
+ foreach (HUDWindow window in this.Windows)
+ {
+ string saveName = string.Format("{0}_{1}", this.GetType().Name, window.WindowName);
+ Rect loadedPos = config.GetValue(saveName, window.defaultWindowPos);
+
+ window.WindowPos = loadedPos;
+ }
+ }
+
+ public override void _SaveToConfig(KSP.IO.PluginConfiguration config)
+ {
+ base._SaveToConfig(config);
+
+ foreach (HUDWindow window in this.Windows)
+ {
+ string saveName = string.Format("{0}_{1}", this.GetType().Name, window.WindowName);
+ config.SetValue(saveName, window.WindowPos);
+ }
+ }
}
public class HUDWindow
{
public readonly Rect defaultWindowPos;
+ private Rect _windowPos;
+
public Action<int> WindowFunction
{
get;
@@ -149,14 +178,35 @@
public Rect WindowPos
{
+ get
+ {
+ return this._windowPos;
+ }
+ set
+ {
+ if (value != this._windowPos)
+ {
+ this._windowPos = value;
+
+ if (VOID_Data.core != null)
+ {
+ VOID_Data.core.configDirty = true;
+ }
+ }
+ }
+ }
+
+ public string WindowName
+ {
get;
- set;
+ private set;
}
private HUDWindow() {}
- public HUDWindow(Action<int> windowFunc, Rect defaultPos)
- {
+ public HUDWindow(string name, Action<int> windowFunc, Rect defaultPos)
+ {
+ this.WindowName = name;
this.WindowFunction = windowFunc;
this.defaultWindowPos = defaultPos;
this.WindowPos = new Rect(this.defaultWindowPos);