Skip to content

Commit

Permalink
ver 2.4.3
Browse files Browse the repository at this point in the history
  • Loading branch information
radistmorse committed Oct 12, 2019
1 parent c4a75f8 commit 34fb450
Show file tree
Hide file tree
Showing 10 changed files with 35 additions and 249 deletions.
5 changes: 5 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
2.4.3, 2019-10-12
- KSP 1.7
- Small correction to maneuver select logic
- Remove compatibility checker. It's more annoyance than help.

2.4.2, 2019-03-23
- KSP 1.6
- German translation
Expand Down
1 change: 0 additions & 1 deletion PreciseManeuver.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@
<Compile Include="src\PreciseManeuverToolbar.cs" />
<Compile Include="src\KACWrapper.cs" />
<Compile Include="src\PreciseManeuverHotkeys.cs" />
<Compile Include="src\CompatibilityChecker.cs" />
<Compile Include="src\NodeManager.cs" />
<Compile Include="src\NodeTools.cs" />
<Compile Include="src\PreciseManeuverConfig.cs" />
Expand Down
8 changes: 4 additions & 4 deletions PreciseManeuver.version
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,22 @@
"VERSION": {
"MAJOR": 2,
"MINOR": 4,
"PATCH": 2,
"PATCH": 3,
"BUILD": 0
},
"KSP_VERSION": {
"MAJOR": 1,
"MINOR": 6,
"MINOR": 7,
"PATCH": 0
},
"KSP_VERSION_MIN": {
"MAJOR": 1,
"MINOR": 6,
"MINOR": 7,
"PATCH": 0
},
"KSP_VERSION_MAX": {
"MAJOR": 1,
"MINOR": 6,
"MINOR": 7,
"PATCH": 99
}
}
4 changes: 2 additions & 2 deletions properties/AssemblyInfo.Unity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
[assembly: AssemblyCopyright("Copyleft (ɔ) 2017. Modify and distribute it at will! Hail open source!")]
[assembly: ComVisible(false)]
[assembly: Guid("3ebb00a5-1bbe-46c1-ae28-01b5f6c603f6")]
[assembly: AssemblyVersion("2.4.0.0")]
[assembly: AssemblyFileVersion("2.4.0.0")]
[assembly: AssemblyVersion("2.4.3.0")]
[assembly: AssemblyFileVersion("2.4.3.0")]
4 changes: 2 additions & 2 deletions properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
// 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.4.2")]
[assembly: AssemblyFileVersion("2.4.2")]
[assembly: AssemblyVersion("2.4.3")]
[assembly: AssemblyFileVersion("2.4.3")]
[assembly: AssemblyInformationalVersion("")]

[assembly: KSPAssembly("PreciseManeuver", 2, 4)]
202 changes: 0 additions & 202 deletions src/CompatibilityChecker.cs

This file was deleted.

