Skip to content

Commit

Permalink
Merge 1.5.0.0 to master
Browse files Browse the repository at this point in the history
  • Loading branch information
TriggerAu committed May 19, 2016
2 parents 1674030 + d829c05 commit 45f762e
Show file tree
Hide file tree
Showing 10 changed files with 78 additions and 35 deletions.
5 changes: 5 additions & 0 deletions PluginFiles/ReadMe-TransferWindowPlanner.txt
Expand Up @@ -27,6 +27,11 @@ 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 1.5.0.0 - KSP Version: 1.1.2
- Compiled against 1.1.2
- tweaked angle stuff
- integrated nanathan pull for ongui code

Version 1.4.0.0 - KSP Version: 1.0.5
- adjusted angle names, etc to make em consistent - to retrograde, to prograde, etc
- fixed issues with log spam and map view (Issue #35)
Expand Down
28 changes: 18 additions & 10 deletions TransferWindowPlanner/Framework/MonoBehaviourWindow.cs
Expand Up @@ -177,16 +177,17 @@ internal Boolean Visible
{
if (_Visible != value)
{
if (value)
{
LogFormatted_DebugOnly("Adding Window to PostDrawQueue-{0}", WindowID);
RenderingManager.AddToPostDrawQueue(5, this.DrawGUI);
}
else
{
LogFormatted_DebugOnly("Removing Window from PostDrawQueue", WindowID);
RenderingManager.RemoveFromPostDrawQueue(5, this.DrawGUI);
}
//Rem out for unity5
//if (value)
//{
// LogFormatted_DebugOnly("Adding Window to PostDrawQueue-{0}", WindowID);
// RenderingManager.AddToPostDrawQueue(5, this.DrawGUI);
//}
//else
//{
// LogFormatted_DebugOnly("Removing Window from PostDrawQueue", WindowID);
// RenderingManager.RemoveFromPostDrawQueue(5, this.DrawGUI);
//}

//raise event if theres one registered
if (onWindowVisibleChanged != null)
Expand All @@ -202,6 +203,13 @@ internal void ClampToScreenNow()
WindowRect = WindowRect.ClampToScreen(ClampToScreenOffset);
}

internal override void OnGUIEvery()
{
base.OnGUIEvery();
if (Visible)
DrawGUI();
}

/// <summary>
/// This is the Code that draws the window and sets the skin
/// !!!! You have to set the skin before drawing the window or you will scratch your head for ever
Expand Down
Expand Up @@ -141,6 +141,7 @@ internal override void DrawWindowPost(int id)
}
internal override void OnGUIEvery()
{
base.OnGUIEvery();
ddlManager.CloseOnOutsideClicks();
}

Expand Down
4 changes: 2 additions & 2 deletions TransferWindowPlanner/Properties/AssemblyInfo.cs
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("1.4.0.0")]
[assembly: AssemblyFileVersion("1.4.0.0")]
[assembly: AssemblyVersion("1.5.0.0")]
[assembly: AssemblyFileVersion("1.5.0.0")]
6 changes: 3 additions & 3 deletions TransferWindowPlanner/SharedStuff/AngleRenderEject.cs
Expand Up @@ -400,13 +400,13 @@ internal override void OnGUIEvery()
{
if (MapView.MapIsEnabled && isDrawing && !_isBecomingVisible && !_isHiding)
{
GUI.Label(new Rect(cam.camera.WorldToScreenPoint(ScaledSpace.LocalToScaledSpace(vectPosWorldEnd)).x - 50, Screen.height - cam.camera.WorldToScreenPoint(ScaledSpace.LocalToScaledSpace(vectPosWorldEnd)).y - 15, 100, 30), String.Format("{0:0.00}°\r\n{1}", AngleTargetValue, DrawToRetrograde ? "to retrograde" : "to prograde"), styleLabelEnd);
GUI.Label(new Rect(PlanetariumCamera.Camera.WorldToScreenPoint(ScaledSpace.LocalToScaledSpace(vectPosWorldEnd)).x - 50, Screen.height - PlanetariumCamera.Camera.WorldToScreenPoint(ScaledSpace.LocalToScaledSpace(vectPosWorldEnd)).y - 15, 100, 30), String.Format("{0:0.00}°\r\n{1}", AngleTargetValue, DrawToRetrograde ? "to retrograde" : "to prograde"), styleLabelEnd);

GUI.Label(new Rect(cam.camera.WorldToScreenPoint(ScaledSpace.LocalToScaledSpace(vectPosWorldOrbitLabel)).x - 50, Screen.height - cam.camera.WorldToScreenPoint(ScaledSpace.LocalToScaledSpace(vectPosWorldOrbitLabel)).y - 15, 100, 30), "Orbit", styleLabelTarget);
GUI.Label(new Rect(PlanetariumCamera.Camera.WorldToScreenPoint(ScaledSpace.LocalToScaledSpace(vectPosWorldOrbitLabel)).x - 50, Screen.height - PlanetariumCamera.Camera.WorldToScreenPoint(ScaledSpace.LocalToScaledSpace(vectPosWorldOrbitLabel)).y - 15, 100, 30), "Orbit", styleLabelTarget);

if (VesselOrbit != null)
{
//GUI.Label(new Rect(cam.camera.WorldToScreenPoint(ScaledSpace.LocalToScaledSpace(vectPosWorldTarget)).x - 50, Screen.height - cam.camera.WorldToScreenPoint(ScaledSpace.LocalToScaledSpace(vectPosWorldTarget)).y - 15, 100, 30), String.Format("{0:0.00}°", AngleTargetValue),styleLabelTarget);
//GUI.Label(new Rect(PlanetariumCamera.Camera.WorldToScreenPoint(ScaledSpace.LocalToScaledSpace(vectPosWorldTarget)).x - 50, Screen.height - PlanetariumCamera.Camera.WorldToScreenPoint(ScaledSpace.LocalToScaledSpace(vectPosWorldTarget)).y - 15, 100, 30), String.Format("{0:0.00}°", AngleTargetValue),styleLabelTarget);
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions TransferWindowPlanner/SharedStuff/AngleRenderPhase.cs
Expand Up @@ -387,10 +387,10 @@ internal override void OnGUIEvery()
{
if (MapView.MapIsEnabled && isDrawing && !_isBecomingVisible && !_isHiding)
{
GUI.Label(new Rect(cam.camera.WorldToScreenPoint(ScaledSpace.LocalToScaledSpace(vectPosWorldEnd)).x - 50, Screen.height - cam.camera.WorldToScreenPoint(ScaledSpace.LocalToScaledSpace(vectPosWorldEnd)).y - 15, 100, 30), String.Format("{0:0.00}°", _PhaseAngleCurrent),styleLabelEnd);
GUI.Label(new Rect(PlanetariumCamera.Camera.WorldToScreenPoint(ScaledSpace.LocalToScaledSpace(vectPosWorldEnd)).x - 50, Screen.height - PlanetariumCamera.Camera.WorldToScreenPoint(ScaledSpace.LocalToScaledSpace(vectPosWorldEnd)).y - 15, 100, 30), String.Format("{0:0.00}°", _PhaseAngleCurrent),styleLabelEnd);

if(ShowTargetAngle)
GUI.Label(new Rect(cam.camera.WorldToScreenPoint(ScaledSpace.LocalToScaledSpace(vectPosWorldTarget)).x - 50, Screen.height - cam.camera.WorldToScreenPoint(ScaledSpace.LocalToScaledSpace(vectPosWorldTarget)).y - 15, 100, 30), String.Format("{0:0.00}°", AngleTargetValue),styleLabelTarget);
GUI.Label(new Rect(PlanetariumCamera.Camera.WorldToScreenPoint(ScaledSpace.LocalToScaledSpace(vectPosWorldTarget)).x - 50, Screen.height - PlanetariumCamera.Camera.WorldToScreenPoint(ScaledSpace.LocalToScaledSpace(vectPosWorldTarget)).y - 15, 100, 30), String.Format("{0:0.00}°", AngleTargetValue),styleLabelTarget);
}
}

Expand Down
9 changes: 3 additions & 6 deletions TransferWindowPlanner/SharedStuff/AppLauncher.cs
Expand Up @@ -4,6 +4,7 @@
using System.Text;

using KSP;
using KSP.UI.Screens;
using UnityEngine;
using KSPPluginFramework;

Expand All @@ -17,14 +18,10 @@ public partial class TransferWindowPlanner
void OnGUIAppLauncherReady()
{
MonoBehaviourExtended.LogFormatted_DebugOnly("AppLauncherReady");
if (ApplicationLauncher.Ready)
if (settings.ButtonStyleChosen == Settings.ButtonStyleEnum.Launcher )
{
if (settings.ButtonStyleChosen == Settings.ButtonStyleEnum.Launcher )
{
btnAppLauncher = InitAppLauncherButton();
}
btnAppLauncher = InitAppLauncherButton();
}
else { LogFormatted("App Launcher-Not Actually Ready"); }
}

void OnGameSceneLoadRequestedForAppLauncher(GameScenes SceneToLoad)
Expand Down
42 changes: 35 additions & 7 deletions TransferWindowPlanner/TWP.cs
Expand Up @@ -57,8 +57,8 @@ internal override void Awake()
}

//plug us in to the draw queue and start the worker
RenderingManager.AddToPostDrawQueue(1, DrawGUI);

//Rem out for unity5
//RenderingManager.AddToPostDrawQueue(1, DrawGUI);

//Get whether the toolbar is there
settings.BlizzyToolbarIsAvailable = ToolbarManager.ToolbarAvailable;
Expand All @@ -70,10 +70,14 @@ internal override void Awake()
}

//Hook the App Launcher
OnGUIAppLauncherReady();
//GameEvents.onGUIApplicationLauncherReady.Add(OnGUIAppLauncherReady);
GameEvents.onGUIApplicationLauncherReady.Add(OnGUIAppLauncherReady);
GameEvents.onGUIApplicationLauncherDestroyed.Add(DestroyAppLauncherButton);

GameEvents.onGameSceneLoadRequested.Add(OnGameSceneLoadRequestedForAppLauncher);

GameEvents.onShowUI.Add(OnShowUI);
GameEvents.onHideUI.Add(OnHideUI);

//Hook the Angle renderers
if (lstScenesForAngles.Contains(HighLogic.LoadedScene))
{
Expand All @@ -93,21 +97,40 @@ internal override void OnDestroy()
if (windowMain.bw!=null && windowMain.bw.IsBusy)
windowMain.bw.CancelAsync();

RenderingManager.RemoveFromPostDrawQueue(1, DrawGUI);
//Rem out for unity5
//RenderingManager.RemoveFromPostDrawQueue(1, DrawGUI);

Destroy(PhaseAngle);
Destroy(EjectAngle);

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

GameEvents.onShowUI.Remove(OnShowUI);
GameEvents.onHideUI.Remove(OnHideUI);

DestroyAppLauncherButton();

DestroyToolbarButton(btnToolbar);

DestroyAPIHooks();
}

private void OnShowUI()
{
LogFormatted_DebugOnly("OnShowGUI Fired");
windowMain.Visible = true;
}

private void OnHideUI()
{
LogFormatted_DebugOnly("OnHideGUI Fired");
windowMain.Visible = false;
}


internal override void Start()
internal override void Start()
{
if (AssemblyLoader.loadedAssemblies
.Select(a => a.assembly.GetExportedTypes())
Expand Down Expand Up @@ -270,6 +293,11 @@ internal override void OnGUIOnceOnly()

}

//internal override void OnGUIEvery()
//{
// DrawGUI();
//}

internal Boolean MouseOverAnyWindow = false;
internal Boolean InputLockExists = false;
void DrawGUI()
Expand Down
4 changes: 4 additions & 0 deletions TransferWindowPlanner/TransferWindowPlanner.csproj
Expand Up @@ -35,6 +35,10 @@
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\~Games\KSP_win_PluginTest_Prerelease\KSP_Data\Managed\Assembly-CSharp.dll</HintPath>
</Reference>
<Reference Include="KSPUtil, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\~Games\KSP_win_PluginTest_Minimal\KSP_Data\Managed\KSPUtil.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
Expand Down
10 changes: 5 additions & 5 deletions TransferWindowPlanner/TransferWindowPlanner.version
Expand Up @@ -4,23 +4,23 @@
"DOWNLOAD" : "https://github.com/TriggerAu/TransferWindowPlanner/releases",
"VERSION": {
"MAJOR": 1,
"MINOR": 4,
"MINOR": 5,
"PATCH": 0,
"BUILD": 0
},
"KSP_VERSION": {
"MAJOR": 1,
"MINOR": 0,
"PATCH": 5
"MINOR": 1,
"PATCH": 2
},
"KSP_VERSION_MIN": {
"MAJOR": 1,
"MINOR": 0,
"MINOR": 1,
"PATCH": 0
},
"KSP_VERSION_MAX": {
"MAJOR": 1,
"MINOR": 0,
"MINOR": 1,
"PATCH": 99
}
}

0 comments on commit 45f762e

Please sign in to comment.