Kerbal Space Program  1.12.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros
Static Public Member Functions | Public Attributes | Protected Types | Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
KSP.UI.Screens.BasePartCategorizer Class Reference
Inheritance diagram for KSP.UI.Screens.BasePartCategorizer:
Expansions.Missions.Editor.MEPartCategorizer KSP.UI.Screens.PartCategorizer

Static Public Member Functions

static string GeneratePartAutoTags (AvailablePart p)
 
static string[] SearchTagSplit (string terms)
 

Public Attributes

Color colorFilterFunction = new Color(0.604f, 0.784f, 0.878f, 1)
 
Color colorIcons = new Color(1, 1, 1, 0.7f)
 
IconLoader iconLoader
 
UIList scrollListSub
 
TMPro.TMP_InputField searchField
 
float searchKeystrokeDelay = 0.25f
 

Protected Types

enum  MatchType {
  MatchType.NONE, MatchType.EQUALS_ONLY, MatchType.TERM_STARTS_WITH_TAG, MatchType.TERM_ENDS_WITH_TAG,
  MatchType.TAG_STARTS_WITH_TERM, MatchType.TAG_ENDS_WITH_TERM, MatchType.EITHER_STARTS_WITH_EITHER, MatchType.EITHER_ENDS_WITH_EITHER,
  MatchType.TERM_CONTAINS_TAG, MatchType.TAG_CONTAINS_TERM, MatchType.EITHER_CONTAINS_EITHER
}
 

Protected Member Functions

bool PartMatchesSearch (AvailablePart part, string[] terms)
 
virtual void SearchField_OnClick (PointerEventData eventData)
 
virtual void SearchField_OnEndEdit (string s)
 
virtual void SearchField_OnValueChange (string s)
 
virtual void SearchFilterResult (EditorPartListFilter< AvailablePart > filter)
 
virtual IEnumerator SearchRoutine ()
 
virtual void SearchStart ()
 
virtual void SearchStop ()
 
MatchType TagMatchType (ref string tag)
 
bool TermMatchesTag (string term, string tag)
 

Protected Attributes

EditorPartListFilter
< AvailablePart
filterAero = new EditorPartListFilter<AvailablePart>("Function_Aero", p => p.category == PartCategories.Aero, "")
 
EditorPartListFilter
< AvailablePart
filterCargo = new EditorPartListFilter<AvailablePart>("Function_Cargo", p => p.category == PartCategories.Cargo, "")
 
EditorPartListFilter
< AvailablePart
filterCommunication = new EditorPartListFilter<AvailablePart>("Function_Communication", p => p.category == PartCategories.Communication, "")
 
EditorPartListFilter
< AvailablePart
filterControl = new EditorPartListFilter<AvailablePart>("Function_Control", p => p.category == PartCategories.Control, "")
 
EditorPartListFilter
< AvailablePart
filterCoupling = new EditorPartListFilter<AvailablePart>("Function_Coupling", p => p.category == PartCategories.Coupling, "")
 
EditorPartListFilter
< AvailablePart
filterElectrical = new EditorPartListFilter<AvailablePart>("Function_Electrical", p => p.category == PartCategories.Electrical, "")
 
EditorPartListFilter
< AvailablePart
filterEngine = new EditorPartListFilter<AvailablePart>("Function_Engine", p => p.category == PartCategories.Engine || (p.category == PartCategories.Propulsion && p.moduleInfos.Exists(q => q.moduleName == "Engine")), "")
 
EditorPartListFilter
< AvailablePart
filterFuelTank = new EditorPartListFilter<AvailablePart>("Function_FuelTank", p => p.category == PartCategories.FuelTank || (p.category == PartCategories.Propulsion && !p.moduleInfos.Exists(q => q.moduleName == "Engine")), "")
 
EditorPartListFilter
< AvailablePart
filterGround = new EditorPartListFilter<AvailablePart>("Function_Ground", p => p.category == PartCategories.Ground, "")
 
EditorPartListFilter
< AvailablePart
filterPayload = new EditorPartListFilter<AvailablePart>("Function_Payload", p => p.category == PartCategories.Payload, "")
 