29 changes: 4 additions & 25 deletions src/NodeManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,6 @@ internal ManeuverNode CurrentNode {
}
internal int CurrentNodeIdx { get; private set; } = -1;
private int nodeCount = 0;
/* list that helps find the newly selected nodes */
private List<ManeuverNode> prevGizmos = null;
/* Internal copy of the node */
private SavedNode currentSavedNode = null;
private SavedNode CurrentSavedNode {
Expand Down Expand Up @@ -333,30 +331,11 @@ internal void CircularizeOrbit () {

internal void SearchNewGizmo () {
var solver = FlightGlobals.ActiveVessel.patchedConicSolver;
var curList = solver.maneuverNodes.Where (a => a.attachedGizmo != null);
var tmp = curList.ToList ();
/* let's see if user is hovering a mouse *
* over any gizmo. That would be a hint. */
if (curList.Count (a => a.attachedGizmo.MouseOverGizmo) == 1) {
var node = curList.First (a => a.attachedGizmo.MouseOverGizmo);
if (node != currentNode) {
currentNode = node;
NotifyNodeChanged ();
}
} else {
/* then, let's see if we can find any *
* new gizmos that were created recently. */
if (prevGizmos != null)
curList = curList.Except (prevGizmos);
if (curList.Count () == 1) {
var node = curList.First ();
if (node != currentNode) {
currentNode = node;
NotifyNodeChanged ();
}
}
var curList = solver.maneuverNodes.Where (a => a.attachedGizmo != null && a != currentNode).ToArray();

if (curList.Length == 1) {
currentNode = curList.First ();
}
prevGizmos = tmp;
}

private void UpdateCurrentNode () {
Expand Down
3 changes: 3 additions & 0 deletions src/NodeTools.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ internal static Orbit GetTargetOrbit (CelestialBody refbody) {
return null;

Orbit o = tgt.GetOrbit ();
if (o == null)
return null;

if (o.referenceBody == refbody)
return o;

Expand Down
19 changes: 9 additions & 10 deletions src/PreciseManeuver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
using KSP.Localization;

namespace KSPPreciseManeuver {
[KSPAddon (KSPAddon.Startup.Flight, false)]
[KSPAddon (KSPAddon.Startup.Flight, true)]
internal class PreciseManeuver : MonoBehaviour {
private MainWindow mainWindow = new MainWindow();
private PreciseManeuverHotkeys hotkeys = new PreciseManeuverHotkeys();
Expand All @@ -47,12 +47,18 @@ internal class PreciseManeuver : MonoBehaviour {

private GameObject m_WindowPrefab = PreciseManeuverConfig.Instance.Prefabs.LoadAsset<GameObject> ("PreciseManeuverWindow");

private int waitForGizmo = 0;

internal void Start () {
DontDestroyOnLoad (this);

GameEvents.onManeuverNodeSelected.Add (new EventVoid.OnEvent (manager.SearchNewGizmo));

KACWrapper.InitKACWrapper ();
}

internal void OnDestroy() {
GameEvents.onManeuverNodeSelected.Remove (new EventVoid.OnEvent (manager.SearchNewGizmo));
}

internal void OnDisable () {
CloseKeybindingsWindow ();
CloseMainWindow ();
Expand Down Expand Up @@ -81,13 +87,6 @@ internal void Update () {
if (m_MainWindowObject != null) {
hotkeys.ProcessRegularHotkeys ();

if (Input.GetMouseButtonUp (0))
waitForGizmo = 3;
if (waitForGizmo > 0) {
if (waitForGizmo == 1)
manager.SearchNewGizmo ();
waitForGizmo--;
}
manager.UpdateNodes ();
}
}
Expand Down
9 changes: 6 additions & 3 deletions src/PreciseManeuverToolbar.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ namespace KSPPreciseManeuver {
class PreciseManeuverToolbar : MonoBehaviour, UI.IMenuControl {

private ApplicationLauncherButton appButton = null;
private Texture appButtonTexture = PreciseManeuverConfig.Instance.Prefabs.LoadAsset<Texture> ("PreciseManeuverIcon");
private Texture appButtonTexture;

private UI.ToolbarMenu m_ToolbarMenu;
private GameObject m_MenuObject;
private GameObject m_MenuPrefab = PreciseManeuverConfig.Instance.Prefabs.LoadAsset<GameObject>("PreciseManeuverMenu");
private GameObject m_MenuPrefab;

private bool m_MenuPointerIn = false;

Expand Down Expand Up @@ -138,9 +138,12 @@ public void OnMenuPointerExit () {
InputLockManager.RemoveControlLock ("PreciseManeuverMenuControlLock");
}

internal void Awake () {
internal void Start () {
DontDestroyOnLoad (this);

appButtonTexture = PreciseManeuverConfig.Instance.Prefabs.LoadAsset<Texture> ("PreciseManeuverIcon");
m_MenuPrefab = PreciseManeuverConfig.Instance.Prefabs.LoadAsset<GameObject> ("PreciseManeuverMenu");

// subscribe event listeners
GameEvents.onGUIApplicationLauncherReady.Add (OnGUIApplicationLauncherReady);
GameEvents.onGUIApplicationLauncherUnreadifying.Add (OnGUIApplicationLauncherUnreadifying);
Expand Down

0 comments on commit 34fb450

Please sign in to comment.