VOID_HUD: Re-added primary because I'm a loser.
VOID_HUD: Re-added primary because I'm a loser.

// //
// IntCollection.cs // IntCollection.cs
// //
// Author: // Author:
// toadicus <> // toadicus <>
// //
// Copyright (c) 2013 toadicus // Copyright (c) 2013 toadicus
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or // the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version. // (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
using System; using System;
   
namespace VOID namespace VOID
{ {
public class IntCollection public class IntCollection : IVOID_SaveValue
{ {
public static implicit operator long(IntCollection c) public static implicit operator long(IntCollection c)
{ {
return c.collection; return c.collection;
} }
   
protected long mask; protected long mask;
   
public long collection { get; protected set; } public long collection { get; protected set; }
public ushort maxCount { get; protected set; } public ushort maxCount { get; protected set; }
public ushort wordLength { get; protected set; } public ushort wordLength { get; protected set; }
   
  public Type type { get { return typeof(long); } }
  public object AsType { get { return this.collection; } }
   
  public void SetValue(object v)
  {
  this.collection = (long)v;
  }
   
public IntCollection (ushort wordLength = 4, long initialCollection = 0) public IntCollection (ushort wordLength = 4, long initialCollection = 0)
{ {
this.collection = initialCollection; this.collection = initialCollection;
this.wordLength = wordLength; this.wordLength = wordLength;
this.maxCount = (ushort)((sizeof(long) * 8 - 1) / wordLength); this.maxCount = (ushort)((sizeof(long) * 8 - 1) / wordLength);
this.mask = ((1 << this.wordLength) - 1); this.mask = ((1 << this.wordLength) - 1);
} }
   
public ushort this[int idx] public ushort this[int idx]
{ {
get { get {
if (idx < 0) { if (idx < 0) {
idx += this.maxCount; idx += this.maxCount;
} }
   
if (idx >= maxCount || idx < 0) { if (idx >= maxCount || idx < 0) {
throw new IndexOutOfRangeException (); throw new IndexOutOfRangeException ();
} }
   
idx *= wordLength; idx *= wordLength;
   
return (ushort)((this.collection & (this.mask << idx)) >> idx); return (ushort)((this.collection & (this.mask << idx)) >> idx);
} }
set { set {
Console.WriteLine (value); Console.WriteLine (value);
if (idx < 0) { if (idx < 0) {
idx += this.maxCount; idx += this.maxCount;
} }
   
if (idx >= maxCount || idx < 0) { if (idx >= maxCount || idx < 0) {
throw new IndexOutOfRangeException (); throw new IndexOutOfRangeException ();
} }
   
idx *= wordLength; idx *= wordLength;
   
long packvalue = value & this.mask; long packvalue = value & this.mask;
Console.WriteLine (packvalue); Console.WriteLine (packvalue);
   
this.collection &= ~(this.mask << idx); this.collection &= ~(this.mask << idx);
this.collection |= packvalue << idx; this.collection |= packvalue << idx;
} }
} }
} }
} }
   
   
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup> <PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform> <Platform Condition=" '$(Platform)' == '' ">x86</Platform>
<ProductVersion>10.0.0</ProductVersion> <ProductVersion>10.0.0</ProductVersion>
<SchemaVersion>2.0</SchemaVersion> <SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{45ACC1CC-942C-4A66-BFC7-8BE375938B18}</ProjectGuid> <ProjectGuid>{45ACC1CC-942C-4A66-BFC7-8BE375938B18}</ProjectGuid>
<OutputType>Library</OutputType> <OutputType>Library</OutputType>
<RootNamespace>VOID</RootNamespace> <RootNamespace>VOID</RootNamespace>
<AssemblyName>VOID</AssemblyName> <AssemblyName>VOID</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion> <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<DebugSymbols>true</DebugSymbols> <DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType> <DebugType>full</DebugType>
<Optimize>false</Optimize> <Optimize>false</Optimize>
<OutputPath>bin\Debug</OutputPath> <OutputPath>bin\Debug</OutputPath>
<DefineConstants>DEBUG; TRACE</DefineConstants> <DefineConstants>DEBUG; TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause> <ConsolePause>false</ConsolePause>
<CustomCommands> <CustomCommands>
<CustomCommands> <CustomCommands>
<Command type="AfterBuild" command="xcopy /Y ${ProjectDir}\bin\Debug\*.dll ..\..\..\Games\KSP_win\GameData\VOID\Plugins\" workingdir="${ProjectDir}" externalConsole="True" /> <Command type="AfterBuild" command="/usr/bin/cp -fv ${ProjectDir}/bin/Debug/VOID.dll /mnt/games/ssd/KSP_linux/GameData/VOID/Plugins/" />
</CustomCommands> </CustomCommands>
</CustomCommands> </CustomCommands>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<Optimize>true</Optimize> <Optimize>true</Optimize>
<OutputPath>bin\Release</OutputPath> <OutputPath>bin\Release</OutputPath>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause> <ConsolePause>false</ConsolePause>
<DefineConstants>TRACE</DefineConstants> <DefineConstants>TRACE</DefineConstants>
<CustomCommands> <CustomCommands>
<CustomCommands> <CustomCommands>
<Command type="AfterBuild" command="xcopy /Y ${ProjectDir}\bin\Release\*.dll ..\..\..\Games\KSP_win\GameData\VOID\Plugins\" workingdir="${ProjectDir}" externalConsole="True" /> <Command type="AfterBuild" command="/usr/bin/cp -fv ${ProjectDir}/bin/Release/VOID.dll /mnt/games/ssd/KSP_linux/GameData/VOID/Plugins/" />
</CustomCommands> </CustomCommands>
</CustomCommands> </CustomCommands>
</PropertyGroup> </PropertyGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ItemGroup> <ItemGroup>
<Compile Include="Tools.cs" /> <Compile Include="Tools.cs" />
<Compile Include="IVOID_Module.cs" /> <Compile Include="IVOID_Module.cs" />
<Compile Include="VOIDFlightMaster.cs" /> <Compile Include="VOIDFlightMaster.cs" />
<Compile Include="VOID_Core.cs" /> <Compile Include="VOID_Core.cs" />
<Compile Include="VOID_Module.cs" /> <Compile Include="VOID_Module.cs" />
<Compile Include="VOID_HUD.cs" /> <Compile Include="VOID_HUD.cs" />
<Compile Include="VOID_SaveValue.cs" /> <Compile Include="VOID_SaveValue.cs" />
<Compile Include="VOID_Orbital.cs" /> <Compile Include="VOID_Orbital.cs" />
<Compile Include="VOID_SurfAtmo.cs" /> <Compile Include="VOID_SurfAtmo.cs" />
<Compile Include="VOID_VesselInfo.cs" /> <Compile Include="VOID_VesselInfo.cs" />
<Compile Include="VOID_Transfer.cs" /> <Compile Include="VOID_Transfer.cs" />
<Compile Include="VOID_CBInfoBrowser.cs" /> <Compile Include="VOID_CBInfoBrowser.cs" />
<Compile Include="VOID_Rendezvous.cs" /> <Compile Include="VOID_Rendezvous.cs" />
<Compile Include="VOID_VesselRegister.cs" /> <Compile Include="VOID_VesselRegister.cs" />
<Compile Include="VOID_DataLogger.cs" /> <Compile Include="VOID_DataLogger.cs" />
<Compile Include="VOID_EditorCore.cs" /> <Compile Include="VOID_EditorCore.cs" />
<Compile Include="VOID_EditorHUD.cs" /> <Compile Include="VOID_EditorHUD.cs" />
<Compile Include="IntCollection.cs" /> <Compile Include="IntCollection.cs" />
<Compile Include="VOID_DataValue.cs" />  
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Reference Include="Assembly-CSharp"> <Reference Include="Assembly-CSharp">
<HintPath>..\..\..\Games\KSP_win\KSP_Data\Managed\Assembly-CSharp.dll</HintPath> <HintPath>..\..\..\..\..\mnt\games-ssd\KSP_linux\KSP_Data\Managed\Assembly-CSharp.dll</HintPath>
<Private>False</Private> <Private>False</Private>
</Reference> </Reference>
<Reference Include="UnityEngine"> <Reference Include="UnityEngine">
<HintPath>..\..\..\Games\KSP_win\KSP_Data\Managed\UnityEngine.dll</HintPath> <HintPath>..\..\..\..\..\mnt\games-ssd\KSP_linux\KSP_Data\Managed\UnityEngine.dll</HintPath>
<Private>False</Private> <Private>False</Private>
</Reference> </Reference>
<Reference Include="System"> <Reference Include="System">
<HintPath>..\..\..\Games\KSP_win\KSP_Data\Managed\System.dll</HintPath> <HintPath>..\..\..\..\..\mnt\games-ssd\KSP_linux\KSP_Data\Managed\System.dll</HintPath>
<Private>False</Private> <Private>False</Private>
</Reference> </Reference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\Engineer.Extensions\Engineer.Extensions.csproj"> <ProjectReference Include="..\Engineer.Extensions\Engineer.Extensions.csproj">
<Project>{2FCF882B-0771-4649-8D04-81D7AA76A486}</Project> <Project>{2FCF882B-0771-4649-8D04-81D7AA76A486}</Project>
<Name>Engineer.Extensions</Name> <Name>Engineer.Extensions</Name>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\VesselSimulator\VesselSimulator.csproj"> <ProjectReference Include="..\VesselSimulator\VesselSimulator.csproj">
<Project>{30FD6C0B-D36E-462F-B0FF-F0FAC9C666CF}</Project> <Project>{30FD6C0B-D36E-462F-B0FF-F0FAC9C666CF}</Project>
<Name>VesselSimulator</Name> <Name>VesselSimulator</Name>
</ProjectReference> </ProjectReference>
</ItemGroup> </ItemGroup>
<ProjectExtensions> <ProjectExtensions>
<MonoDevelop> <MonoDevelop>
<Properties> <Properties>
<Policies> <Policies>
<StandardHeader Text=" &#xA; ${FileName}&#xA; &#xA; Author:&#xA; ${AuthorName} &lt;${AuthorEmail}&gt;&#xA;&#xA; Copyright (c) ${Year} ${CopyrightHolder}&#xA;&#xA; This program is free software: you can redistribute it and/or modify&#xA; it under the terms of the GNU General Public License as published by&#xA; the Free Software Foundation, either version 3 of the License, or&#xA; (at your option) any later version.&#xA;&#xA; This program is distributed in the hope that it will be useful,&#xA; but WITHOUT ANY WARRANTY; without even the implied warranty of&#xA; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the&#xA; GNU General Public License for more details.&#xA;&#xA; You should have received a copy of the GNU General Public License&#xA; along with this program. If not, see &lt;http://www.gnu.org/licenses/&gt;." IncludeInNewFiles="True" /> <StandardHeader Text=" &#xA; ${FileName}&#xA; &#xA; Author:&#xA; ${AuthorName} &lt;${AuthorEmail}&gt;&#xA;&#xA; Copyright (c) ${Year} ${CopyrightHolder}&#xA;&#xA; This program is free software: you can redistribute it and/or modify&#xA; it under the terms of the GNU General Public License as published by&#xA; the Free Software Foundation, either version 3 of the License, or&#xA; (at your option) any later version.&#xA;&#xA; This program is distributed in the hope that it will be useful,&#xA; but WITHOUT ANY WARRANTY; without even the implied warranty of&#xA; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the&#xA; GNU General Public License for more details.&#xA;&#xA; You should have received a copy of the GNU General Public License&#xA; along with this program. If not, see &lt;http://www.gnu.org/licenses/&gt;." IncludeInNewFiles="True" />
</Policies> </Policies>
</Properties> </Properties>
</MonoDevelop> </MonoDevelop>
</ProjectExtensions> </ProjectExtensions>
</Project> </Project>
file:a/VOID_DataValue.cs (deleted)
//  
// VOID_DataValue.cs  
//  
// Author:  
// toadicus <>  
//  
// Copyright (c) 2013 toadicus  
//  
// This program is free software: you can redistribute it and/or modify  
// it under the terms of the GNU General Public License as published by  
// the Free Software Foundation, either version 3 of the License, or  
// (at your option) any later version.  
//  
// This program is distributed in the hope that it will be useful,  
// but WITHOUT ANY WARRANTY; without even the implied warranty of  
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the  
// GNU General Public License for more details.  
//  
// You should have received a copy of the GNU General Public License  
// along with this program. If not, see <http://www.gnu.org/licenses/>.  
using System;  
using UnityEngine;  
 
