protected void UpdateCandinates() { bool bShouldResetNull = true; if (arguments != null) { // try auto complete arguments int Index = arguments.Length - 1; var ArgumentTypes = CurrentCommand.argumentsTypes; if (ArgumentTypes != null && Index < ArgumentTypes.Length) { var ArgumentType = ArgumentTypes[Index]; IArgumentDescription ArgDescInterface = ArgumentDescriptionRepository.instance.GetDescription(ArgumentType.argumentType); DebugHelper.Assert(ArgDescInterface != null); List <String> Results = ArgDescInterface.FilteredCandinates(ArgumentType.argumentType, arguments[Index]); ResetCandinates(Results); bShouldResetNull = false; } } if (bShouldResetNull) { CandinatesList.Reset(null); } }
private bool DrawArgument(ArgumentDescriptionAttribute InArgAttr, int InIndex, ArgumentDescriptionAttribute[] InArgTypes, ref string[] OutValues, ref string OutValue) { if (InArgAttr.isOptional && this.ShouldSkip(InArgAttr, ref OutValues)) { return(false); } GUILayout.BeginHorizontal(new GUILayoutOption[0]); base.DrawLabel(InArgAttr.name); string name = string.Format("Argument_{0}", GUIUtility.GetControlID(FocusType.Keyboard)); GUI.SetNextControlName(name); GUILayoutOption[] options = new GUILayoutOption[] { GUILayout.Width(200f) }; OutValue = GUILayout.TextField(OutValue, base.ParentView.CustomTextFieldStyle, options); if (GUI.GetNameOfFocusedControl() == name) { IArgumentDescription description = Singleton <ArgumentDescriptionRepository> .instance.GetDescription(InArgAttr.argumentType); DebugHelper.Assert(description != null); List <string> list = description.FilteredCandinates(InArgAttr.argumentType, OutValue); if ((list != null) && (list.Count > 0)) { for (int i = 0; i < list.Count; i++) { string inButtonText = list[i]; if (!inButtonText.Equals(OutValue, StringComparison.InvariantCultureIgnoreCase) && base.DrawButton(inButtonText, string.Empty)) { OutValue = inButtonText; break; } } } } GUILayout.EndHorizontal(); return(true); }
private bool DrawArgument( ArgumentDescriptionAttribute InArgAttr, int InIndex, ArgumentDescriptionAttribute[] InArgTypes, ref string[] OutValues, ref string OutValue ) { if (InArgAttr.isOptional && ShouldSkip(InArgAttr, ref OutValues)) { return(false); } GUILayout.BeginHorizontal(); DrawLabel(InArgAttr.name); // string InputName = string.Format("{0}_{1}", CheatCommand.command.baseName, InArgAttr.index); string InputName = string.Format("Argument_{0}", GUIUtility.GetControlID(FocusType.Keyboard)); GUI.SetNextControlName(InputName); OutValue = GUILayout.TextField(OutValue, ParentView.CustomTextFieldStyle, GUILayout.Width(200)); string FocusedName = GUI.GetNameOfFocusedControl(); if (FocusedName == InputName) { // let try get some helper for this argument IArgumentDescription ArgDescInterface = ArgumentDescriptionRepository.instance.GetDescription(InArgAttr.argumentType); DebugHelper.Assert(ArgDescInterface != null); List <String> Results = ArgDescInterface.FilteredCandinates(InArgAttr.argumentType, OutValue); if (Results != null && Results.Count > 0) { for (int i = 0; i < Results.Count; ++i) { string CandinateName = Results[i]; if (!CandinateName.Equals(OutValue, StringComparison.InvariantCultureIgnoreCase) && DrawButton(CandinateName) ) { OutValue = CandinateName; break; } } } } GUILayout.EndHorizontal(); return(true); }
private bool DrawArgument(ArgumentDescriptionAttribute InArgAttr, int InIndex, ArgumentDescriptionAttribute[] InArgTypes, ref string[] OutValues, ref string OutValue) { if (InArgAttr.isOptional && this.ShouldSkip(InArgAttr, ref OutValues)) { return(false); } GUILayout.BeginHorizontal(new GUILayoutOption[0]); base.DrawLabel(InArgAttr.name); string text = string.Format("Argument_{0}", GUIUtility.GetControlID(FocusType.Keyboard)); GUI.SetNextControlName(text); OutValue = GUILayout.TextField(OutValue, this.ParentView.CustomTextFieldStyle, new GUILayoutOption[] { GUILayout.Width(200f) }); string nameOfFocusedControl = GUI.GetNameOfFocusedControl(); if (nameOfFocusedControl == text) { IArgumentDescription description = Singleton <ArgumentDescriptionRepository> .instance.GetDescription(InArgAttr.argumentType); DebugHelper.Assert(description != null); List <string> list = description.FilteredCandinates(InArgAttr.argumentType, OutValue); if (list != null && list.get_Count() > 0) { for (int i = 0; i < list.get_Count(); i++) { string text2 = list.get_Item(i); if (!text2.Equals(OutValue, 3) && base.DrawButton(text2, string.Empty)) { OutValue = text2; break; } } } } GUILayout.EndHorizontal(); return(true); }