Skip to content

Commit

Permalink
Fixed builds
Browse files Browse the repository at this point in the history
	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
  • Loading branch information
linuxgurugamer committed Jun 1, 2018
1 parent ac54c0b commit 02fa9cb
Show file tree
Hide file tree
Showing 6 changed files with 67 additions and 67 deletions.
4 changes: 3 additions & 1 deletion AFBW/AdvancedFlyByWire.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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)
{
Expand Down
2 changes: 1 addition & 1 deletion AFBW/EVAController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
8 changes: 8 additions & 0 deletions AFBW/ModSettingsWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
46 changes: 17 additions & 29 deletions AFBW/PresetEditorWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand All @@ -66,7 +66,7 @@ public virtual void DoWindow(int window)
return;
}

GUILayout.EndHorizontal();
//GUILayout.EndHorizontal();

var currentPreset = m_Controller.GetCurrentPreset();

Expand All @@ -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"))
{
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
67 changes: 31 additions & 36 deletions AFBW/PresetEditorWindowNG.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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();

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

Expand All @@ -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"))
{
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit 02fa9cb

Please sign in to comment.