namespace VOID  
{  
public interface IVOID_DataValue  
{  
void Refresh();  
}  
 
public class VOID_DataValue<T> : IVOID_DataValue  
{  
/*  
* Static Members  
* */  
public static implicit operator T(VOID_DataValue<T> v)  
{  
return (T)v.Value;  
}  
 
/*  
* Instance Members  
* */  
/*  
* Fields  
* */  
protected T cache;  
protected Func<T> ValueFunc;  
 
/*  
* Properties  
* */  
public string Label { get; protected set; }  
public string Units { get; protected set; }  
 
public T Value {  
get {  
return (T)this.cache;  
}  
}  
 
public string ValueUnitString {  
get {  
return this.Value.ToString() + this.Units;  
}  
}  
 
 
/*  
* Methods  
* */  
public VOID_DataValue(string Label, Func<T> ValueFunc, string Units = "")  
{  
this.Label = Label;  
this.Units = Units;  
this.ValueFunc = ValueFunc;  
this.cache = this.ValueFunc.Invoke ();  
}  
 
public void Refresh()  
{  
this.cache = this.ValueFunc.Invoke ();  
}  
 
public T GetFreshValue()  
{  
this.Refresh ();  
return (T)this.cache;  
}  
 
public virtual void DoGUIHorizontal()  
{  
GUILayout.BeginHorizontal (GUILayout.ExpandWidth (true));  
GUILayout.Label (this.Label + ":");  
GUILayout.FlexibleSpace ();  
GUILayout.Label (this.ValueUnitString, GUILayout.ExpandWidth (false));  
GUILayout.EndHorizontal ();  
}  
 
public override string ToString()  
{  
return string.Format (  
"{0}: {1}{2}",  
this.Label,  
this.Value.ToString (),  
this.Units  
);  
}  
}  
 
internal interface IVOID_NumericValue  
{  
string ToString(string format);  
string ToSIString(int digits, int MinMagnitude, int MaxMagnitude);  
}  
 
public abstract class VOID_NumValue<T> : VOID_DataValue<T>, IVOID_NumericValue  
{  
public VOID_NumValue(string Label, Func<T> ValueFunc, string Units = "") : base(Label, ValueFunc, Units) {}  
 
public abstract string ToString(string Format);  
public abstract string ToSIString(int digits = 3, int MinMagnitude = 0, int MaxMagnitude = int.MaxValue);  
 
public ushort DoGUIHorizontal(ushort digits)  
{  
GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));  
GUILayout.Label(this.Label + ":", GUILayout.ExpandWidth(true));  
GUILayout.FlexibleSpace();  
GUILayout.Label(  
this.ToSIString(digits),  
GUILayout.ExpandWidth(false)  
);  
if (GUILayout.Button ("P")) {  
digits = (ushort)((digits + 3) % 15);  
}  
GUILayout.EndHorizontal();  
 
return digits;  
}  
public override void DoGUIHorizontal ()  
{  
this.DoGUIHorizontal (3);  
}  
}  
 
