Skip to content

Commit

Permalink
Merge 2.3.0.0 to master
Browse files Browse the repository at this point in the history
  • Loading branch information
TriggerAu committed Jul 15, 2014
2 parents 77effe8 + 5369cad commit 30d89e4
Show file tree
Hide file tree
Showing 104 changed files with 365 additions and 74 deletions.
33 changes: 31 additions & 2 deletions AlternateResourcePanel/ARP.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,15 @@ internal override void Awake()
if (!settings.Load())
LogFormatted("Settings Load Failed");

//If the window is in the pre0.24 default then move it down so its not over the app launcher
if (!settings.WindowPosUpdatedv24 && settings.WindowPosition == new Rect(new Rect(Screen.width - 298, 19, 299, 20)))
{
MonoBehaviourExtended.LogFormatted("Moving window for 0.24");
settings.WindowPosUpdatedv24 = true;
settings.Save();
blnResetWindow = true;
}

//Ensure settings.resources contains all the resources in the loaded game
VerifyResources();

Expand Down Expand Up @@ -198,6 +207,22 @@ void lstResourcesVessel_OnAlarmStateChanged(ARPResource sender, ARPResource.Alar
private void VerifyResources()
{
Boolean AddedResources = false;

if (settings.Resources.Count == 0) {
// Set a Default config
LogFormatted("Setting a Default Res Config");
settings.Resources.Add(1576437329, new ResourceSettings(1576437329, "ElectricCharge"));
settings.Resources.Add(2001413032, new ResourceSettings(2001413032, "MonoPropellant"));
settings.Resources.Add(-792463147, new ResourceSettings(-792463147, "EVA Propellant"));
settings.Resources.Add(35, new ResourceSettings(35, "") { IsSeparator = true });
settings.Resources.Add(374119730, new ResourceSettings(374119730, "LiquidFuel"));
settings.Resources.Add(-1823983486, new ResourceSettings(-1823983486, "Oxidizer"));
settings.Resources.Add(650317537, new ResourceSettings(650317537, "SolidFuel"));
settings.Resources.Add(36, new ResourceSettings(36, "") { IsSeparator = true });
settings.Resources.Add(-1909417378, new ResourceSettings(-1909417378, "IntakeAir"));
settings.Resources.Add(1447111193, new ResourceSettings(1447111193, "XenonGas"));
}

foreach (PartResourceDefinition item in PartResourceLibrary.Instance.resourceDefinitions)
{
if (!settings.Resources.ContainsKey(item.id))
Expand Down Expand Up @@ -280,10 +305,14 @@ internal override void OnGUIOnceOnly()

//Set the current Skin
SkinsLibrary.SetCurrent(settings.SelectedSkin.ToString());

//Set Button Rectangle position
rectButton.x = settings.vectButtonPos.x;
rectButton.y = settings.vectButtonPos.y;
}

//Position of screen button
static Rect rectButton = new Rect(Screen.width - 109, 0, 80, 30);
static Rect rectButton = new Rect(Screen.width - 309, 0, 80, 30);
//Hover Status for mouse
internal static Boolean HoverOn = false;
//Hover Status for mouse
Expand Down Expand Up @@ -315,7 +344,7 @@ void DrawGUI()
windowMain.Visible = true;
if (blnResetWindow)
{
windowMain.WindowRect = new Rect(Screen.width - 298, 19, 299, 20);
windowMain.WindowRect = new Rect(Screen.width - 298, 40, 299, 20);
blnResetWindow = false;
settings.WindowPosition = windowMain.WindowRect;
settings.Save();
Expand Down
33 changes: 22 additions & 11 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=0;
public Int32 intTest2=0;
public Int32 intTest3=0;
public Int32 intTest4 = 0;
public Int32 intTest5 = 200;
public Int32 intTest1=18;
public Int32 intTest2=18;
public Int32 intTest3=80;
public Int32 intTest4 = 60;
public Int32 intTest5 = 50;

//Boolean Clicked = false;
internal override void DrawWindow(int id)
Expand Down Expand Up @@ -66,19 +66,30 @@ internal override void DrawWindow(int id)
//base.DrawWindow(id);
GUILayout.BeginVertical();

if (GUILayout.Button("Remove"))
{
ResourceDisplay.Instance.HideResourceList();
}

GUILayout.Label(String.Format("Repeating Worker: {0:0.00}ms Config:{1}-{2}-{3}", mbARP.RepeatingWorkerDuration.TotalMilliseconds, mbARP.RepeatingWorkerRunning, mbARP.RepeatingWorkerInitialWait, mbARP.RepeatingWorkerRate));
GUILayout.Label(String.Format("Repeating Worker: {0:0.00}ms Config:{1}-{2}-{3}", mbARP.RepeatingWorkerDuration.TotalMilliseconds, mbARP.RepeatingWorkerRunning, mbARP.RepeatingWorkerInitialWait, mbARP.RepeatingWorkerRate));
GUILayout.Label(String.Format("UT Passed: {0}s", mbARP.RepeatingWorkerUTPeriod.ToString()));
GUILayout.Label(String.Format("RT Passed: {0}s", (mbARP.RepeatingWorkerUTPeriod * TimeWarp.CurrentRate).ToString()));

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


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("Scroll-up/down:{0}/{1}", mbARP.windowResourceConfig.blnScrollUp, mbARP.windowResourceConfig.blnScrollDown));
GUILayout.Label(String.Format("ScrollPos:{0}", mbARP.windowResourceConfig.ScrollPosition));

//foreach (ARPWindowResourceConfig.ResourcePosition item in mbARP.windowResourceConfig.lstResPositions)
//{
// GUILayout.Label(String.Format("{0}({1})-{2}", item.name,item.id,item.resourceRect));
//}

//foreach (Part p in FlightGlobals.ActiveVessel.Parts)
//{
// foreach (PartResource pr in p.Resources)
Expand Down
Loading

0 comments on commit 30d89e4

Please sign in to comment.