using UnityEngine; using UnityEngine.UI; using UnityEngine.Events; namespace SK.Framework { public static class InputFieldExtension { public static T SetTextComponent(this T self, Text text) where T : InputField { self.textComponent = text; return self; } public static T SetTextContent(this T self, string content) where T : InputField { self.text = content; return self; } public static T SetCharacterLimit(this T self, int characterLimit) where T : InputField { self.characterLimit = characterLimit; return self; } public static T SetContentType(this T self, InputField.ContentType contentType) where T : InputField { self.contentType = contentType; return self; } public static T SetLineType(this T self, InputField.LineType lineType) where T : InputField { self.lineType = lineType; return self; } public static T SetPlaceholder(this T self, Text placeholder) where T : InputField { self.placeholder = placeholder; return self; } public static T SetCaretBlinkRate(this T self, float caretBlinkRate) where T : InputField { self.caretBlinkRate = caretBlinkRate; return self; } public static T SetCaretWidth(this T self, int caretWidth) where T : InputField { self.caretWidth = caretWidth; return self; } public static T SetCustomCaretColor(this T self, bool customCaretColor) where T : InputField { self.customCaretColor = customCaretColor; return self; } public static T SetCaretColor(this T self, Color caretColor) where T : InputField { self.caretColor = caretColor; return self; } public static T SetSelectionColor(this T self, Color selectionColor) where T : InputField { self.selectionColor = selectionColor; return self; } public static T SetHideMobileInput(this T self, bool hideMobileInput) where T : InputField { self.shouldHideMobileInput = hideMobileInput; return self; } public static T SetReadOnly(this T self, bool readOnly) where T : InputField { self.readOnly = readOnly; return self; } public static T SetOnValueChanged(this T self, UnityAction unityAction) where T : InputField { self.onValueChanged.AddListener(unityAction); return self; } public static T SetOnEndEdit(this T self, UnityAction unityAction) where T : InputField { self.onEndEdit.AddListener(unityAction); return self; } } }