public class VOID_DoubleValue : VOID_NumValue<double>, IVOID_NumericValue  
{  
public VOID_DoubleValue(string Label, Func<double> ValueFunc, string Units) : base(Label, ValueFunc, Units) {}  
 
public override string ToString(string format)  
{  
return string.Format (  
"{0}: {1}{2}",  
this.Label,  
this.Value.ToString (format),  
this.Units  
);  
}  
 
public override string ToSIString(int digits = 3, int MinMagnitude = 0, int MaxMagnitude = int.MaxValue)  
{  
return string.Format (  
"{0}{1}",  
Tools.MuMech_ToSI (this.Value, digits, MinMagnitude, MaxMagnitude),  
this.Units  
);  
}  
}  
public class VOID_FloatValue : VOID_NumValue<float>, IVOID_NumericValue  
{  
public VOID_FloatValue(string Label, Func<float> ValueFunc, string Units) : base(Label, ValueFunc, Units) {}  
 
public override string ToString(string format)  
{  
return string.Format (  
"{0}: {1}{2}",  
this.Label,  
this.Value.ToString (format),  
this.Units  
);  
}  
 
public override string ToSIString(int digits = 3, int MinMagnitude = 0, int MaxMagnitude = int.MaxValue)  
{  
return string.Format (  
"{0}{1}",  
Tools.MuMech_ToSI ((double)this.Value, digits, MinMagnitude, MaxMagnitude),  
this.Units  
);  
}  
}  
public class VOID_IntValue : VOID_NumValue<int>, IVOID_NumericValue  
{  
public VOID_IntValue(string Label, Func<int> ValueFunc, string Units) : base(Label, ValueFunc, Units) {}  
 
public override string ToString(string format)  
{  
return string.Format (  
"{0}: {1}{2}",  
this.Label,  
this.Value.ToString (format),  
this.Units  
);  
}  
 
public override string ToSIString(int digits = 3, int MinMagnitude = 0, int MaxMagnitude = int.MaxValue)  
{  
return string.Format (  
"{0}{1}",  
Tools.MuMech_ToSI ((double)this.Value, digits, MinMagnitude, MaxMagnitude),  
this.Units  
);  
}  
}  
 
 
public class VOID_StrValue : VOID_DataValue<string>  
{  
public VOID_StrValue(string Label, Func<string> ValueFunc, string Units = "") : base(Label, ValueFunc, Units) {}  
}  
}  
 
 
// //
// VOID_Hud.cs // VOID_Hud.cs
// //
// Author: // Author:
// toadicus <> // toadicus <>
// //
// Copyright (c) 2013 toadicus // Copyright (c) 2013 toadicus
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or // the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version. // (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
// //
   
using KSP; using KSP;
using UnityEngine; using UnityEngine;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
   
namespace VOID namespace VOID
{ {
public class VOID_HUD : VOID_Module, IVOID_Module public class VOID_HUD : VOID_Module, IVOID_Module
{ {
/* /*
* Fields * Fields
* */ * */
[AVOID_SaveValue("colorIndex")] [AVOID_SaveValue("colorIndex")]
protected VOID_SaveValue<int> _colorIndex = 0; protected VOID_SaveValue<int> _colorIndex = 0;
   
protected List<Color> textColors = new List<Color>(); protected List<Color> textColors = new List<Color>();
   
protected GUIStyle labelStyle; protected GUIStyle labelStyle;
   
/* /*
* Properties * Properties
* */ * */
public int ColorIndex public int ColorIndex
{ {
get get
{ {
return this._colorIndex; return this._colorIndex;
} }
set set
{ {
if (this._colorIndex >= this.textColors.Count - 1) if (this._colorIndex >= this.textColors.Count - 1)
{ {
this._colorIndex = 0; this._colorIndex = 0;
return; return;
} }
   
this._colorIndex = value; this._colorIndex = value;
} }
} }
   
/* /*
* Methods * Methods
* */ * */
public VOID_HUD() : base() public VOID_HUD() : base()
{ {
this._Name = "Heads-Up Display"; this._Name = "Heads-Up Display";
   
this._Active = true; this._Active = true;
   
this.textColors.Add(Color.green); this.textColors.Add(Color.green);
this.textColors.Add(Color.black); this.textColors.Add(Color.black);
this.textColors.Add(Color.white); this.textColors.Add(Color.white);
this.textColors.Add(Color.red); this.textColors.Add(Color.red);
this.textColors.Add(Color.blue); this.textColors.Add(Color.blue);
this.textColors.Add(Color.yellow); this.textColors.Add(Color.yellow);
this.textColors.Add(Color.gray); this.textColors.Add(Color.gray);
this.textColors.Add(Color.cyan); this.textColors.Add(Color.cyan);
this.textColors.Add(Color.magenta); this.textColors.Add(Color.magenta);
   
this.labelStyle = new GUIStyle (); this.labelStyle = new GUIStyle ();
this.labelStyle.normal.textColor = this.textColors [this.ColorIndex]; this.labelStyle.normal.textColor = this.textColors [this.ColorIndex];
   
Tools.PostDebugMessage ("VOID_HUD: Constructed."); Tools.PostDebugMessage ("VOID_HUD: Constructed.");
} }
   
public override void DrawGUI() public override void DrawGUI()
{ {
GUI.skin = VOID_Core.Instance.Skin; GUI.skin = VOID_Core.Instance.Skin;
   
if (VOID_Core.Instance.powerAvailable) if (VOID_Core.Instance.powerAvailable)
{ {
labelStyle.normal.textColor = textColors [ColorIndex]; labelStyle.normal.textColor = textColors [ColorIndex];
   
GUI.Label ( GUI.Label (
new Rect ((Screen.width * .2083f), 0, 300f, 70f), new Rect ((Screen.width * .2083f), 0, 300f, 70f),
"Obt Alt: " + Tools.MuMech_ToSI (vessel.orbit.altitude) + "m" + "Obt Alt: " + Tools.MuMech_ToSI (vessel.orbit.altitude) + "m" +
" Obt Vel: " + Tools.MuMech_ToSI (vessel.orbit.vel.magnitude) + "m/s" + " Obt Vel: " + Tools.MuMech_ToSI (vessel.orbit.vel.magnitude) + "m/s" +
"\nAp: " + Tools.MuMech_ToSI (vessel.orbit.ApA) + "m" + "\nAp: " + Tools.MuMech_ToSI (vessel.orbit.ApA) + "m" +
" ETA " + Tools.ConvertInterval (vessel.orbit.timeToAp) + " ETA " + Tools.ConvertInterval (vessel.orbit.timeToAp) +
"\nPe: " + Tools.MuMech_ToSI (vessel.orbit.PeA) + "m" + "\nPe: " + Tools.MuMech_ToSI (vessel.orbit.PeA) + "m" +
" ETA " + Tools.ConvertInterval (vessel.orbit.timeToPe) + " ETA " + Tools.ConvertInterval (vessel.orbit.timeToPe) +
"\nInc: " + vessel.orbit.inclination.ToString ("F3") + "°", "\nInc: " + vessel.orbit.inclination.ToString ("F3") + "°" +
  "\nPrimary: " + vessel.mainBody.bodyName,
labelStyle); labelStyle);
// Toadicus edit: Added "Biome: " line to surf/atmo HUD // Toadicus edit: Added "Biome: " line to surf/atmo HUD
GUI.Label ( GUI.Label (
new Rect ((Screen.width * .625f), 0, 300f, 90f), new Rect ((Screen.width * .625f), 0, 300f, 90f),
"Srf Alt: " + Tools.MuMech_ToSI (Tools.TrueAltitude (vessel)) + "m" + "Srf Alt: " + Tools.MuMech_ToSI (Tools.TrueAltitude (vessel)) + "m" +
" Srf Vel: " + Tools.MuMech_ToSI (vessel.srf_velocity.magnitude) + "m/s" + " Srf Vel: " + Tools.MuMech_ToSI (vessel.srf_velocity.magnitude) + "m/s" +
"\nVer: " + Tools.MuMech_ToSI (vessel.verticalSpeed) + "m/s" + "\nVer: " + Tools.MuMech_ToSI (vessel.verticalSpeed) + "m/s" +
" Hor: " + Tools.MuMech_ToSI (vessel.horizontalSrfSpeed) + "m/s" + " Hor: " + Tools.MuMech_ToSI (vessel.horizontalSrfSpeed) + "m/s" +
"\nLat: " + Tools.GetLatitudeString (vessel, "F3") + "\nLat: " + Tools.GetLatitudeString (vessel, "F3") +
" Lon: " + Tools.GetLongitudeString (vessel, "F3") + " Lon: " + Tools.GetLongitudeString (vessel, "F3") +
"\nHdg: " + Tools.MuMech_get_heading (vessel).ToString ("F2") + "° " + "\nHdg: " + Tools.MuMech_get_heading (vessel).ToString ("F2") + "° " +
Tools.get_heading_text (Tools.MuMech_get_heading (vessel)) + Tools.get_heading_text (Tools.MuMech_get_heading (vessel)) +
"\nBiome: " + Tools.Toadicus_GetAtt (vessel).name, "\nBiome: " + Tools.Toadicus_GetAtt (vessel).name,
labelStyle); labelStyle);
} }
else else
{ {
labelStyle.normal.textColor = Color.red; labelStyle.normal.textColor = Color.red;
GUI.Label (new Rect ((Screen.width * .2083f), 0, 300f, 70f), "-- POWER LOST --", labelStyle); GUI.Label (new Rect ((Screen.width * .2083f), 0, 300f, 70f), "-- POWER LOST --", labelStyle);
GUI.Label (new Rect ((Screen.width * .625f), 0, 300f, 70f), "-- POWER LOST --", labelStyle); GUI.Label (new Rect ((Screen.width * .625f), 0, 300f, 70f), "-- POWER LOST --", labelStyle);
} }
} }
   
public override void DrawConfigurables() public override void DrawConfigurables()
{ {
if (GUILayout.Button ("Change HUD color", GUILayout.ExpandWidth (false))) if (GUILayout.Button ("Change HUD color", GUILayout.ExpandWidth (false)))
{ {
++this.ColorIndex; ++this.ColorIndex;
} }
} }
} }
} }
   
