Skip to content

Commit

Permalink
Merge 2.6.1.0 to master
Browse files Browse the repository at this point in the history
  • Loading branch information
TriggerAu committed Oct 27, 2014
2 parents 8a7a47d + 946dd01 commit a395c1d
Show file tree
Hide file tree
Showing 8 changed files with 272 additions and 73 deletions.
17 changes: 16 additions & 1 deletion AlternateResourcePanel/ARP.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ private KSPAlternateResourcePanel()
internal ARPPartList lstPartsLastStageEngines;
internal List<ModuleEngines> lstLastStageEngineModules;
internal List<ModuleEnginesFX> lstLastStageEngineFXModules;


//internal Double IntakeAirRequested;

/// <summary>
/// ResourceIDs of ones to show in window
/// </summary>
Expand Down Expand Up @@ -512,6 +514,19 @@ internal override void RepeatingWorker()
//Add the part to the engines list for the active stage
lstPartsLastStageEngines.Add(p);
}

//IntakeAirRequested = 0;

//foreach (ModuleEngines pe in p.Modules.OfType<ModuleEngines>()) {
// foreach (Propellant pep in pe.propellants.Where(prop => prop.name == "IntakeAir")) {
// IntakeAirRequested += pep.currentRequirement;
// }
//}
//foreach (ModuleEnginesFX pe in p.Modules.OfType<ModuleEnginesFX>()) {
// foreach (Propellant pep in pe.propellants.Where(prop => prop.name == "IntakeAir")) {
// IntakeAirRequested += pep.currentRequirement;
// }
//}
}

//Destroy the windows that have no resources selected to display
Expand Down
28 changes: 21 additions & 7 deletions AlternateResourcePanel/ARPAppLauncher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ internal ApplicationLauncherButton InitAppLauncherButton()
{
ApplicationLauncherButton retButton = null;

ApplicationLauncherButton[] lstButtons = KSPAlternateResourcePanel.FindObjectsOfType<ApplicationLauncherButton>();
LogFormatted("AppLauncher: Creating Button-BEFORE", lstButtons.Length);
try
{
retButton = ApplicationLauncher.Instance.AddModApplication(
Expand All @@ -63,9 +65,12 @@ internal ApplicationLauncherButton InitAppLauncherButton()
}
catch (Exception ex)
{
MonoBehaviourExtended.LogFormatted("Failed to set up App Launcher Button\r\n{0}",ex.Message);
MonoBehaviourExtended.LogFormatted("AppLauncher: Failed to set up App Launcher Button\r\n{0}",ex.Message);
retButton = null;
}
lstButtons = KSPAlternateResourcePanel.FindObjectsOfType<ApplicationLauncherButton>();
LogFormatted("AppLauncher: Creating Button-AFTER", lstButtons.Length);

return retButton;
}

Expand All @@ -74,12 +79,12 @@ internal void AppLauncherButtonMutuallyExclusive(Boolean Enable)
if (btnAppLauncher == null) return;
if (Enable)
{
MonoBehaviourExtended.LogFormatted("Setting Mutually Exclusive");
MonoBehaviourExtended.LogFormatted("AppLauncher: Setting Mutually Exclusive");
ApplicationLauncher.Instance.EnableMutuallyExclusive(btnAppLauncher);
}
else
{
MonoBehaviourExtended.LogFormatted("Clearing Mutually Exclusive");
MonoBehaviourExtended.LogFormatted("AppLauncher: Clearing Mutually Exclusive");
ApplicationLauncher.Instance.DisableMutuallyExclusive(btnAppLauncher);
}
}
Expand Down Expand Up @@ -123,10 +128,17 @@ internal void AppLauncherButtonMutuallyExclusive(Boolean Enable)

internal void DestroyAppLauncherButton()
{

//LogFormatted_DebugOnly("Destroying AppLauncher Button. Count:{0}", lstButtons.Length);
LogFormatted("AppLauncher: Destroying Button-BEFORE NULL CHECK");
if (btnAppLauncher != null)
{
ApplicationLauncherButton[] lstButtons = KSPAlternateResourcePanel.FindObjectsOfType<ApplicationLauncherButton>();
LogFormatted("AppLauncher: Destroying Button-Button Count:{0}", lstButtons.Length);
ApplicationLauncher.Instance.RemoveModApplication(btnAppLauncher);
btnAppLauncher = null;
}
LogFormatted("AppLauncher: Destroying Button-AFTER NULL CHECK");
}

