private void CreateDefaultLineObjectInjectibleSuggestion(string method_name, TextEditor tEditor) { if (string.IsNullOrEmpty(method_name) || methodReflections.ContainsKey(method_name) == false) { method_name = defaultStringMethod; } var method = methodReflections[method_name]; var att = method.GetCustomAttribute <ScriptboundObject.StringInjectible>(); if (att == null) { return; } hint_result_input = null; hint_result_input_object = null; ScriptboundObjectEditorHintPopup popup = null; var line_var = ExtractDefaultLineInjectibleBeforeCursor(tEditor); if (att.types != null && att.types.Length > 0) { popup = new ScriptboundObjectEditorHintPopup(); popup.SetupByTypes(new List <System.Type>(att.types), line_var, folders: att.locations); } else if (att.labels != null && att.labels.Length > 0) { popup = new ScriptboundObjectEditorHintPopup(); popup.SetupByLabels(new List <string>(att.labels), line_var, folders: att.locations); } else { return; } popup.callbackClose += () => { hint_popup_completed = true; }; popup.callbackInput += (result) => { hint_result_input = result; hint_popup_completed = true; }; popup.callbackInputObject += (str, result) => { hint_result_input = str; hint_result_input_object = result; hint_popup_completed = true; }; PopupWindow.Show(hint_rect_position, popup); }
void CreateSuggestionPopup(string line_mod, string line_method, int line_index, string line_var) { //Debug.Log(string.Format("{0} - {1} - {2} - {3}", line_mod, line_method, line_index, line_var)); hint_result_input = null; hint_result_input_object = null; ScriptboundObjectEditorHintPopup popup = null; if (line_index <= -1) { popup = new ScriptboundObjectEditorHintPopup(methodReflections, line_var); } if (line_index >= 0) { if (line_method == null) { return; } if (methodReflections.ContainsKey(line_method) == false) { return; } var method = methodReflections[line_method]; var parameters = method.GetParameters(); if (line_index >= parameters.Length) { return; } var param_type = parameters[line_index].ParameterType; if (param_type.IsPrimitive || param_type == typeof(string)) { return; } if (typeof(UnityEngine.Object).IsAssignableFrom(param_type) && StringToObject(line_var) != null) { popup = new ScriptboundObjectEditorHintPopup(param_type, StringToObject(line_var)); } else { popup = new ScriptboundObjectEditorHintPopup(param_type, line_var); } } popup.callbackClose += () => { hint_popup_completed = true; }; popup.callbackInput += (result) => { hint_result_input = result; hint_popup_completed = true; }; popup.callbackInputObject += (str, result) => { hint_result_input = str; hint_result_input_object = result; hint_popup_completed = true; }; PopupWindow.Show(hint_rect_position, popup); }