// //
// VOID_Module.cs // VOID_Module.cs
// //
// Author: // Author:
// toadicus <> // toadicus <>
// //
// Copyright (c) 2013 toadicus // Copyright (c) 2013 toadicus
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or // the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version. // (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Reflection; using System.Reflection;
using UnityEngine; using UnityEngine;
   
namespace VOID namespace VOID
{ {
public abstract class VOID_Module : IVOID_Module public abstract class VOID_Module : IVOID_Module
{ {
/* /*
* Fields * Fields
* */ * */
[AVOID_SaveValue("Active")] [AVOID_SaveValue("Active")]
protected VOID_SaveValue<bool> _Active = false; protected VOID_SaveValue<bool> _Active = false;
protected bool _Running = false; protected bool _Running = false;
   
protected string _Name; protected string _Name;
   
protected float lastUpdate = 0; protected float lastUpdate = 0;
   
/* /*
* Properties * Properties
* */ * */
public virtual bool toggleActive public virtual bool toggleActive
{ {
get get
{ {
return this._Active; return this._Active;
} }
set set
{ {
this._Active = value; this._Active = value;
} }
} }
   
public virtual bool guiRunning public virtual bool guiRunning
{ {
get get
{ {
return this._Running; return this._Running;
} }
} }
   
public virtual string Name public virtual string Name
{ {
get get
{ {
return this._Name; return this._Name;
} }
} }
   
public virtual Vessel vessel public virtual Vessel vessel
{ {
get get
{ {
return FlightGlobals.ActiveVessel; return FlightGlobals.ActiveVessel;
} }
} }
   
/* /*
* Methods * Methods
* */ * */
public void StartGUI() public void StartGUI()
{ {
if (!this.toggleActive || this.guiRunning) if (!this.toggleActive || this.guiRunning)
{ {
return; return;
} }
   
Tools.PostDebugMessage (string.Format("Adding {0} to the draw queue.", this.GetType().Name)); Tools.PostDebugMessage (string.Format("Adding {0} to the draw queue.", this.GetType().Name));
RenderingManager.AddToPostDrawQueue (3, this.DrawGUI); RenderingManager.AddToPostDrawQueue (3, this.DrawGUI);
this._Running = true; this._Running = true;
} }
   
public void StopGUI() public void StopGUI()
{ {
if (!this.guiRunning) if (!this.guiRunning)
{ {
return; return;
} }
Tools.PostDebugMessage (string.Format("Removing {0} from the draw queue.", this.GetType().Name)); Tools.PostDebugMessage (string.Format("Removing {0} from the draw queue.", this.GetType().Name));
RenderingManager.RemoveFromPostDrawQueue (3, this.DrawGUI); RenderingManager.RemoveFromPostDrawQueue (3, this.DrawGUI);
this._Running = false; this._Running = false;
} }
   
public abstract void DrawGUI(); public abstract void DrawGUI();
   
public virtual void DrawConfigurables() {} public virtual void DrawConfigurables() {}
   
public virtual void LoadConfig() public virtual void LoadConfig()
{ {
var config = KSP.IO.PluginConfiguration.CreateForType<VOID_Core> (); var config = KSP.IO.PluginConfiguration.CreateForType<VOID_Core> ();
config.load (); config.load ();
   
foreach (var field in this.GetType().GetFields( foreach (var field in this.GetType().GetFields(
BindingFlags.NonPublic | BindingFlags.NonPublic |
BindingFlags.Public | BindingFlags.Public |
BindingFlags.Instance | BindingFlags.Instance |
BindingFlags.FlattenHierarchy BindingFlags.FlattenHierarchy
)) ))
{ {
object[] attrs = field.GetCustomAttributes(typeof(AVOID_SaveValue), false); object[] attrs = field.GetCustomAttributes(typeof(AVOID_SaveValue), false);
   
if (attrs.Length == 0) { if (attrs.Length == 0) {
continue; continue;
} }
   
AVOID_SaveValue attr = attrs.FirstOrDefault () as AVOID_SaveValue; AVOID_SaveValue attr = attrs.FirstOrDefault () as AVOID_SaveValue;
   
string fieldName = string.Format("{0}_{1}", this.GetType().Name, attr.Name); string fieldName = string.Format("{0}_{1}", this.GetType().Name, attr.Name);
   
object fieldValue = field.GetValue(this); object fieldValue = field.GetValue(this);
   
bool convertBack = false; bool convertBack = false;
  bool isIntCollection = false;
if (fieldValue is IVOID_SaveValue) if (fieldValue is IVOID_SaveValue)
{ {
  if (fieldValue is IntCollection) {
  isIntCollection = true;
  }
fieldValue = (fieldValue as IVOID_SaveValue).AsType; fieldValue = (fieldValue as IVOID_SaveValue).AsType;
convertBack = true; convertBack = true;
} }
   
fieldValue = config.GetValue(fieldName, fieldValue); fieldValue = config.GetValue(fieldName, fieldValue);
   
if (convertBack) if (isIntCollection) {
  fieldValue = new IntCollection (4, (long)fieldValue);
  }
  else if (convertBack)
{ {
Type type = typeof(VOID_SaveValue<>).MakeGenericType (fieldValue.GetType ()); Type type = typeof(VOID_SaveValue<>).MakeGenericType (fieldValue.GetType ());
IVOID_SaveValue convertValue = Activator.CreateInstance (type) as IVOID_SaveValue; IVOID_SaveValue convertValue = Activator.CreateInstance (type) as IVOID_SaveValue;
convertValue.SetValue (fieldValue); convertValue.SetValue (fieldValue);
fieldValue = convertValue; fieldValue = convertValue;
} }
   
field.SetValue (this, fieldValue); field.SetValue (this, fieldValue);
   
Tools.PostDebugMessage(string.Format("{0}: Loaded field {1}.", this.GetType().Name, fieldName)); Tools.PostDebugMessage(string.Format("{0}: Loaded field {1}.", this.GetType().Name, fieldName));
} }
} }
   
public virtual void _SaveToConfig(KSP.IO.PluginConfiguration config) public virtual void _SaveToConfig(KSP.IO.PluginConfiguration config)
{ {
foreach (var field in this.GetType().GetFields( foreach (var field in this.GetType().GetFields(
BindingFlags.Instance | BindingFlags.Instance |
BindingFlags.NonPublic | BindingFlags.NonPublic |
BindingFlags.Public | BindingFlags.Public |
BindingFlags.FlattenHierarchy BindingFlags.FlattenHierarchy
)) ))
{ {
object[] attrs = field.GetCustomAttributes(typeof(AVOID_SaveValue), false); object[] attrs = field.GetCustomAttributes(typeof(AVOID_SaveValue), false);
   
if (attrs.Length == 0) { if (attrs.Length == 0) {
continue; continue;
} }
   
AVOID_SaveValue attr = attrs.FirstOrDefault () as AVOID_SaveValue; AVOID_SaveValue attr = attrs.FirstOrDefault () as AVOID_SaveValue;
   
string fieldName = string.Format("{0}_{1}", this.GetType().Name, attr.Name); string fieldName = string.Format("{0}_{1}", this.GetType().Name, attr.Name);
   
object fieldValue = field.GetValue(this); object fieldValue = field.GetValue(this);
   
if (fieldValue is IVOID_SaveValue) if (fieldValue is IVOID_SaveValue)
{ {
fieldValue = (fieldValue as IVOID_SaveValue).AsType; fieldValue = (fieldValue as IVOID_SaveValue).AsType;
} }
   
config.SetValue(fieldName, fieldValue); config.SetValue(fieldName, fieldValue);
   
Tools.PostDebugMessage(string.Format("{0}: Saved field {1}.", this.GetType().Name, fieldName)); Tools.PostDebugMessage(string.Format("{0}: Saved field {1}.", this.GetType().Name, fieldName));
} }
} }
} }
   
public abstract class VOID_WindowModule : VOID_Module public abstract class VOID_WindowModule : VOID_Module
{ {
[AVOID_SaveValue("WindowPos")] [AVOID_SaveValue("WindowPos")]
protected Rect WindowPos = new Rect(Screen.width / 2, Screen.height / 2, 250f, 50f); protected Rect WindowPos = new Rect(Screen.width / 2, Screen.height / 2, 250f, 50f);
protected float defWidth = 250f; protected float defWidth = 250f;
protected float defHeight = 50f; protected float defHeight = 50f;
   
public virtual void ModuleWindow(int _) public abstract void ModuleWindow(int _);
{  
if (VOID_Core.Instance.updateTimer - this.lastUpdate > VOID_Core.Instance.updatePeriod) {  
Tools.PostDebugMessage(string.Format(  
"{0}: refreshing VOID_DataValues.",  
this.GetType().Name  
));  
   
foreach (var fieldinfo in this.GetType().GetFields(  
BindingFlags.Instance |  
BindingFlags.NonPublic |  
BindingFlags.Public |  
BindingFlags.FlattenHierarchy  
)) {  
Tools.PostDebugMessage(string.Format(  
"{0}: checking field {1}.",  
this.GetType().Name,  
fieldinfo.Name  
));  
   
object field = null;  
   
try  
{  
field = fieldinfo.GetValue (this);  
}  
catch (NullReferenceException) {  
Tools.PostDebugMessage(string.Format(  
"{0}: caught NullReferenceException, could not get value for field {1}.",  
this.GetType().Name,  
fieldinfo.Name  
));  
}  
   
if (field == null) {  
continue;  
}  
   
if (typeof(IVOID_DataValue).IsAssignableFrom (field.GetType ())) {  
Tools.PostDebugMessage(string.Format(  
"{0}: found field {1}.",  
this.GetType().Name,  
fieldinfo.Name  
));  
   
(field as IVOID_DataValue).Refresh ();  
   
Tools.PostDebugMessage(string.Format(  
"{0}: refreshed field {1}.",  
this.GetType().Name,  
fieldinfo.Name  
));  
}  
}  
   
this.lastUpdate = VOID_Core.Instance.updateTimer;  
}  
}  
   
public override void DrawGUI() public override void DrawGUI()
{ {
Rect _Pos = this.WindowPos; Rect _Pos = this.WindowPos;
   
_Pos = GUILayout.Window( _Pos = GUILayout.Window(
VOID_Core.Instance.windowID, VOID_Core.Instance.windowID,
_Pos, _Pos,
this.ModuleWindow, this.ModuleWindow,
this.Name, this.Name,
GUILayout.Width(this.defWidth), GUILayout.Width(this.defWidth),
GUILayout.Height(this.defHeight) GUILayout.Height(this.defHeight)
); );
   
_Pos = Tools.ClampRectToScreen (_Pos); _Pos = Tools.ClampRectToScreen (_Pos);
   
if (_Pos != this.WindowPos) if (_Pos != this.WindowPos)
{ {
this.WindowPos = _Pos; this.WindowPos = _Pos;
VOID_Core.Instance.configDirty = true; VOID_Core.Instance.configDirty = true;
} }
} }
} }
} }
   
   
// //
// VOID_Orbital.cs // VOID_Orbital.cs
// //
// Author: // Author:
// toadicus <> // toadicus <>
// //
// Copyright (c) 2013 toadicus // Copyright (c) 2013 toadicus
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or // the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version. // (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
using KSP; using KSP;
using System; using System;
using UnityEngine; using UnityEngine;
   
namespace VOID namespace VOID
{ {
public class VOID_Orbital : VOID_WindowModule public class VOID_Orbital : VOID_WindowModule
{ {
[AVOID_SaveValue("toggleExtended")] [AVOID_SaveValue("toggleExtended")]
protected VOID_SaveValue<bool> toggleExtended = false; protected VOID_SaveValue<bool> toggleExtended = false;
   
[AVOID_SaveValue("precisionValues")] [AVOID_SaveValue("precisionValues")]
protected long _precisionValues = 230584300921369395; protected IntCollection precisionValues = new IntCollection(4, 230584300921369395);
protected IntCollection precisionValues;  
  protected double orbitAltitude;
protected VOID_StrValue primaryName = new VOID_StrValue ( protected double orbitVelocity;
VOIDLabels.void_primary,  
new Func<string> (() => VOID_Core.Instance.vessel.mainBody.name)  
);  
protected VOID_DoubleValue orbitAltitude = new VOID_DoubleValue (  
"Altitude (ASL)",  
new Func<double> (() => VOID_Core.Instance.vessel.orbit.altitude),  
"m"  
);  
protected VOID_DoubleValue orbitVelocity = new VOID_DoubleValue (  
VOIDLabels.void_velocity,  
new Func<double>  
(() => VOID_Core.Instance.vessel.orbit.vel.magnitude),  
"m/s"  
);  
protected double orbitApoAlt; protected double orbitApoAlt;
protected double oribtPeriAlt; protected double oribtPeriAlt;
protected string timeToApo; protected string timeToApo;
protected string timeToPeri; protected string timeToPeri;
protected double orbitInclination; protected double orbitInclination;
protected double gravityAccel; protected double gravityAccel;
protected string orbitPeriod; protected string orbitPeriod;
protected double semiMajorAxis; protected double semiMajorAxis;
protected double eccentricity; protected double eccentricity;
protected double meanAnomaly; protected double meanAnomaly;
protected double trueAnomaly; protected double trueAnomaly;
protected double eccAnomaly; protected double eccAnomaly;
protected double longitudeAscNode; protected double longitudeAscNode;
protected double argumentPeriapsis; protected double argumentPeriapsis;
protected double localSiderealLongitude; protected double localSiderealLongitude;
   
public VOID_Orbital() public VOID_Orbital()
{ {
this._Name = "Orbital Information"; this._Name = "Orbital Information";
   
this.WindowPos.x = Screen.width - 520f; this.WindowPos.x = Screen.width - 520f;
this.WindowPos.y = 250f; this.WindowPos.y = 250f;
} }
   
public override void ModuleWindow(int _) public override void ModuleWindow(int _)
{ {
base.ModuleWindow (_);  
   
if (VOID_Core.Instance.updateTimer >= this.lastUpdate + VOID_Core.Instance.updatePeriod) if (VOID_Core.Instance.updateTimer >= this.lastUpdate + VOID_Core.Instance.updatePeriod)
{ {
this.lastUpdate = VOID_Core.Instance.updateTimer; this.lastUpdate = VOID_Core.Instance.updateTimer;
   
  this.orbitAltitude = vessel.orbit.altitude;
  this.orbitVelocity = vessel.orbit.vel.magnitude;
this.orbitApoAlt = vessel.orbit.ApA; this.orbitApoAlt = vessel.orbit.ApA;
this.oribtPeriAlt = vessel.orbit.PeA; this.oribtPeriAlt = vessel.orbit.PeA;
this.timeToApo = Tools.ConvertInterval(vessel.orbit.timeToAp); this.timeToApo = Tools.ConvertInterval(vessel.orbit.timeToAp);
this.timeToPeri = Tools.ConvertInterval(vessel.orbit.timeToPe); this.timeToPeri = Tools.ConvertInterval(vessel.orbit.timeToPe);
this.orbitInclination = vessel.orbit.inclination; this.orbitInclination = vessel.orbit.inclination;
   
double orbitRadius = vessel.mainBody.Radius + vessel.mainBody.GetAltitude(vessel.findWorldCenterOfMass()); double orbitRadius = vessel.mainBody.Radius + vessel.mainBody.GetAltitude(vessel.findWorldCenterOfMass());
this.gravityAccel = (VOID_Core.Constant_G * vessel.mainBody.Mass) / Math.Pow(orbitRadius, 2); this.gravityAccel = (VOID_Core.Constant_G * vessel.mainBody.Mass) / Math.Pow(orbitRadius, 2);
   
this.orbitPeriod = Tools.ConvertInterval(vessel.orbit.period); this.orbitPeriod = Tools.ConvertInterval(vessel.orbit.period);
this.semiMajorAxis = vessel.orbit.semiMajorAxis; this.semiMajorAxis = vessel.orbit.semiMajorAxis;
this.eccentricity = vessel.orbit.eccentricity; this.eccentricity = vessel.orbit.eccentricity;
this.meanAnomaly = vessel.orbit.meanAnomaly * 180d / Math.PI; this.meanAnomaly = vessel.orbit.meanAnomaly * 180d / Math.PI;
this.trueAnomaly = vessel.orbit.trueAnomaly; this.trueAnomaly = vessel.orbit.trueAnomaly;
this.eccAnomaly = vessel.orbit.eccentricAnomaly * 180d / Math.PI; this.eccAnomaly = vessel.orbit.eccentricAnomaly * 180d / Math.PI;
this.longitudeAscNode = vessel.orbit.LAN; this.longitudeAscNode = vessel.orbit.LAN;
this.argumentPeriapsis = vessel.orbit.argumentOfPeriapsis; this.argumentPeriapsis = vessel.orbit.argumentOfPeriapsis;
this.localSiderealLongitude = this.localSiderealLongitude =
Tools.FixDegreeDomain(vessel.longitude + vessel.orbit.referenceBody.rotationAngle); Tools.FixDegreeDomain(vessel.longitude + vessel.orbit.referenceBody.rotationAngle);
} }
   
int idx = 0; int idx = 0;
   
GUILayout.BeginVertical(); GUILayout.BeginVertical();
   
this.primaryName.DoGUIHorizontal (); GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
  GUILayout.Label(VOIDLabels.void_primary + ":");
this.precisionValues [idx] = this.orbitAltitude.DoGUIHorizontal (this.precisionValues [idx]); GUILayout.FlexibleSpace();
  GUILayout.Label(vessel.mainBody.bodyName, GUILayout.ExpandWidth(false));
  GUILayout.EndHorizontal();
   
  GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
  GUILayout.Label(VOIDLabels.void_altitude_asl + ":", GUILayout.ExpandWidth(true));
  GUILayout.FlexibleSpace();
  GUILayout.Label(
  Tools.MuMech_ToSI(this.orbitAltitude, this.precisionValues[idx]) + "m",
  GUILayout.ExpandWidth(false)
  );
  if (GUILayout.Button ("P")) {
  this.precisionValues [idx] = (ushort)((this.precisionValues[idx] + 3) % 15);
  }
  GUILayout.EndHorizontal();
idx++; idx++;
   
GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true)); GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
GUILayout.Label(VOIDLabels.void_velocity + ":"); GUILayout.Label(VOIDLabels.void_velocity + ":");
GUILayout.FlexibleSpace(); GUILayout.FlexibleSpace();
GUILayout.Label(Tools.MuMech_ToSI(this.orbitVelocity, this.precisionValues [idx]) + "m/s", GUILayout.ExpandWidth(false)); GUILayout.Label(Tools.MuMech_ToSI(this.orbitVelocity, this.precisionValues [idx]) + "m/s", GUILayout.ExpandWidth(false));
if (GUILayout.Button ("P")) { if (GUILayout.Button ("P")) {
this.precisionValues [idx] = (ushort)((this.precisionValues[idx] + 3) % 15); this.precisionValues [idx] = (ushort)((this.precisionValues[idx] + 3) % 15);
} }
GUILayout.EndHorizontal(); GUILayout.EndHorizontal();
idx++; idx++;
   
GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true)); GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
GUILayout.Label(VOIDLabels.void_apoapsis + ":"); GUILayout.Label(VOIDLabels.void_apoapsis + ":");
GUILayout.FlexibleSpace(); GUILayout.FlexibleSpace();
GUILayout.Label(Tools.MuMech_ToSI(this.orbitApoAlt, this.precisionValues [idx]) + "m", GUILayout.ExpandWidth(false)); GUILayout.Label(Tools.MuMech_ToSI(this.orbitApoAlt, this.precisionValues [idx]) + "m", GUILayout.ExpandWidth(false));
if (GUILayout.Button ("P")) { if (GUILayout.Button ("P")) {
this.precisionValues [idx] = (ushort)((this.precisionValues[idx] + 3) % 15); this.precisionValues [idx] = (ushort)((this.precisionValues[idx] + 3) % 15);
} }
GUILayout.EndHorizontal(); GUILayout.EndHorizontal();
idx++; idx++;
   
GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true)); GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
GUILayout.Label("Time to Ap:"); GUILayout.Label("Time to Ap:");
GUILayout.FlexibleSpace(); GUILayout.FlexibleSpace();
GUILayout.Label(this.timeToApo, GUILayout.ExpandWidth(false)); GUILayout.Label(this.timeToApo, GUILayout.ExpandWidth(false));
GUILayout.EndHorizontal(); GUILayout.EndHorizontal();
   
GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true)); GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
GUILayout.Label(VOIDLabels.void_periapsis + ":"); GUILayout.Label(VOIDLabels.void_periapsis + ":");
GUILayout.FlexibleSpace(); GUILayout.FlexibleSpace();
GUILayout.Label( GUILayout.Label(
Tools.MuMech_ToSI(this.oribtPeriAlt, this.precisionValues [idx]) + "m", Tools.MuMech_ToSI(this.oribtPeriAlt, this.precisionValues [idx]) + "m",
GUILayout.ExpandWidth(false) GUILayout.ExpandWidth(false)
); );
if (GUILayout.Button ("P")) { if (GUILayout.Button ("P")) {
this.precisionValues [idx] = (ushort)((this.precisionValues[idx] + 3) % 15); this.precisionValues [idx] = (ushort)((this.precisionValues[idx] + 3) % 15);
} }
GUILayout.EndHorizontal(); GUILayout.EndHorizontal();
idx++; idx++;
   
GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true)); GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
GUILayout.Label("Time to Pe:"); GUILayout.Label("Time to Pe:");
GUILayout.FlexibleSpace(); GUILayout.FlexibleSpace();
GUILayout.Label(this.timeToPeri, GUILayout.ExpandWidth(false)); GUILayout.Label(this.timeToPeri, GUILayout.ExpandWidth(false));
GUILayout.EndHorizontal(); GUILayout.EndHorizontal();
   
GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true)); GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
GUILayout.Label("Inclination:"); GUILayout.Label("Inclination:");
GUILayout.FlexibleSpace(); GUILayout.FlexibleSpace();
GUILayout.Label(this.orbitInclination.ToString("F3") + "°", GUILayout.ExpandWidth(false)); GUILayout.Label(this.orbitInclination.ToString("F3") + "°", GUILayout.ExpandWidth(false));
GUILayout.EndHorizontal(); GUILayout.EndHorizontal();
   
GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true)); GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
GUILayout.Label("Gravity:"); GUILayout.Label("Gravity:");
GUILayout.FlexibleSpace(); GUILayout.FlexibleSpace();
GUILayout.Label( GUILayout.Label(
Tools.MuMech_ToSI(gravityAccel, this.precisionValues[idx]) + "m/s²", Tools.MuMech_ToSI(gravityAccel, this.precisionValues[idx]) + "m/s²",
GUILayout.ExpandWidth(false) GUILayout.ExpandWidth(false)
); );
if (GUILayout.Button ("P")) { if (GUILayout.Button ("P")) {
this.precisionValues [idx] = (ushort)((this.precisionValues[idx] + 3) % 15); this.precisionValues [idx] = (ushort)((this.precisionValues[idx] + 3) % 15);
} }
GUILayout.EndHorizontal(); GUILayout.EndHorizontal();
idx++; idx++;
   
this.toggleExtended = GUILayout.Toggle(this.toggleExtended, "Extended info"); this.toggleExtended = GUILayout.Toggle(this.toggleExtended, "Extended info");
   
if (this.toggleExtended) if (this.toggleExtended)
{ {
GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true)); GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
GUILayout.Label("Period:"); GUILayout.Label("Period:");
GUILayout.FlexibleSpace(); GUILayout.FlexibleSpace();
GUILayout.Label(this.orbitPeriod, GUILayout.ExpandWidth(false)); GUILayout.Label(this.orbitPeriod, GUILayout.ExpandWidth(false));
GUILayout.EndHorizontal(); GUILayout.EndHorizontal();
   
GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true)); GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
GUILayout.Label("Semi-major axis:"); GUILayout.Label("Semi-major axis:");
GUILayout.FlexibleSpace(); GUILayout.FlexibleSpace();
GUILayout.Label( GUILayout.Label(
Tools.MuMech_ToSI(this.semiMajorAxis, this.precisionValues [idx]) + "m", Tools.MuMech_ToSI(this.semiMajorAxis, this.precisionValues [idx]) + "m",
GUILayout.ExpandWidth(false) GUILayout.ExpandWidth(false)
); );
if (GUILayout.Button ("P")) { if (GUILayout.Button ("P")) {
this.precisionValues [idx] = (ushort)((this.precisionValues[idx] + 3) % 15); this.precisionValues [idx] = (ushort)((this.precisionValues[idx] + 3) % 15);
} }
GUILayout.EndHorizontal(); GUILayout.EndHorizontal();
idx++; idx++;
   
GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true)); GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
GUILayout.Label("Eccentricity:"); GUILayout.Label("Eccentricity:");
GUILayout.FlexibleSpace(); GUILayout.FlexibleSpace();
GUILayout.Label(this.eccentricity.ToString("F4"), GUILayout.ExpandWidth(false)); GUILayout.Label(this.eccentricity.ToString("F4"), GUILayout.ExpandWidth(false));
GUILayout.EndHorizontal(); GUILayout.EndHorizontal();
   
// Toadicus edit: convert mean anomaly into degrees. // Toadicus edit: convert mean anomaly into degrees.
GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true)); GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
GUILayout.Label("Mean anomaly:"); GUILayout.Label("Mean anomaly:");
GUILayout.FlexibleSpace(); GUILayout.FlexibleSpace();
GUILayout.Label(this.meanAnomaly.ToString("F3") + "°", GUILayout.ExpandWidth(false)); GUILayout.Label(this.meanAnomaly.ToString("F3") + "°", GUILayout.ExpandWidth(false));
GUILayout.EndHorizontal(); GUILayout.EndHorizontal();
   
GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true)); GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
GUILayout.Label("True anomaly:"); GUILayout.Label("True anomaly:");
GUILayout.FlexibleSpace(); GUILayout.FlexibleSpace();
GUILayout.Label(this.trueAnomaly.ToString("F3") + "°", GUILayout.ExpandWidth(false)); GUILayout.Label(this.trueAnomaly.ToString("F3") + "°", GUILayout.ExpandWidth(false));
GUILayout.EndHorizontal(); GUILayout.EndHorizontal();
   
// Toadicus edit: convert eccentric anomaly into degrees. // Toadicus edit: convert eccentric anomaly into degrees.
GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true)); GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
GUILayout.Label("Eccentric anomaly:"); GUILayout.Label("Eccentric anomaly:");
GUILayout.FlexibleSpace(); GUILayout.FlexibleSpace();
GUILayout.Label(this.eccAnomaly.ToString("F3") + "°", GUILayout.ExpandWidth(false)); GUILayout.Label(this.eccAnomaly.ToString("F3") + "°", GUILayout.ExpandWidth(false));
GUILayout.EndHorizontal(); GUILayout.EndHorizontal();
   
GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true)); GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
GUILayout.Label("Long. ascending node:"); GUILayout.Label("Long. ascending node:");
GUILayout.FlexibleSpace(); GUILayout.FlexibleSpace();
GUILayout.Label(this.longitudeAscNode.ToString("F3") + "°", GUILayout.ExpandWidth(false)); GUILayout.Label(this.longitudeAscNode.ToString("F3") + "°", GUILayout.ExpandWidth(false));
GUILayout.EndHorizontal(); GUILayout.EndHorizontal();
   
GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true)); GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
GUILayout.Label("Arg. of periapsis:"); GUILayout.Label("Arg. of periapsis:");
GUILayout.FlexibleSpace(); GUILayout.FlexibleSpace();
GUILayout.Label(this.argumentPeriapsis.ToString("F3") + "°", GUILayout.ExpandWidth(false)); GUILayout.Label(this.argumentPeriapsis.ToString("F3") + "°", GUILayout.ExpandWidth(false));
GUILayout.EndHorizontal(); GUILayout.EndHorizontal();
   
// Toadicus edit: added local sidereal longitude. // Toadicus edit: added local sidereal longitude.
GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true)); GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
GUILayout.Label("Local Sidereal Longitude:"); GUILayout.Label("Local Sidereal Longitude:");
GUILayout.FlexibleSpace(); GUILayout.FlexibleSpace();
GUILayout.Label(this.localSiderealLongitude.ToString("F3") + "°", VOID_Core.Instance.LabelStyles["right"]); GUILayout.Label(this.localSiderealLongitude.ToString("F3") + "°", VOID_Core.Instance.LabelStyles["right"]);
GUILayout.EndHorizontal(); GUILayout.EndHorizontal();
} }
   
GUILayout.EndVertical(); GUILayout.EndVertical();
GUI.DragWindow(); GUI.DragWindow();
} }
   
public override void LoadConfig ()  
{  
base.LoadConfig ();  
   
this.precisionValues = new IntCollection (4, this._precisionValues);  
}  
   
public override void _SaveToConfig (KSP.IO.PluginConfiguration config)  
{  
this._precisionValues = this.precisionValues.collection;  
   
base._SaveToConfig (config);  
}  
} }
} }
   
   
// //
// VOID_Orbital.cs // VOID_Orbital.cs
// //
// Author: // Author:
// toadicus <> // toadicus <>
// //
// Copyright (c) 2013 toadicus // Copyright (c) 2013 toadicus
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or // the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version. // (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
using KSP; using KSP;
using System; using System;
using UnityEngine; using UnityEngine;
   
