From 02fa9cb67da5d1fb79361ade65f3977bceb7d52f Mon Sep 17 00:00:00 2001 From: Jonathan Bayer Date: Thu, 31 May 2018 21:18:02 -0400 Subject: [PATCH] Fixed builds Added option to run at max speed always when autorun is enabled Now closes the config window after saving Tweaked size of some buttons Some minor optimizations Now allows deleting 1st preset in list, if more than one exists --- AFBW/AdvancedFlyByWire.cs | 4 ++- AFBW/EVAController.cs | 2 +- AFBW/ModSettingsWindow.cs | 8 +++++ AFBW/PresetEditorWindow.cs | 46 +++++++++---------------- AFBW/PresetEditorWindowNG.cs | 67 +++++++++++++++++------------------- CHANGELOG | 7 ++++ 6 files changed, 67 insertions(+), 67 deletions(-) diff --git a/AFBW/AdvancedFlyByWire.cs b/AFBW/AdvancedFlyByWire.cs index 553e4d0..97012a5 100644 --- a/AFBW/AdvancedFlyByWire.cs +++ b/AFBW/AdvancedFlyByWire.cs @@ -83,6 +83,8 @@ public class AdvancedFlyByWire : MonoBehaviour public bool m_UseOnPreInsteadOfOnFlyByWire = false; + public bool m_MaxMoveSpeedAlways = false; + // Configuration private static readonly string addonFolder = Path.Combine(Path.Combine(KSPUtil.ApplicationRootPath, "GameData"), "ksp-advanced-flybywire"); private Configuration m_Configuration = null; @@ -448,7 +450,7 @@ void DoMainWindow(int index) GUILayout.EndHorizontal(); - if (GUILayout.Button("Mod settings")) + if (GUILayout.Button("Mod settings", GUILayout.Width(m_WindowRect.width / 2))) { if (m_ModSettings == null) { diff --git a/AFBW/EVAController.cs b/AFBW/EVAController.cs index 3aa04d4..7848096 100644 --- a/AFBW/EVAController.cs +++ b/AFBW/EVAController.cs @@ -90,7 +90,7 @@ public void UpdateEVAFlightProperties(ControllerConfiguration config, FlightCtrl { float moveSpeed = moveDirection.magnitude; // Decrease max moveSpeed when not moving in a forwards direction. - if (Vector3.Angle(moveDirection, eva.transform.forward) > 45) + if (!AdvancedFlyByWire.Instance.m_MaxMoveSpeedAlways && Vector3.Angle(moveDirection, eva.transform.forward) > 45) { moveSpeed = Mathf.Clamp(moveSpeed, 0, 0.25f); } diff --git a/AFBW/ModSettingsWindow.cs b/AFBW/ModSettingsWindow.cs index f7df621..b756cc3 100644 --- a/AFBW/ModSettingsWindow.cs +++ b/AFBW/ModSettingsWindow.cs @@ -78,10 +78,18 @@ public void DoWindow(int window) GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); + + GUILayout.BeginHorizontal(); + GUILayout.Label("Run at max speed always (even when not going forward)"); + AdvancedFlyByWire.Instance.m_MaxMoveSpeedAlways = GUILayout.Toggle(AdvancedFlyByWire.Instance.m_MaxMoveSpeedAlways, ""); + GUILayout.FlexibleSpace(); + GUILayout.EndHorizontal(); + GUILayout.BeginHorizontal(); if (GUILayout.Button("Save configuration")) { AdvancedFlyByWire.Instance.SaveState(null); + shouldBeDestroyed = true; } GUILayout.EndHorizontal(); GUI.DragWindow(); diff --git a/AFBW/PresetEditorWindow.cs b/AFBW/PresetEditorWindow.cs index 967dff2..4f9c69a 100644 --- a/AFBW/PresetEditorWindow.cs +++ b/AFBW/PresetEditorWindow.cs @@ -49,8 +49,8 @@ public void SetCurrentBitmask(Bitset mask) public virtual void DoWindow(int window) { - GUILayout.BeginHorizontal(); - GUILayout.FlexibleSpace(); + //GUILayout.BeginHorizontal(); + //GUILayout.FlexibleSpace(); if (GUI.Button(new Rect(windowRect.width - 24, 4, 20, 20), "X") //if (GUILayout.Button("X", GUILayout.Height(16)) @@ -66,7 +66,7 @@ public virtual void DoWindow(int window) return; } - GUILayout.EndHorizontal(); + //GUILayout.EndHorizontal(); var currentPreset = m_Controller.GetCurrentPreset(); @@ -75,33 +75,21 @@ public virtual void DoWindow(int window) currentPreset.name = GUILayout.TextField(currentPreset.name, GUILayout.Width(256)); - if (m_Controller.currentPreset > 0) - { - if (GUILayout.Button("<")) - { - m_Controller.currentPreset--; - } - } - else - { + if (m_Controller.currentPreset <= 0) GUI.enabled = false; - GUILayout.Button("<"); - GUI.enabled = true; - } - - if (m_Controller.currentPreset < m_Controller.presets.Count - 1) + if (GUILayout.Button("<")) { - if (GUILayout.Button(">")) - { - m_Controller.currentPreset++; - } + m_Controller.currentPreset--; } - else - { + GUI.enabled = true; + + if (m_Controller.currentPreset >= m_Controller.presets.Count - 1) GUI.enabled = false; - GUILayout.Button(">"); - GUI.enabled = true; + if (GUILayout.Button(">")) + { + m_Controller.currentPreset++; } + GUI.enabled = true; if (GUILayout.Button("New")) { @@ -219,8 +207,8 @@ public virtual void DoWindow(int window) GUILayout.Space(8); - if (GUI.Button(new Rect(windowRect.width - 24, 4, 20, 20), "X")) - //if (GUILayout.Button("X")) + //if (GUI.Button(new Rect(windowRect.width - 24, 4, 20, 20), "X")) + if (GUILayout.Button("X")) { currentPreset.UnsetContinuousBinding(action); m_CurrentlyEditingContinuousAction = ContinuousAction.None; @@ -283,8 +271,8 @@ public virtual void DoWindow(int window) m_CurrentMask = null; } - if (GUI.Button(new Rect(windowRect.width - 24, 4, 20, 20), "X")) - //if (GUILayout.Button("X")) + //if (GUI.Button(new Rect(windowRect.width - 24, 4, 20, 20), "X")) + if (GUILayout.Button("X")) { currentPreset.UnsetDiscreteBinding(action); m_CurrentlyEditingContinuousAction = ContinuousAction.None; diff --git a/AFBW/PresetEditorWindowNG.cs b/AFBW/PresetEditorWindowNG.cs index 00f74aa..f2cf7cf 100644 --- a/AFBW/PresetEditorWindowNG.cs +++ b/AFBW/PresetEditorWindowNG.cs @@ -80,12 +80,13 @@ public void DoChooseDiscreteActionWindow(int window) GUILayout.BeginHorizontal(); var currentPreset = m_Controller.GetCurrentPreset(); - - if (GUILayout.Button("Cancel")) + GUILayout.FlexibleSpace(); + if (GUILayout.Button("Cancel", GUILayout.Width(m_ChooseDiscreteActionRect.width / 2))) { m_ChooseDiscreteAction = false; return; } + GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); @@ -128,12 +129,13 @@ public void DoChooseContinuousActionWindow(int window) } GUILayout.BeginHorizontal(); var currentPreset = m_Controller.GetCurrentPreset(); - - if (GUILayout.Button("Cancel")) + GUILayout.FlexibleSpace(); + if (GUILayout.Button("Cancel", GUILayout.Width(m_ChooseContinuousActionRect.width / 2))) { m_ChooseContinuousAction = false; return; } + GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); m_ChooseContinuousActionScroll = GUILayout.BeginScrollView(m_ChooseContinuousActionScroll); @@ -174,8 +176,8 @@ public void DoChooseContinuousActionWindow(int window) public override void DoWindow(int window) { - GUILayout.BeginHorizontal(); - GUILayout.FlexibleSpace(); + //GUILayout.BeginHorizontal(); + //GUILayout.FlexibleSpace(); if (GUI.Button(new Rect(windowRect.width - 24, 4, 20, 20), "X") //if (GUILayout.Button("X", GUILayout.Height(16)) @@ -188,11 +190,11 @@ public override void DoWindow(int window) AdvancedFlyByWire.Instance.SaveState(null); } - GUILayout.EndHorizontal(); + //GUILayout.EndHorizontal(); return; } - GUILayout.EndHorizontal(); + //GUILayout.EndHorizontal(); var currentPreset = m_Controller.GetCurrentPreset(); @@ -201,33 +203,26 @@ public override void DoWindow(int window) currentPreset.name = GUILayout.TextField(currentPreset.name, GUILayout.Width(256)); - if (m_Controller.currentPreset > 0) - { - if (GUILayout.Button("<")) - { - m_Controller.currentPreset--; - } - } - else - { + if (m_Controller.currentPreset <= 0) GUI.enabled = false; - GUILayout.Button("<"); - GUI.enabled = true; - } - - if (m_Controller.currentPreset < m_Controller.presets.Count - 1) + + if (GUILayout.Button("<")) { - if (GUILayout.Button(">")) - { - m_Controller.currentPreset++; - } - } - else + m_Controller.currentPreset--; + } + GUI.enabled = true; + + + if (m_Controller.currentPreset >= m_Controller.presets.Count - 1) + GUI.enabled = false; + + if (GUILayout.Button(">")) { - GUI.enabled = false; - GUILayout.Button(">"); - GUI.enabled = true; + m_Controller.currentPreset++; } + + GUI.enabled = true; + if (GUILayout.Button("New")) { @@ -260,7 +255,7 @@ public override void DoWindow(int window) destructiveRemoveLabel = "Sure?"; } - if (m_Controller.presets.Count <= 1 || m_Controller.currentPreset == 0) + if (m_Controller.presets.Count <= 1 /*|| m_Controller.currentPreset == 0 */) { GUI.enabled = false; } @@ -393,8 +388,8 @@ public override void DoWindow(int window) GUILayout.Space(8); - if (GUI.Button(new Rect(windowRect.width - 24, 4, 20, 20), "X")) - //if (GUILayout.Button("X")) + //if (GUI.Button(new Rect(windowRect.width - 24, 4, 20, 20), "X")) + if (GUILayout.Button("X")) { currentPreset.UnsetContinuousBinding(action); m_CurrentlyEditingContinuousAction = ContinuousAction.None; @@ -463,8 +458,8 @@ public override void DoWindow(int window) GUILayout.Space(96); - if (GUI.Button(new Rect(windowRect.width - 24, 4, 20, 20), "X")) - //if (GUILayout.Button("X")) + //if (GUI.Button(new Rect(windowRect.width - 24, 4, 20, 20), "X")) + if (GUILayout.Button("X")) { currentPreset.UnsetDiscreteBinding(action); m_CurrentlyEditingContinuousAction = ContinuousAction.None; diff --git a/CHANGELOG b/CHANGELOG index befc4fb..7d53e4a 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,10 @@ +1.8.0.4 + Fixed builds + Added option to run at max speed always when autorun is enabled + Now closes the config window after saving + Tweaked size of some buttons + some minor optimizations + 1.8.0.3 Updated the SDLs library Updated the SDL2 file