Skip to content

Commit

Permalink
Merge 2.6.0.0 to master
Browse files Browse the repository at this point in the history
  • Loading branch information
TriggerAu committed Oct 10, 2014
2 parents 47d0576 + 683a74a commit 8a7a47d
Show file tree
Hide file tree
Showing 33 changed files with 2,382 additions and 53 deletions.
9 changes: 5 additions & 4 deletions AlternateResourcePanel/ARP.cs
Original file line number Diff line number Diff line change
Expand Up @@ -179,14 +179,15 @@ internal override void OnDestroy()
GameEvents.onFlightReady.Remove(OnFlightReady);

GameEvents.onGUIApplicationLauncherReady.Remove(OnGUIAppLauncherReady);
GameEvents.onGameSceneLoadRequested.Remove(OnGameSceneLoadRequestedForAppLauncher);
DestroyAppLauncherButton();

DestroyToolbarButton(btnToolbar);

APIDestroy();
}

//use this to trigger a clean up of sound at the end of teh repeating worker loop
//use this to trigger a clean up of sound at the end of the repeating worker loop
Boolean StageCheckAlarmAudio = false;
void OnStageActivate(Int32 StageNum)
{
Expand Down Expand Up @@ -611,9 +612,9 @@ internal override void RepeatingWorker()
if (!settings.AlarmsEnabled)
windowMain.IconAlarmOffset = 0;

windowMain.WindowRect.width = 299 + windowMain.IconAlarmOffset;
windowMain.Icon2BarOffset_Left = 40+ windowMain.IconAlarmOffset ;
windowMain.Icon2BarOffset_Right = 40 + 125 + windowMain.IconAlarmOffset ;
windowMain.WindowRect.width = 329 + windowMain.IconAlarmOffset; //was 299 - adding 30
windowMain.Icon2BarOffset_Left = 40 + windowMain.IconAlarmOffset ;
windowMain.Icon2BarOffset_Right = 40 + 140 + windowMain.IconAlarmOffset ;

if (lstResourcesToDisplay.Count == 0)
windowMain.WindowRect.height = (2 * windowMain.intLineHeight) + 16;
Expand Down
17 changes: 10 additions & 7 deletions AlternateResourcePanel/ARPWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ private void SetLocalVariables()
//public Rect rectIcon;
internal Int32 IconAlarmOffset = 12;
internal Int32 Icon2BarOffset_Left = 40;
internal Int32 Icon2BarOffset_Right = 40 + 125;
internal Int32 Icon2BarOffset_Right = 40 + 140;

internal override void DrawWindow(Int32 id)
{
Expand Down Expand Up @@ -145,7 +145,7 @@ internal override void DrawWindow(Int32 id)
)
{
//full width bar
rectBar = Drawing.CalcBarRect(rectIcon, Icon2BarOffset_Left, 245, 15);
rectBar = Drawing.CalcBarRect(rectIcon, Icon2BarOffset_Left, 275, 15); //was 245
if (Drawing.DrawResourceBar(rectBar, lstResources[ResourceID], Styles.styleBarGreen_Back, Styles.styleBarGreen, Styles.styleBarGreen_Thin, settings.ShowRates, Highlight, Styles.styleBarHighlight))
//MonoBehaviourExtended.LogFormatted_DebugOnly("Clicked");
SelectedResources.TogglePartResourceVisible(ResourceID);
Expand All @@ -156,15 +156,15 @@ internal override void DrawWindow(Int32 id)
Int32 StageBarOffset = settings.StageBarOnRight ? Icon2BarOffset_Right : Icon2BarOffset_Left;

//need full Vessel and current stage bars
rectBar = Drawing.CalcBarRect(rectIcon, FullVesselBarOffset, 120, 15);
rectBar = Drawing.CalcBarRect(rectIcon, FullVesselBarOffset, 135, 15); //was 120
if (Drawing.DrawResourceBar(rectBar, lstResources[ResourceID], Styles.styleBarGreen_Back, Styles.styleBarGreen, Styles.styleBarGreen_Thin, settings.ShowRates, Highlight, Styles.styleBarHighlight))
SelectedResources.TogglePartResourceVisible(ResourceID);

//get last stage of this resource and set it
if (lstResourcesLastStage.ContainsKey(ResourceID))
{
Highlight = SelectedResources.ContainsKey(ResourceID) && SelectedResources[ResourceID].LastStageVisible;
rectBar = Drawing.CalcBarRect(rectIcon, StageBarOffset, 120, 15);
rectBar = Drawing.CalcBarRect(rectIcon, StageBarOffset, 135, 15); //was 120
if (Drawing.DrawResourceBar(rectBar, lstResourcesLastStage[ResourceID], Styles.styleBarBlue_Back, Styles.styleBarBlue, Styles.styleBarBlue_Thin, settings.ShowRates, Highlight, Styles.styleBarHighlight))
SelectedResources.TogglePartResourceVisible(ResourceID, true);
}
Expand Down Expand Up @@ -206,7 +206,8 @@ internal override void DrawWindow(Int32 id)
Staging.ActivateNextStage();
}
//GUILayout.Space(48 + IconAlarmOffset);
GUILayout.Space(21 + IconAlarmOffset);
//GUILayout.Space(21 + IconAlarmOffset);
GUILayout.Space(51 + IconAlarmOffset);
}
else
{
Expand Down Expand Up @@ -237,13 +238,15 @@ internal override void DrawWindow(Int32 id)
GUIStyle StatusStyle = new GUIStyle(SkinsLibrary.CurrentSkin.label) ;
StatusStyle.normal.textColor = mbARP.AutoStagingStatusColor;
//GUILayout.Label(mbARP.AutoStagingStatus, StatusStyle, GUILayout.Width(147 + IconAlarmOffset));
GUILayout.Label(mbARP.AutoStagingStatus, StatusStyle, GUILayout.Width(120 + IconAlarmOffset));
//GUILayout.Label(mbARP.AutoStagingStatus, StatusStyle, GUILayout.Width(120 + IconAlarmOffset));
GUILayout.Label(mbARP.AutoStagingStatus, StatusStyle, GUILayout.Width(150 + IconAlarmOffset));
}
}
else
{
//GUILayout.Space(234 + IconAlarmOffset);
GUILayout.Space(207 + IconAlarmOffset);
//GUILayout.Space(207 + IconAlarmOffset);
GUILayout.Space(237 + IconAlarmOffset);
}