EditorPartListFilter
< AvailablePart
filterPods = new EditorPartListFilter<AvailablePart>("Function_Pods", p => p.category == PartCategories.Pods, "")
 
EditorPartListFilter
< AvailablePart
filterRobotics = new EditorPartListFilter<AvailablePart>("Function_Robotics", p => p.category == PartCategories.Robotics, "")
 
EditorPartListFilter
< AvailablePart
filterScience = new EditorPartListFilter<AvailablePart>("Function_Science", p => p.category == PartCategories.Science, "")
 
EditorPartListFilter
< AvailablePart
filterStructural = new EditorPartListFilter<AvailablePart>("Function_Structural", p => p.category == PartCategories.Structural, "")
 
EditorPartListFilter
< AvailablePart
filterThermal = new EditorPartListFilter<AvailablePart>("Function_Thermal", p => p.category == PartCategories.Thermal, "")
 
EditorPartListFilter
< AvailablePart
filterUtility = new EditorPartListFilter<AvailablePart>("Function_Utility", p => p.category == PartCategories.Utility, "")
 
GameObject iconLoaderPrefab
 
Image searchFieldBackground
 
PointerClickHandler searchFieldClickHandler
 
Coroutine searchRoutine
 
float searchTimer = 0f
 

Static Protected Attributes

static string[] cargoTag = { "cargo" }
 
static string[] mannedTags = { "(crew", "(mann", "kerbal" }
 
static string[] radialTag = { "radial" }
 
static string[] size0Tags = { "0.625", ")mini", "small", "tiny", "little", "micro" }
 
static string[] size1p5Tags = { "1.875", "FL-TX", "regular", "standard", "average", "medium" }
 
static string[] size1Tags = { "1.25", "FL-T", "regular", "standard", "average", "medium" }
 
static string[] size2Tags = { "2.5", "huge", "jumbo", "large", "big" }
 
static string[] size3Tags = { "3.75", "enormous", "massive", "gigantic", "giant" }
 
static string[] size4Tags = { "5", "enormous", "massive", "gigantic", "giant" }
 
static string[] srfTags = { "surface", "attach" }
 
static string[] unmannedTags = { "(uncrew", "(unmann" }
 
static string[] xfeedTags = { "cross", "feed" }
 

Member Enumeration Documentation

enum KSP.UI.Screens.BasePartCategorizer.MatchType
protected
Enumerator
NONE 
EQUALS_ONLY 
TERM_STARTS_WITH_TAG 
TERM_ENDS_WITH_TAG 
TAG_STARTS_WITH_TERM 
TAG_ENDS_WITH_TERM 
EITHER_STARTS_WITH_EITHER 
EITHER_ENDS_WITH_EITHER 
TERM_CONTAINS_TAG 
TAG_CONTAINS_TERM 
EITHER_CONTAINS_EITHER 

Member Function Documentation

static string KSP.UI.Screens.BasePartCategorizer.GeneratePartAutoTags ( AvailablePart  p)
inlinestatic

< Title tags we mostly want default contains, with a little special treatment for short words.

< Not including mk2 and mk3, mark handling is non-standard.

bool KSP.UI.Screens.BasePartCategorizer.PartMatchesSearch ( AvailablePart  part,
string[]  terms 
)
inlineprotected

< PartLoader has pre-loaded all metadata from the part config tags and from GeneratePartAutoTags into p.tags.

< For each word in the search, check the title and tags for a match. All words in the search must be found for the part to succeed.

< Avoid short words like the "I" in "Pegasus I Mobility Enhancer". They match nearly everything.

< Check the word using an algorithm determined by TagMatchType.

virtual void KSP.UI.Screens.BasePartCategorizer.SearchField_OnClick ( PointerEventData  eventData)
inlineprotectedvirtual

Reimplemented in KSP.UI.Screens.PartCategorizer.

virtual void KSP.UI.Screens.BasePartCategorizer.SearchField_OnEndEdit ( string  s)
inlineprotectedvirtual

