Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Limiting search bar #72

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions KerbalEngineer/Flight/Readouts/Rendezvous/TargetSelector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ namespace KerbalEngineer.Flight.Readouts.Rendezvous
{
public class TargetSelector : ReadoutModule
{

#region Fields

private string searchQuery = string.Empty;
Expand All @@ -38,6 +39,7 @@ public class TargetSelector : ReadoutModule
private float typeButtonWidth;
private bool typeIsBody;
private bool usingSearch;
private bool displayDebrisAndFlags = false;
private VesselType vesselType = VesselType.Unknown;

#endregion
Expand Down Expand Up @@ -194,6 +196,8 @@ private void DrawSearch()
this.usingSearch = false;
this.ResizeRequested = true;
}

this.displayDebrisAndFlags = GUILayout.Toggle(this.displayDebrisAndFlags,"Show All", this.ButtonStyle,GUILayout.Width(60.0f * GuiDisplaySize.Offset));

GUILayout.EndHorizontal();
}
Expand Down Expand Up @@ -335,6 +339,12 @@ private int DrawVessels()
continue;
}

//Ignores Debris and Flags on search bar
if (this.searchQuery.Length != 0 && !displayDebrisAndFlags && (vessel.vesselType == VesselType.Debris || vessel.vesselType == VesselType.Flag))
{
continue;
}

if (this.searchQuery.Length == 0)
{
count++;
Expand Down