// ShowAll Button
Expand Down
59 changes: 42 additions & 17 deletions AlternateResourcePanel/ARPWindowDebug.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ internal class ARPWindowDebug: MonoBehaviourWindowPlus
internal KSPAlternateResourcePanel mbARP;
internal Settings settings;

public Int32 intTest1 = 281;
public Int32 intTest2=54;
public Int32 intTest3=80;
public Int32 intTest4 = 60;
public Int32 intTest5 = 50;
public Int32 intTest1 = 8;
public Int32 intTest2=56;
public Int32 intTest3=8;
public Int32 intTest4 = 56;
public Int32 intTest5 = 0;


ApplicationLauncherButton origResButton=null;
Expand All @@ -48,6 +48,8 @@ internal override void DrawWindow(int id)
DrawTextBox(ref intTest4);
DrawTextBox(ref intTest5);

//mbARP.windowResourceConfig.vectMonTypeOffset = new Vector2(intTest1,intTest2); //Vector2(8, 56);
//mbARP.windowResourceConfig.vectDisplayAsOffset = new Vector2(intTest3,intTest4);


//if (DrawButton("KSP")) SkinsLibrary.SetCurrent( SkinsLibrary.DefSkinType.KSP);
Expand Down Expand Up @@ -78,6 +80,28 @@ internal override void DrawWindow(int id)
GUILayout.Label(String.Format("Draw Main Duration: {0:0.00}ms", mbARP.windowMain.DrawWindowInternalDuration.TotalMilliseconds));



//Stuff for extra staging
//foreach (Part item in FlightGlobals.ActiveVessel.Parts)
//{
// GUILayout.Label(String.Format("{0}-{1}", item.partInfo.name, item.partInfo.typeDescription));
// //GUILayout.Label(String.Format("{0}-{1}-{2}-{3}-{4}-{5}", item.getFlameoutState, item.getIgnitionState, item.EngineIgnited, item.isOperational, item.staged, item.status));
//}



//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));
}


//if (GUILayout.Button("SetTrue"))
//{
// mbARP.btnAppLauncher.toggleButton.onTrue();
Expand Down Expand Up @@ -138,16 +162,16 @@ internal override void DrawWindow(int id)
//GUILayout.Label(String.Format("{0}",mbARP.windowResourceConfig.MousePosition));
//GUILayout.Label(String.Format("{0}", mbARP.windowResourceConfig.MousePosition + new Vector2(mbARP.windowDebug.intTest1, mbARP.windowDebug.intTest2)));