namespace VOID namespace VOID
{ {
public class VOID_VesselInfo : VOID_WindowModule public class VOID_VesselInfo : VOID_WindowModule
{ {
[AVOID_SaveValue("toggleExtended")] [AVOID_SaveValue("toggleExtended")]
protected VOID_SaveValue<bool> toggleExtended = false; protected VOID_SaveValue<bool> toggleExtended = false;
   
public VOID_VesselInfo() public VOID_VesselInfo()
{ {
this._Name = "Vessel Information"; this._Name = "Vessel Information";
   
this.WindowPos.x = Screen.width - 260; this.WindowPos.x = Screen.width - 260;
this.WindowPos.y = 450; this.WindowPos.y = 450;
} }
   
public override void ModuleWindow(int _) public override void ModuleWindow(int _)
{ {
if ((TimeWarp.WarpMode == TimeWarp.Modes.LOW) || (TimeWarp.CurrentRate <= TimeWarp.MaxPhysicsRate)) if ((TimeWarp.WarpMode == TimeWarp.Modes.LOW) || (TimeWarp.CurrentRate <= TimeWarp.MaxPhysicsRate))
{ {
Engineer.VesselSimulator.SimManager.Instance.RequestSimulation(); Engineer.VesselSimulator.SimManager.Instance.RequestSimulation();
} }
   
Engineer.VesselSimulator.Stage[] stages = Engineer.VesselSimulator.SimManager.Instance.Stages; Engineer.VesselSimulator.Stage[] stages = Engineer.VesselSimulator.SimManager.Instance.Stages;
   
GUILayout.BeginVertical(); GUILayout.BeginVertical();
   
GUILayout.Label( GUILayout.Label(vessel.vesselName, VOID_Core.Instance.LabelStyles["center_bold"], GUILayout.ExpandWidth(true));
vessel.vesselName,  
VOID_Core.Instance.LabelStyles["center_bold"],  
GUILayout.ExpandWidth(true));  
   
GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true)); GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
GUILayout.Label("G-force:"); GUILayout.Label("G-force:");
GUILayout.Label(vessel.geeForce.ToString("F2") + " gees", GUILayout.ExpandWidth(false)); GUILayout.Label(vessel.geeForce.ToString("F2") + " gees", GUILayout.ExpandWidth(false));
GUILayout.EndHorizontal(); GUILayout.EndHorizontal();
   
int num_parts = 0; int num_parts = 0;
double total_mass = vessel.GetTotalMass(); double total_mass = vessel.GetTotalMass();
double resource_mass = 0; double resource_mass = 0;
double max_thrust = 0; double max_thrust = 0;
double final_thrust = 0; double final_thrust = 0;
   
foreach (Part p in vessel.parts) foreach (Part p in vessel.parts)
{ {
num_parts++; num_parts++;
resource_mass += p.GetResourceMass(); resource_mass += p.GetResourceMass();
   
foreach (PartModule pm in p.Modules) foreach (PartModule pm in p.Modules)
{ {
if ((pm.moduleName == "ModuleEngines") && if ((pm.moduleName == "ModuleEngines") && ((p.State == PartStates.ACTIVE) || ((Staging.CurrentStage > Staging.lastStage) && (p.inverseStage == Staging.lastStage))))
((p.State == PartStates.ACTIVE) ||  
((Staging.CurrentStage > Staging.lastStage) && (p.inverseStage == Staging.lastStage)))  
)  
{ {
max_thrust += ((ModuleEngines)pm).maxThrust; max_thrust += ((ModuleEngines)pm).maxThrust;
final_thrust += ((ModuleEngines)pm).finalThrust; final_thrust += ((ModuleEngines)pm).finalThrust;
} }
} }
} }
   
GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true)); GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
GUILayout.Label("Parts:"); GUILayout.Label("Parts:");
GUILayout.Label(num_parts.ToString("F0"), GUILayout.ExpandWidth(false)); GUILayout.Label(num_parts.ToString("F0"), GUILayout.ExpandWidth(false));
GUILayout.EndHorizontal(); GUILayout.EndHorizontal();
   
GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true)); GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
GUILayout.Label("Total mass:"); GUILayout.Label("Total mass:");
GUILayout.Label(total_mass.ToString("F1") + " tons", GUILayout.ExpandWidth(false)); GUILayout.Label(total_mass.ToString("F1") + " tons", GUILayout.ExpandWidth(false));
GUILayout.EndHorizontal(); GUILayout.EndHorizontal();
   
GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true)); GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
GUILayout.Label("Resource mass:"); GUILayout.Label("Resource mass:");
GUILayout.Label(resource_mass.ToString("F1") + " tons", GUILayout.ExpandWidth(false)); GUILayout.Label(resource_mass.ToString("F1") + " tons", GUILayout.ExpandWidth(false));
GUILayout.EndHorizontal(); GUILayout.EndHorizontal();
   
if (stages.Length > Staging.lastStage) if (stages.Length > Staging.lastStage)
{ {
GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true)); GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
GUILayout.Label("DeltaV (Current Stage):"); GUILayout.Label("DeltaV (Current Stage):");
GUILayout.Label( GUILayout.Label(Tools.MuMech_ToSI(stages[Staging.lastStage].deltaV).ToString() + "m/s", GUILayout.ExpandWidth(false));
Tools.MuMech_ToSI(stages[Staging.lastStage].deltaV).ToString() + "m/s",  
GUILayout.ExpandWidth(false));  
GUILayout.EndHorizontal(); GUILayout.EndHorizontal();
} }
   
if (stages.Length > 0) if (stages.Length > 0)
{ {
double totalDeltaV = 0d; double totalDeltaV = 0d;
   
for (int i = 0; i < stages.Length; ++i) for (int i = 0; i < stages.Length; ++i)
{ {
totalDeltaV += stages [i].deltaV; totalDeltaV += stages [i].deltaV;
} }
   
GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true)); GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
GUILayout.Label("DeltaV (Total):"); GUILayout.Label("DeltaV (Total):");
GUILayout.Label(Tools.MuMech_ToSI(totalDeltaV).ToString() + "m/s", GUILayout.ExpandWidth(false)); GUILayout.Label(Tools.MuMech_ToSI(totalDeltaV).ToString() + "m/s", GUILayout.ExpandWidth(false));
GUILayout.EndHorizontal(); GUILayout.EndHorizontal();
} }
   
GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true)); GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
GUILayout.Label("Throttle:"); GUILayout.Label("Throttle:");
GUILayout.Label((vessel.ctrlState.mainThrottle * 100f).ToString("F0") + "%", GUILayout.ExpandWidth(false)); GUILayout.Label((vessel.ctrlState.mainThrottle * 100f).ToString("F0") + "%", GUILayout.ExpandWidth(false));
GUILayout.EndHorizontal(); GUILayout.EndHorizontal();
   
GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true)); GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
GUILayout.Label("Thrust (curr/max):"); GUILayout.Label("Thrust (curr/max):");
GUILayout.Label( GUILayout.Label(final_thrust.ToString("F1") + " / " + max_thrust.ToString("F1") + " kN", GUILayout.ExpandWidth(false));
final_thrust.ToString("F1") +  
" / " + max_thrust.ToString("F1") + " kN",  
GUILayout.ExpandWidth(false));  
GUILayout.EndHorizontal(); GUILayout.EndHorizontal();
   
double gravity = vessel.mainBody.gravParameter / Math.Pow(vessel.mainBody.Radius + vessel.altitude, 2); double gravity = vessel.mainBody.gravParameter / Math.Pow(vessel.mainBody.Radius + vessel.altitude, 2);
GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true)); GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
GUILayout.Label("T:W (curr/max):"); GUILayout.Label("T:W (curr/max):");
GUILayout.Label( GUILayout.Label((final_thrust / (total_mass * gravity)).ToString("F2") + " / " + (max_thrust / (total_mass * gravity)).ToString("F2"), GUILayout.ExpandWidth(false));
(final_thrust / (total_mass * gravity)).ToString("F2") +  
" / " + (max_thrust / (total_mass * gravity)).ToString("F2"),  
GUILayout.ExpandWidth(false));  
GUILayout.EndHorizontal(); GUILayout.EndHorizontal();
   
double g_ASL = (VOID_Core.Constant_G * vessel.mainBody.Mass) / Math.Pow(vessel.mainBody.Radius, 2); double g_ASL = (VOID_Core.Constant_G * vessel.mainBody.Mass) / Math.Pow(vessel.mainBody.Radius, 2);
GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true)); GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
GUILayout.Label("Max T:W @ surface:"); GUILayout.Label("Max T:W @ surface:");
GUILayout.Label((max_thrust / (total_mass * g_ASL)).ToString("F2"), GUILayout.ExpandWidth(false)); GUILayout.Label((max_thrust / (total_mass * g_ASL)).ToString("F2"), GUILayout.ExpandWidth(false));
GUILayout.EndHorizontal(); GUILayout.EndHorizontal();
   
GUILayout.EndVertical(); GUILayout.EndVertical();
GUI.DragWindow(); GUI.DragWindow();
} }
} }
} }