internal Boolean StockAppToBeHidden = false;
Expand All @@ -139,14 +151,15 @@ internal void ReplaceStockAppButton()
StockAppToBeHiddenAttemptDate = DateTime.Now;
StockAppToBeHidden = true;

if (StockAppToBeHiddenAttemptDate.AddSeconds(5) < DateTime.Now)
if (StockAppToBeHiddenAttemptDate.AddSeconds(settings.ReplaceStockAppTimeOut) < DateTime.Now)
{
StockAppToBeHidden = false;
LogFormatted("Unable to Swap the ARP App for the Stock Resource App - tried for 5 secs");
LogFormatted("AppLauncher: Unable to Swap the ARP App for the Stock Resource App - tried for {0} secs", settings.ReplaceStockAppTimeOut);
}
}
else
{
LogFormatted("AppLauncher: Swapping the ARP App for the Stock Resource App - after {0} secs", (DateTime.Now - StockAppToBeHiddenAttemptDate).TotalSeconds);
StockAppToBeHidden = false;
ResourceDisplay.Instance.appLauncherButton.toggleButton.onDisable();

Expand All @@ -161,10 +174,11 @@ internal void ReplaceStockAppButton()
try
{
ApplicationLauncher.Instance.RemoveModApplication(btnAppLauncher);
btnAppLauncher = null;
}
catch (Exception)
catch (Exception ex)
{

LogFormatted("AppLauncher: Error killing ARP button after replacing the Stock Resource App - {0}\r\n{1}", ex.Message,ex.StackTrace);
}
windowMain.DragEnabled = false;
windowMain.WindowRect = new Rect(windowMainResetPos);
Expand Down
37 changes: 27 additions & 10 deletions AlternateResourcePanel/ARPWindowDebug.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,18 +88,35 @@ internal override void DrawWindow(int id)
// //GUILayout.Label(String.Format("{0}-{1}-{2}-{3}-{4}-{5}", item.getFlameoutState, item.getIgnitionState, item.EngineIgnited, item.isOperational, item.staged, item.status));
//}

//GUILayout.Label(String.Format("IntakeAir Requested:{0}",mbARP.IntakeAirRequested));


//foreach (Part p in FlightGlobals.ActiveVessel.Parts)
//{
// foreach (ModuleEngines pe in p.Modules.OfType<ModuleEngines>())
// {
// foreach (Propellant pep in pe.propellants.Where(prop => prop.name == "IntakeAir"))
// {
// GUILayout.Label(String.Format("{0}-{1}:{2}",p.partInfo.name,pep.name,pep.currentRequirement));
// }
// }
// foreach (ModuleEnginesFX pe in p.Modules.OfType<ModuleEnginesFX>())
// {
// foreach (Propellant pep in pe.propellants.Where(prop => prop.name == "IntakeAir"))
// {
// GUILayout.Label(String.Format("FX:{0}-{1}:{2}", p.partInfo.name, pep.name, pep.currentRequirement));
// }
// }
//}
//Stuff for TAC Life Support
foreach (ARPResource r in mbARP.lstResourcesVessel.Values)
{
GUILayout.Label(String.Format("{0}-{1}-{2}-{3}-{4}-{5}-{6}-{7}-{8}", r.ResourceDef.name, String.Format("{0} / {1} T", r.AmountFormatted, r.MaxAmountFormatted), r.AmountFormatted, r.Rate, r.RateFormatted, r.IsEmpty, r.EmptyAt.ToString("HH:mm:ss"), r.IsFull, r.FullAt.ToString("HH:mm:ss"))); //, r.RateFormatted2, r.RateSamples.Count));

// if (r.Rate!=0)
// GUILayout.Label(String.Format("{0}-{1}-{2}-{3}-{4}-{5}", r.ResourceDef.name, r.AmountFormatted, r.MaxAmountFormatted, r.Rate, Math.Abs(r.Amount / r.Rate),Drawing.FormatTime(Math.Abs(r.Amount / r.Rate)))); //, r.RateFormatted2, r.RateSamples.Count));
// // //GUILayout.Label(String.Format("{0}-{1}-{2}-{3:0}-{4}-{5}", r.ResourceDef.name, r.AmountFormatted, r.MaxAmountFormatted, r.Amount / r.MaxAmount * 100, KSPAlternateResourcePanel.settings.Resources[r.ResourceDef.id].MonitorWarningLevel, r.MonitorWarning)); //, r.RateFormatted2, r.RateSamples.Count));
// //GUILayout.Label(String.Format("{0}-{1}-{2}", r.ResourceDef.name, r.MonitorState, r.AlarmState)); //, r.RateFormatted2, r.RateSamples.Count));
}
//foreach (ARPResource r in mbARP.lstResourcesVessel.Values)
//{
// GUILayout.Label(String.Format("{0}-{1}-{2}-{3}-{4}-{5}-{6}-{7}-{8}", r.ResourceDef.name, String.Format("{0} / {1} T", r.AmountFormatted, r.MaxAmountFormatted), r.AmountFormatted, r.Rate, r.RateFormatted, r.IsEmpty, r.EmptyAt.ToString("HH:mm:ss"), r.IsFull, r.FullAt.ToString("HH:mm:ss"))); //, r.RateFormatted2, r.RateSamples.Count));

//// if (r.Rate!=0)
//// GUILayout.Label(String.Format("{0}-{1}-{2}-{3}-{4}-{5}", r.ResourceDef.name, r.AmountFormatted, r.MaxAmountFormatted, r.Rate, Math.Abs(r.Amount / r.Rate),Drawing.FormatTime(Math.Abs(r.Amount / r.Rate)))); //, r.RateFormatted2, r.RateSamples.Count));
//// // //GUILayout.Label(String.Format("{0}-{1}-{2}-{3:0}-{4}-{5}", r.ResourceDef.name, r.AmountFormatted, r.MaxAmountFormatted, r.Amount / r.MaxAmount * 100, KSPAlternateResourcePanel.settings.Resources[r.ResourceDef.id].MonitorWarningLevel, r.MonitorWarning)); //, r.RateFormatted2, r.RateSamples.Count));
//// //GUILayout.Label(String.Format("{0}-{1}-{2}", r.ResourceDef.name, r.MonitorState, r.AlarmState)); //, r.RateFormatted2, r.RateSamples.Count));
//}


//if (GUILayout.Button("SetTrue"))
Expand Down
4 changes: 0 additions & 4 deletions AlternateResourcePanel/KSPAlternateResourcePanel.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,6 @@
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\~Games\KSP_win_PluginTest_Minimal\KSP_Data\Managed\Assembly-CSharp.dll</HintPath>
</Reference>
<Reference Include="Assembly-CSharp-firstpass, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\~Games\KSP_win_PluginTest_Minimal\KSP_Data\Managed\Assembly-CSharp-firstpass.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
Expand Down
4 changes: 2 additions & 2 deletions AlternateResourcePanel/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.6.0.0")]
[assembly: AssemblyFileVersion("2.6.0.0")]
[assembly: AssemblyVersion("2.6.1.0")]
[assembly: AssemblyFileVersion("2.6.1.0")]
2 changes: 2 additions & 0 deletions AlternateResourcePanel/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ internal ARPWindowSettings.ButtonStyleEnum ButtonStyleToDisplay {
[Persistent] internal ARPWindowSettings.ButtonStyleEnum ButtonStyleChosen = ARPWindowSettings.ButtonStyleEnum.Launcher;
[Persistent] internal Boolean AppLauncherMutuallyExclusive = true;

[Persistent] internal Int32 ReplaceStockAppTimeOut = 20;

//Version Stuff
[Persistent] internal Boolean DailyVersionCheck = true;
internal Boolean VersionAttentionFlag = false;
Expand Down
4 changes: 4 additions & 0 deletions PlugInFiles/ReadMe-KSPAlternateResourcePanel.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ LICENSE
This work is licensed under an MIT license as outlined at the OSI site. Visit the documentation site for more details and Attribution

VERSION HISTORY
Version 2.6.1.0 - KSP Version: 0.25
- Reattached References for 0.25
- Added extra logging and null checks re AppLauncher

Version 2.6.0.0 - KSP Version: 0.25
- Recompiled with 0.25 binaries
- Widened ARP Window by 30 pix to fit wider numbers
Expand Down
Loading

0 comments on commit a395c1d

Please sign in to comment.