GUILayout.Label(String.Format("Over:{0}", mbARP.windowResourceConfig.resourceOver == null ? "None" : mbARP.windowResourceConfig.resourceOver.name));
GUILayout.Label(String.Format("OverIcon:{0}", mbARP.windowResourceConfig.iconOver == null ? "None" : mbARP.windowResourceConfig.iconOver.name));
if (mbARP.windowResourceConfig.resourceDrag != null)
{
GUILayout.Label(String.Format("ResDrag:{0}", mbARP.windowResourceConfig.resourceDrag.name));
GUILayout.Label(String.Format("Reorder:{0}", mbARP.windowResourceConfig.DropWillReorderList));
GUILayout.Label(String.Format("resourceOverUpper:{0}", mbARP.windowResourceConfig.resourceOverUpper));
GUILayout.Label(String.Format("resourceInsertIndex:{0}", mbARP.windowResourceConfig.resourceInsertIndex));
//GUILayout.Label(String.Format("Over:{0}", mbARP.windowResourceConfig.resourceOver == null ? "None" : mbARP.windowResourceConfig.resourceOver.name));
//GUILayout.Label(String.Format("OverIcon:{0}", mbARP.windowResourceConfig.iconOver == null ? "None" : mbARP.windowResourceConfig.iconOver.name));
//if (mbARP.windowResourceConfig.resourceDrag != null)
//{
// GUILayout.Label(String.Format("ResDrag:{0}", mbARP.windowResourceConfig.resourceDrag.name));
// GUILayout.Label(String.Format("Reorder:{0}", mbARP.windowResourceConfig.DropWillReorderList));
// GUILayout.Label(String.Format("resourceOverUpper:{0}", mbARP.windowResourceConfig.resourceOverUpper));
// GUILayout.Label(String.Format("resourceInsertIndex:{0}", mbARP.windowResourceConfig.resourceInsertIndex));

}
//}

//GUILayout.Label(String.Format("Scroll-up/down:{0}/{1}", mbARP.windowResourceConfig.blnScrollUp, mbARP.windowResourceConfig.blnScrollDown));
//GUILayout.Label(String.Format("ScrollPos:{0}", mbARP.windowResourceConfig.ScrollPosition));
Expand Down Expand Up @@ -183,9 +207,10 @@ internal override void DrawWindow(int id)
// InputLockManager.SetControlLock(ControlTypes.STAGING, "manualStageLock");
//}

//foreach (ModuleEngines item in mbARP.lstLastStageEngineModules)
//foreach (Part item in FlightGlobals.ActiveVessel.Parts)
//{
// 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("{0}-{1}", item.partInfo.name,item.partInfo.typeDescription));
// //GUILayout.Label(String.Format("{0}-{1}-{2}-{3}-{4}-{5}", item.getFlameoutState, item.getIgnitionState, item.EngineIgnited, item.isOperational, item.staged, item.status));
//}

//foreach (Part p in FlightGlobals.ActiveVessel.Parts)
Expand Down Expand Up @@ -374,7 +399,7 @@ 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,settings.ResourcesToSplitFlowDisabled.Contains(r.ResourceDef.name), r.AmountFormatted, mbARP.lstResourcesLastStage[r.ResourceDef.id].AmountFormatted,r.ResourceDef.resourceFlowMode)); //, 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));
// GUILayout.Label(String.Format("{0}-{1}", r.ResourceDef.name,r.Amount));
//}

Expand Down
34 changes: 29 additions & 5 deletions AlternateResourcePanel/ARPWindowResourceConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,18 @@ class ARPWindowResourceConfig : MonoBehaviourWindowPlus
internal KSPAlternateResourcePanel mbARP;
internal Settings settings;

Int32 WindowHeight = 400;
Int32 WindowHeight = 480;
Int32 ScrollAreaWidth = 395;

internal Vector2 ScrollPosition = new Vector2();
internal Vector2 vectMonTypeOffset = new Vector2(8, 56);
internal Vector2 vectMonTypeOffset = new Vector2(8, 56); //Vector2(8, 56);
internal Vector2 vectDisplayAsOffset = new Vector2(8, 56);
Int32 ResourceToShowAlarm;
Int32 ResourceToShowAlarmChanger = 0;
Boolean ResourceToShowAlarmChangeNeeded = false;

DropDownList ddlMonType;
DropDownList ddlDisplayValueAs;

