Skip to content

Commit

Permalink
Merge 2.2.1.0 to master
Browse files Browse the repository at this point in the history
  • Loading branch information
TriggerAu committed Jun 5, 2014
2 parents ba1f2e9 + eab58e5 commit 4a11a89
Show file tree
Hide file tree
Showing 112 changed files with 145 additions and 209 deletions.
15 changes: 11 additions & 4 deletions AlternateResourcePanel/ARP.cs
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,8 @@ void lstResourcesVessel_OnMonitorStateChanged(ARPResource sender, ARPResource.Mo
KSPAlternateResourcePanel.audioController.Play(clipAlarmsAlert, settings.AlarmsAlertRepeats);
break;
case ARPResource.MonitorStateEnum.Warn:
if (clipAlarmsAlert != null)
//dont play the sound if we are coming down from alert
if (oldValue != ARPResource.MonitorStateEnum.Alert && clipAlarmsAlert != null)
KSPAlternateResourcePanel.audioController.Play(clipAlarmsWarning, settings.AlarmsWarningRepeats);
break;
}
Expand Down Expand Up @@ -383,19 +384,25 @@ internal override void RepeatingWorker()
{
//store a list of all resources in vessel so we can nuke resources from the other lists later
if (!ActiveResources.Contains(pr.info.id)) ActiveResources.Add(pr.info.id);


//Is this resource set to split on disabled parts List - and thus we work out whether to include this parts resource in the last stage counts
Boolean ShowInLastStage = false;
if (settings.Resources[pr.info.id].SplitOnFlowDisabled)
ShowInLastStage = pr.flowState;

//update the resource in the vessel list
lstResourcesVessel.UpdateResource(pr);//,InitialSettings:settings.Resources[pr.info.id]);

if (DecoupledInLastStage)
//and if it needs to go in the last stage list
if (DecoupledInLastStage || ShowInLastStage)
{
lstResourcesLastStage.UpdateResource(pr);
}

//is the resource in the selected list
if (SelectedResources.ContainsKey(pr.info.id) && SelectedResources[pr.info.id].AllVisible)
lstPartWindows.AddPartWindow(p, pr,this);
else if (SelectedResources.ContainsKey(pr.info.id) && SelectedResources[pr.info.id].LastStageVisible && DecoupledInLastStage)
else if (SelectedResources.ContainsKey(pr.info.id) && SelectedResources[pr.info.id].LastStageVisible && (DecoupledInLastStage || ShowInLastStage)) //adjusted this last piece so if its in the last stage list it gets toggled - not just decoupled
lstPartWindows.AddPartWindow(p, pr,this);
else if (lstPartWindows.ContainsKey(p.GetInstanceID()))
{
Expand Down
9 changes: 7 additions & 2 deletions AlternateResourcePanel/ARPWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,13 @@ internal override void DrawWindow(Int32 id)
}
//Is this resource selected
Boolean Highlight = SelectedResources.ContainsKey(ResourceID) && SelectedResources[ResourceID].AllVisible;
//For resources with no stage specifics
if (lstResources[ResourceID].ResourceDef.resourceFlowMode == ResourceFlowMode.ALL_VESSEL)

//For resources with no stage specifics - or the Resources is sey yp split display and values are different for all vessel and flow enabled ones
if ((lstResources[ResourceID].ResourceDef.resourceFlowMode == ResourceFlowMode.ALL_VESSEL ||
lstResources[ResourceID].ResourceDef.resourceFlowMode == ResourceFlowMode.STAGE_PRIORITY_FLOW) &&
(( !settings.Resources[ResourceID].SplitOnFlowDisabled )
|| (lstResources[ResourceID].Amount == lstResourcesLastStage[ResourceID].Amount))
)
{
//full width bar
rectBar = Drawing.CalcBarRect(rectIcon, Icon2BarOffset, 245, 15);
Expand Down
28 changes: 21 additions & 7 deletions AlternateResourcePanel/ARPWindowDebug.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,19 @@ internal override void DrawWindow(int id)
GUILayout.Label(String.Format("Draw Settings Duration: {0:0.00}ms", mbARP.windowSettings.DrawWindowInternalDuration.TotalMilliseconds));
GUILayout.Label(String.Format("Draw Main Duration: {0:0.00}ms", mbARP.windowMain.DrawWindowInternalDuration.TotalMilliseconds));


//foreach (Part p in FlightGlobals.ActiveVessel.Parts)
//{
// foreach (PartResource pr in p.Resources)
// {
// if (pr.info.name == "ElectricCharge")
// {
// GUILayout.Label(String.Format("{0}-{1}-{2}", p.partInfo.name,pr.flowMode,pr.flowState));

// }
// }
//}

//GUILayout.Label(InputLockManager.IsLocked(ControlTypes.STAGING).ToString());
//foreach (KeyValuePair<string,ulong> item in InputLockManager.lockStack)
//{
Expand Down Expand Up @@ -183,13 +196,13 @@ internal override void DrawWindow(int id)

//GUILayout.Label(mbARP.MouseOverToolbarBtn.ToString());

foreach (ARPResource r in mbARP.lstResourcesVessel.Values)
{
GUILayout.Label(String.Format("{0}-{1}-{2}-{3}-{4}-{5}-{6}-{7}", r.ResourceDef.name, r.AmountFormatted, r.MaxAmountFormatted, r.RateFormatted, r.IsEmpty, r.EmptyAt.ToString("HH:mm:ss"), r.IsFull, r.FullAt.ToString("HH:mm:ss"))); //, r.RateFormatted2, r.RateSamples.Count));
//foreach (ARPResource r in mbARP.lstResourcesVessel.Values)
//{
//// GUILayout.Label(String.Format("{0}-{1}-{2}-{3}-{4}-{5}-{6}-{7}", r.ResourceDef.name, r.AmountFormatted, r.MaxAmountFormatted, r.RateFormatted, r.IsEmpty, r.EmptyAt.ToString("HH:mm:ss"), r.IsFull, r.FullAt.ToString("HH:mm:ss"))); //, 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}-{3}-{4}", r.ResourceDef.name, r.MonitorWarning,r.MonitorAlert,r.MonitorWorstHealth,r.AlarmAcknowledged)); //, 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 (Int32 item in mbARP.lstResourcesToDisplay)
//{
Expand Down Expand Up @@ -281,7 +294,8 @@ internal override void DrawWindow(int id)

//foreach (ARPResource r in mbARP.lstResourcesLastStage.Values)
//{
// GUILayout.Label(String.Format("{0}-{1}-{2}-{3}-{4}", r.ResourceDef.name, r.AmountFormatted, r.MaxAmountFormatted, r.RateFormatted, r.AmountLastFormatted)); //, r.RateFormatted2, r.RateSamples.Count));
// //GUILayout.Label(String.Format("{0}-{1}-{2}-{3}-{4}", r.ResourceDef.name, r.AmountFormatted, r.MaxAmountFormatted, r.RateFormatted, r.AmountLastFormatted)); //, r.RateFormatted2, r.RateSamples.Count));
// GUILayout.Label(String.Format("{0}-{1}-{2}-{3}-{4}", r.ResourceDef.name,settings.ResourcesToSplitFlowDisabled.Contains(r.ResourceDef.name), r.AmountFormatted, mbARP.lstResourcesLastStage[r.ResourceDef.id].AmountFormatted,r.ResourceDef.resourceFlowMode)); //, r.RateFormatted2, r.RateSamples.Count));
//}

//foreach (ARPResource r in KSPAlternateResourcePanel.lstResourcesLastStage)
Expand Down
7 changes: 7 additions & 0 deletions AlternateResourcePanel/ARPWindowResourceConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,13 @@ internal override void DrawWindow(int id)
GUILayout.Label("Full Behaviour:", temp, GUILayout.Width(120));
DrawToggle(ref settings.Resources[item.id].HideWhenFull, "Hide When Full", Styles.styleToggle);
GUILayout.EndHorizontal();
if (PartResourceLibrary.Instance.resourceDefinitions[item.id].resourceFlowMode== ResourceFlowMode.ALL_VESSEL ||
PartResourceLibrary.Instance.resourceDefinitions[item.id].resourceFlowMode == ResourceFlowMode.STAGE_PRIORITY_FLOW) {
GUILayout.BeginHorizontal();
GUILayout.Label("Split Behaviour:", temp, GUILayout.Width(120));
DrawToggle(ref settings.Resources[item.id].SplitOnFlowDisabled, "Hide disabled flows from last stage", Styles.styleToggle);
GUILayout.EndHorizontal();
}
GUILayout.Space(3);
GUILayout.EndVertical();
}
Expand Down
Loading

0 comments on commit 4a11a89

Please sign in to comment.