Skip to content

Commit

Permalink
Merge 2.9.0.0 to master
Browse files Browse the repository at this point in the history
  • Loading branch information
TriggerAu committed Oct 16, 2016
2 parents ba4eb7a + 1283045 commit 5e0b4d3
Show file tree
Hide file tree
Showing 8 changed files with 73 additions and 51 deletions.
15 changes: 6 additions & 9 deletions AlternateResourcePanel/ARP.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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<ModuleCommand>())
{
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);
Expand All @@ -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);
}
}
Expand Down Expand Up @@ -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;

Expand Down
9 changes: 7 additions & 2 deletions AlternateResourcePanel/ARPAppLauncher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using KSP.UI.Screens;
using UnityEngine;
using KSPPluginFramework;
using System.Collections;

namespace KSPAlternateResourcePanel
{
Expand All @@ -25,7 +26,7 @@ void OnGUIAppLauncherReady()

if (KSPAlternateResourcePanel.settings.ButtonStyleChosen == ARPWindowSettings.ButtonStyleEnum.StockReplace)
{
ReplaceStockAppButton();
StartCoroutine(ReplaceStockAppButton());
}
}
}
Expand Down Expand Up @@ -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)
Expand Down
30 changes: 17 additions & 13 deletions AlternateResourcePanel/ARPWindowDebug.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down Expand Up @@ -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<ModuleCommand>())
{
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<ModuleCommand>())
// {
// if (mc.State == ModuleCommand.ControlSourceState.Good)
// blnControl = true;
// }
//}
//GUILayout.Label(String.Format("CommandState:{0}", blnControl));
GUILayout.Label(String.Format("vesseliscontrollable:{0}", mbARP.blnVesselIsControllable));

Expand Down
22 changes: 10 additions & 12 deletions AlternateResourcePanel/KSPAlternateResourcePanel.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,6 @@
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\_Versions\KSP_win_PluginTest_Minimal\KSP_Data\Managed\Assembly-CSharp.dll</HintPath>
</Reference>
<Reference Include="KSPUtil, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\_Versions\KSP_win_PluginTest_Minimal\KSP_Data\Managed\KSPUtil.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
Expand Down Expand Up @@ -89,14 +85,16 @@
<PropertyGroup>
<PostBuildEvent>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 (
Expand Down
12 changes: 6 additions & 6 deletions AlternateResourcePanel/KSPAlternateResourcePanel.version
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
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.8.1.0")]
[assembly: AssemblyFileVersion("2.8.1.0")]
[assembly: AssemblyVersion("2.9.0.0")]
[assembly: AssemblyFileVersion("2.9.0.0")]
24 changes: 17 additions & 7 deletions AlternateResourcePanel/SharedStuff/ToolbarWrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
8 changes: 8 additions & 0 deletions PlugInFiles/ReadMe-KSPAlternateResourcePanel.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 5e0b4d3

Please sign in to comment.