internal override void Awake()
{
Expand All @@ -33,21 +35,32 @@ internal override void Awake()

ddlMonType = new DropDownList(EnumExtensions.ToEnumDescriptions<ResourceSettings.MonitorDirections>(),this);
ddlMonType.SetListBoxOffset(vectMonTypeOffset-ScrollPosition);

ddlMonType.OnSelectionChanged += ddlMonType_OnSelectionChanged;

ddlDisplayValueAs = new DropDownList(EnumExtensions.ToEnumDescriptions<ResourceSettings.DisplayUnitsEnum>(), this);
ddlDisplayValueAs.SetListBoxOffset(vectMonTypeOffset - ScrollPosition);
ddlDisplayValueAs.OnSelectionChanged += ddlDisplayValueAs_OnSelectionChanged;

ddlManager.AddDDL(ddlMonType);
ddlManager.AddDDL(ddlDisplayValueAs);
}

internal override void OnDestroy()
{
ddlMonType.OnSelectionChanged -= ddlMonType_OnSelectionChanged;
ddlDisplayValueAs.OnSelectionChanged -= ddlDisplayValueAs_OnSelectionChanged;
}

void ddlMonType_OnSelectionChanged(MonoBehaviourWindowPlus.DropDownList sender, int OldIndex, int NewIndex)
{
settings.Resources[ResourceToShowAlarm].MonitorDirection = (ResourceSettings.MonitorDirections)NewIndex;

}
void ddlDisplayValueAs_OnSelectionChanged(MonoBehaviourWindowPlus.DropDownList sender, int OldIndex, int NewIndex)
{
settings.Resources[ResourceToShowAlarm].DisplayValueAs = (ResourceSettings.DisplayUnitsEnum)NewIndex;
}



internal override void OnGUIOnceOnly()
Expand Down Expand Up @@ -123,6 +136,7 @@ internal override void DrawWindow(int id)
{
ResourceToShowAlarmChanger = item.id;
ddlMonType.SelectedIndex = (Int32)settings.Resources[ResourceToShowAlarmChanger].MonitorDirection;
ddlDisplayValueAs.SelectedIndex = (Int32)settings.Resources[ResourceToShowAlarmChanger].DisplayValueAs;
}
ResourceToShowAlarmChangeNeeded = true;
}
Expand Down Expand Up @@ -175,6 +189,7 @@ internal override void DrawWindow(int id)
{
ResourceToShowAlarmChanger = item.id;
ddlMonType.SelectedIndex = (Int32)settings.Resources[ResourceToShowAlarmChanger].MonitorDirection;
ddlDisplayValueAs.SelectedIndex = (Int32)settings.Resources[ResourceToShowAlarmChanger].DisplayValueAs;
}
ResourceToShowAlarmChangeNeeded = true;
}
Expand All @@ -193,7 +208,16 @@ internal override void DrawWindow(int id)
if (ResourceToShowAlarm==item.id)
{
GUILayout.BeginVertical(GUILayout.Height(40),GUILayout.Width(ScrollAreaWidth-20));
GUILayout.Space(8);//4

GUILayout.BeginHorizontal();
GUILayout.Label("Display As:", Styles.styleStageTextHead, GUILayout.Width(151));
//GUILayout.Label("Monitoring Type:", GUILayout.Width(mbARP.windowDebug.intTest1));
ddlDisplayValueAs.SetListBoxOffset(vectMonTypeOffset - ScrollPosition);
ddlDisplayValueAs.DrawButton();
GUILayout.Space(4);
GUILayout.EndHorizontal();

GUILayout.BeginHorizontal();
GUILayout.Label("Monitoring Levels:",Styles.styleStageTextHead, GUILayout.Width(151));
//GUILayout.Label("Monitoring Type:", GUILayout.Width(mbARP.windowDebug.intTest1));
Expand Down Expand Up @@ -299,8 +323,8 @@ internal override void DrawWindow(int id)
rectResMoveY = lstResPositions[lstResPositions.Count - 1].resourceRect.y + lstResPositions[lstResPositions.Count - 1].resourceRect.height;
Rect rectResMove = new Rect(4,
rectResMoveY + 49 - ScrollPosition.y,
378,9);
GUI.Box(rectResMove, new GUIContent(Resources.texResourceMove),new GUIStyle());
380,9);
GUI.Box(rectResMove, "",Styles.styleDragInsert );
}

//Do the mouse checks
Expand Down
Loading

0 comments on commit 8a7a47d

Please sign in to comment.