Reimplemented in KSP.UI.Screens.PartCategorizer.

virtual void KSP.UI.Screens.BasePartCategorizer.SearchField_OnValueChange ( string  s)
inlineprotectedvirtual
virtual void KSP.UI.Screens.BasePartCategorizer.SearchFilterResult ( EditorPartListFilter< AvailablePart filter)
inlineprotectedvirtual
virtual IEnumerator KSP.UI.Screens.BasePartCategorizer.SearchRoutine ( )
inlineprotectedvirtual

Reimplemented in KSP.UI.Screens.PartCategorizer.

virtual void KSP.UI.Screens.BasePartCategorizer.SearchStart ( )
inlineprotectedvirtual
virtual void KSP.UI.Screens.BasePartCategorizer.SearchStop ( )
inlineprotectedvirtual

Reimplemented in KSP.UI.Screens.PartCategorizer.

static string [] KSP.UI.Screens.BasePartCategorizer.SearchTagSplit ( string  terms)
inlinestatic
MatchType KSP.UI.Screens.BasePartCategorizer.TagMatchType ( ref string  tag)
inlineprotected
bool KSP.UI.Screens.BasePartCategorizer.TermMatchesTag ( string  term,
string  tag 
)
inlineprotected

Member Data Documentation

string [] KSP.UI.Screens.BasePartCategorizer.cargoTag = { "cargo" }
staticprotected
Color KSP.UI.Screens.BasePartCategorizer.colorFilterFunction = new Color(0.604f, 0.784f, 0.878f, 1)
Color KSP.UI.Screens.BasePartCategorizer.colorIcons = new Color(1, 1, 1, 0.7f)
EditorPartListFilter<AvailablePart> KSP.UI.Screens.BasePartCategorizer.filterAero = new EditorPartListFilter<AvailablePart>("Function_Aero", p => p.category == PartCategories.Aero, "")
protected
EditorPartListFilter<AvailablePart> KSP.UI.Screens.BasePartCategorizer.filterCargo = new EditorPartListFilter<AvailablePart>("Function_Cargo", p => p.category == PartCategories.Cargo, "")
protected
EditorPartListFilter<AvailablePart> KSP.UI.Screens.BasePartCategorizer.filterCommunication = new EditorPartListFilter<AvailablePart>("Function_Communication", p => p.category == PartCategories.Communication, "")
protected
EditorPartListFilter<AvailablePart> KSP.UI.Screens.BasePartCategorizer.filterControl = new EditorPartListFilter<AvailablePart>("Function_Control", p => p.category == PartCategories.Control, "")
protected
EditorPartListFilter<AvailablePart> KSP.UI.Screens.BasePartCategorizer.filterCoupling = new EditorPartListFilter<AvailablePart>("Function_Coupling", p => p.category == PartCategories.Coupling, "")
protected
EditorPartListFilter<AvailablePart> KSP.UI.Screens.BasePartCategorizer.filterElectrical = new EditorPartListFilter<AvailablePart>("Function_Electrical", p => p.category == PartCategories.Electrical, "")
protected
EditorPartListFilter<AvailablePart> KSP.UI.Screens.BasePartCategorizer.filterEngine = new EditorPartListFilter<AvailablePart>("Function_Engine", p => p.category == PartCategories.Engine || (p.category == PartCategories.Propulsion && p.moduleInfos.Exists(q => q.moduleName == "Engine")), "")
protected
EditorPartListFilter<AvailablePart> KSP.UI.Screens.BasePartCategorizer.filterFuelTank = new EditorPartListFilter<AvailablePart>("Function_FuelTank", p => p.category == PartCategories.FuelTank || (p.category == PartCategories.Propulsion && !p.moduleInfos.Exists(q => q.moduleName == "Engine")), "")
protected
EditorPartListFilter<AvailablePart> KSP.UI.Screens.BasePartCategorizer.filterGround = new EditorPartListFilter<AvailablePart>("Function_Ground", p => p.category == PartCategories.Ground, "")
protected
EditorPartListFilter<AvailablePart> KSP.UI.Screens.BasePartCategorizer.filterPayload = new EditorPartListFilter<AvailablePart>("Function_Payload", p => p.category == PartCategories.Payload, "")
protected
EditorPartListFilter<AvailablePart> KSP.UI.Screens.BasePartCategorizer.filterPods = new EditorPartListFilter<AvailablePart>("Function_Pods", p => p.category == PartCategories.Pods, "")
protected
EditorPartListFilter<AvailablePart> KSP.UI.Screens.BasePartCategorizer.filterRobotics = new EditorPartListFilter<AvailablePart>("Function_Robotics", p => p.category == PartCategories.Robotics, "")
protected
EditorPartListFilter<AvailablePart> KSP.UI.Screens.BasePartCategorizer.filterScience = new EditorPartListFilter<AvailablePart>("Function_Science", p => p.category == PartCategories.Science, "")
protected
EditorPartListFilter<AvailablePart> KSP.UI.Screens.BasePartCategorizer.filterStructural = new EditorPartListFilter<AvailablePart>("Function_Structural", p => p.category == PartCategories.Structural, "")
protected
EditorPartListFilter<AvailablePart> KSP.UI.Screens.BasePartCategorizer.filterThermal = new EditorPartListFilter<AvailablePart>("Function_Thermal", p => p.category == PartCategories.Thermal, "")
protected
EditorPartListFilter<AvailablePart> KSP.UI.Screens.BasePartCategorizer.filterUtility = new EditorPartListFilter<AvailablePart>("Function_Utility", p => p.category == PartCategories.Utility, "")
protected
IconLoader KSP.UI.Screens.BasePartCategorizer.iconLoader
GameObject KSP.UI.Screens.BasePartCategorizer.iconLoaderPrefab
protected
string [] KSP.UI.Screens.BasePartCategorizer.mannedTags = { "(crew", "(mann", "kerbal" }
staticprotected
string [] KSP.UI.Screens.BasePartCategorizer.radialTag = { "radial" }
staticprotected
UIList KSP.UI.Screens.BasePartCategorizer.scrollListSub
TMPro.TMP_InputField KSP.UI.Screens.BasePartCategorizer.searchField
Image KSP.UI.Screens.BasePartCategorizer.searchFieldBackground
protected
PointerClickHandler KSP.UI.Screens.BasePartCategorizer.searchFieldClickHandler
protected
float KSP.UI.Screens.BasePartCategorizer.searchKeystrokeDelay = 0.25f
Coroutine KSP.UI.Screens.BasePartCategorizer.searchRoutine
protected
float KSP.UI.Screens.BasePartCategorizer.searchTimer = 0f
protected
string [] KSP.UI.Screens.BasePartCategorizer.size0Tags = { "0.625", ")mini", "small", "tiny", "little", "micro" }
staticprotected
string [] KSP.UI.Screens.BasePartCategorizer.size1p5Tags = { "1.875", "FL-TX", "regular", "standard", "average", "medium" }
staticprotected
string [] KSP.UI.Screens.BasePartCategorizer.size1Tags = { "1.25", "FL-T", "regular", "standard", "average", "medium" }
staticprotected
string [] KSP.UI.Screens.BasePartCategorizer.size2Tags = { "2.5", "huge", "jumbo", "large", "big" }
staticprotected
string [] KSP.UI.Screens.BasePartCategorizer.size3Tags = { "3.75", "enormous", "massive", "gigantic", "giant" }
staticprotected
string [] KSP.UI.Screens.BasePartCategorizer.size4Tags = { "5", "enormous", "massive", "gigantic", "giant" }
staticprotected
string [] KSP.UI.Screens.BasePartCategorizer.srfTags = { "surface", "attach" }
staticprotected
string [] KSP.UI.Screens.BasePartCategorizer.unmannedTags = { "(uncrew", "(unmann" }
staticprotected
string [] KSP.UI.Screens.BasePartCategorizer.xfeedTags = { "cross", "feed" }
staticprotected

The documentation for this class was generated from the following file: