diff --git a/AlternateResourcePanel/ARP.cs b/AlternateResourcePanel/ARP.cs index a06a971..13a57b8 100644 --- a/AlternateResourcePanel/ARP.cs +++ b/AlternateResourcePanel/ARP.cs @@ -25,7 +25,7 @@ private KSPAlternateResourcePanel() internal ARPWindowSettings windowSettings; internal ARPWindowResourceConfig windowResourceConfig; - internal Rect windowMainResetPos = new Rect(Screen.width - 381, 0, 299, 20); + internal Rect windowMainResetPos = new Rect(Screen.width - 339 - (GameSettings.UI_SCALE_APPS * 42), 0, 299, 20); //variables internal PartResourceVisibleList SelectedResources; @@ -557,12 +557,9 @@ internal override void RepeatingWorker() //Now loop through and update em foreach (Part p in active.parts) { - //Check each part for a control module to see if its status is Good - foreach (ModuleCommand mc in p.Modules.OfType()) - { - if (mc.State == ModuleCommand.ControlSourceState.Good && active == FlightGlobals.ActiveVessel) - blnVesselIsControllable = true; - } + //Check if its a controllable vessel + if(active == FlightGlobals.ActiveVessel && active.IsControllable) + blnVesselIsControllable = true; //is the part decoupled in the last stage Boolean DecoupledInLastStage = (p.DecoupledAt() == LastStage); @@ -586,7 +583,7 @@ internal override void RepeatingWorker() if (!settings.ShowBase && !lstResourcesLastStage.ContainsKey(pr.info.id)) { LogFormatted_DebugOnly("Adding 0 value into last stage"); - PartResource prTemp = new PartResource() { info = pr.info, amount = 0, maxAmount = 0 }; + PartResource prTemp = new PartResource(p) { info = pr.info, amount = 0, maxAmount = 0 }; lstResourcesLastStage.UpdateResource(prTemp); } } @@ -1038,7 +1035,7 @@ internal override void LateUpdate() //position the part windows if (lstPartWindows.Count > 0) { - vectVesselCOMScreen = FlightCamera.fetch.mainCamera.WorldToScreenPoint(FlightGlobals.ActiveVessel.findWorldCenterOfMass()); + vectVesselCOMScreen = FlightCamera.fetch.mainCamera.WorldToScreenPoint(FlightGlobals.ActiveVessel.CoM); DateTime dteStart = DateTime.Now; diff --git a/AlternateResourcePanel/ARPAppLauncher.cs b/AlternateResourcePanel/ARPAppLauncher.cs index f16391d..a665e88 100644 --- a/AlternateResourcePanel/ARPAppLauncher.cs +++ b/AlternateResourcePanel/ARPAppLauncher.cs @@ -7,6 +7,7 @@ using KSP.UI.Screens; using UnityEngine; using KSPPluginFramework; +using System.Collections; namespace KSPAlternateResourcePanel { @@ -25,7 +26,7 @@ void OnGUIAppLauncherReady() if (KSPAlternateResourcePanel.settings.ButtonStyleChosen == ARPWindowSettings.ButtonStyleEnum.StockReplace) { - ReplaceStockAppButton(); + StartCoroutine(ReplaceStockAppButton()); } } } @@ -143,8 +144,12 @@ internal void DestroyAppLauncherButton() internal Boolean StockAppToBeHidden = false; internal DateTime StockAppToBeHiddenAttemptDate; - internal void ReplaceStockAppButton() + + internal IEnumerator ReplaceStockAppButton() { + while(ResourceDisplay.Instance.appLauncherButton == null || !ApplicationLauncher.Ready) + yield return null; + if (ResourceDisplay.Instance.appLauncherButton == null) { if (!StockAppToBeHidden) diff --git a/AlternateResourcePanel/ARPWindowDebug.cs b/AlternateResourcePanel/ARPWindowDebug.cs index 9b95f7c..591478e 100644 --- a/AlternateResourcePanel/ARPWindowDebug.cs +++ b/AlternateResourcePanel/ARPWindowDebug.cs @@ -28,18 +28,22 @@ internal class ARPWindowDebug: MonoBehaviourWindowPlus internal KSPAlternateResourcePanel mbARP; internal Settings settings; - public Int32 intTest1 = 298; - public Int32 intTest2=40; + public Int32 intTest1 = 339; + public Int32 intTest2=0; public Int32 intTest3=299; public Int32 intTest4 = 20; public static Int32 intTest5 = 10; - //ApplicationLauncherButton origResButton=null; //Boolean Clicked = false; internal override void DrawWindow(int id) { - mbARP.windowMainResetPos = new Rect(Screen.width - intTest1, intTest2, intTest3, intTest4); + + ; + + + + mbARP.windowMainResetPos = new Rect(Screen.width - intTest1 - (GameSettings.UI_SCALE_APPS * 42), intTest2, intTest3, intTest4); //GUILayout.Label(Drawing.RectTest.ToString()); //GUILayout.Label(Drawing.RectTest2.ToString()); @@ -81,15 +85,15 @@ 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)); - Boolean blnControl = false; - foreach (Part p in FlightGlobals.ActiveVessel.Parts) - { - foreach (ModuleCommand mc in p.Modules.OfType()) - { - if (mc.State == ModuleCommand.ControlSourceState.Good) - blnControl = true; - } - } + //Boolean blnControl = false; + //foreach (Part p in FlightGlobals.ActiveVessel.Parts) + //{ + // foreach (ModuleCommand mc in p.Modules.OfType()) + // { + // if (mc.State == ModuleCommand.ControlSourceState.Good) + // blnControl = true; + // } + //} //GUILayout.Label(String.Format("CommandState:{0}", blnControl)); GUILayout.Label(String.Format("vesseliscontrollable:{0}", mbARP.blnVesselIsControllable)); diff --git a/AlternateResourcePanel/KSPAlternateResourcePanel.csproj b/AlternateResourcePanel/KSPAlternateResourcePanel.csproj index e174cc2..ea3da02 100644 --- a/AlternateResourcePanel/KSPAlternateResourcePanel.csproj +++ b/AlternateResourcePanel/KSPAlternateResourcePanel.csproj @@ -44,10 +44,6 @@ False ..\..\_Versions\KSP_win_PluginTest_Minimal\KSP_Data\Managed\Assembly-CSharp.dll - - False - ..\..\_Versions\KSP_win_PluginTest_Minimal\KSP_Data\Managed\KSPUtil.dll - @@ -89,14 +85,16 @@ rem Set the Variables we need echo Finding KSP -if exist "R:\~Games\KSP_Win_PlugInTest_Minimal\KSP.exe" ( - set GAMEPATH="R:\~Games\KSP_Win_PlugInTest_Minimal" -) else if exist "D:\Programming\KSP\_Versions\KSP_win_PluginTest_Minimal\KSP.exe" ( - set GAMEPATH="D:\Programming\KSP\_Versions\KSP_Win_PlugInTest_Minimal" -) else if exist "C:\~Games\KSP_Win_PlugInTest_Minimal\KSP.exe" ( - set GAMEPATH="C:\~Games\KSP_Win_PlugInTest_Minimal -) else if exist "D:\Programming\KSP\_Versions\KSP_Win_PlugInTest\KSP.exe" ( - set GAMEPATH="D:\Programming\KSP\_Versions\KSP_win_PluginTest" +rem if exist "R:\~Games\KSP_Win_PlugInTest_Minimal\KSP.exe" ( +rem set GAMEPATH="R:\~Games\KSP_Win_PlugInTest_Minimal" +rem ) else if exist "D:\~Games\KSP_Win_PlugInTest_Minimal\KSP.exe" ( +rem set GAMEPATH="D:\~Games\KSP_Win_PlugInTest_Minimal" +rem ) else if exist "C:\~Games\KSP_Win_PlugInTest_Minimal\KSP.exe" ( +rem set GAMEPATH="C:\~Games\KSP_Win_PlugInTest_Minimal +rem ) else if exist "D:\~Games\KSP_Win_PlugInTest\KSP.exe" ( + +if exist "D:\Programming\KSP\_Versions\KSP_Win_PlugInTest\KSP.exe" ( + set GAMEPATH="D:\Programming\KSP\_Versions\KSP_Win_PlugInTest" ) else if exist "C:\~Games\KSP_Win_PlugInTest\KSP.exe" ( set GAMEPATH="C:\~Games\KSP_Win_PlugInTest" )else ( diff --git a/AlternateResourcePanel/KSPAlternateResourcePanel.version b/AlternateResourcePanel/KSPAlternateResourcePanel.version index d871906..58ca449 100644 --- a/AlternateResourcePanel/KSPAlternateResourcePanel.version +++ b/AlternateResourcePanel/KSPAlternateResourcePanel.version @@ -4,23 +4,23 @@ "DOWNLOAD" : "https://github.com/TriggerAu/AlternateResourcePanel/releases", "VERSION": { "MAJOR": 2, - "MINOR": 8, - "PATCH": 1, + "MINOR": 9, + "PATCH": 0, "BUILD": 0 }, "KSP_VERSION": { "MAJOR": 1, - "MINOR": 1, - "PATCH": 2 + "MINOR": 2, + "PATCH": 0 }, "KSP_VERSION_MIN": { "MAJOR": 1, - "MINOR": 1, + "MINOR": 2, "PATCH": 0 }, "KSP_VERSION_MAX": { "MAJOR": 1, - "MINOR": 1, + "MINOR": 2, "PATCH": 99 } } diff --git a/AlternateResourcePanel/Properties/AssemblyInfo.cs b/AlternateResourcePanel/Properties/AssemblyInfo.cs index 2dad2a5..ccda2d4 100644 --- a/AlternateResourcePanel/Properties/AssemblyInfo.cs +++ b/AlternateResourcePanel/Properties/AssemblyInfo.cs @@ -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.8.1.0")] -[assembly: AssemblyFileVersion("2.8.1.0")] +[assembly: AssemblyVersion("2.9.0.0")] +[assembly: AssemblyFileVersion("2.9.0.0")] diff --git a/AlternateResourcePanel/SharedStuff/ToolbarWrapper.cs b/AlternateResourcePanel/SharedStuff/ToolbarWrapper.cs index 63f1ce8..c173593 100644 --- a/AlternateResourcePanel/SharedStuff/ToolbarWrapper.cs +++ b/AlternateResourcePanel/SharedStuff/ToolbarWrapper.cs @@ -725,13 +725,23 @@ internal ToolbarTypes() { button = new ButtonTypes(iButtonType); } - internal static Type getType(string name) { - return AssemblyLoader.loadedAssemblies - .SelectMany(a => a.assembly.GetExportedTypes()) - .SingleOrDefault(t => t.FullName == name); - } - - internal static PropertyInfo getProperty(Type type, string name) { + internal static Type getType(string name) + { + Type type = null; + AssemblyLoader.loadedAssemblies.TypeOperation(t => + { + if(t.FullName == name) + type = t; + } + ); + + if(type != null) { + return type; + } + return null; + } + + internal static PropertyInfo getProperty(Type type, string name) { return type.GetProperty(name, BindingFlags.Public | BindingFlags.Instance); } diff --git a/PlugInFiles/ReadMe-KSPAlternateResourcePanel.txt b/PlugInFiles/ReadMe-KSPAlternateResourcePanel.txt index 5e70753..d52c459 100644 --- a/PlugInFiles/ReadMe-KSPAlternateResourcePanel.txt +++ b/PlugInFiles/ReadMe-KSPAlternateResourcePanel.txt @@ -28,6 +28,14 @@ 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.9.0.0 - KSP Version: 1.2.0 +- Recompile for 1.2 + +Version 2.8.1.1 - KSP Version: 1.1.3 +BETA VERSION +- Attempt to fix issue with Stock buttone replacement +- Add some login for App Launcher scaling + Version 2.8.1.0 - KSP Version: 1.1.2 - Fixed issue with singe stage vessels showing no resources - Fixed issue with flow control buttons having small hitbox (Issue #83)