Tanoda
WrappedInputField.cs
Go to the documentation of this file.
1using UnityEngine;
2using UnityEngine.UI;
4
5namespace WebGLSupport
6{
11 {
12 InputField input;
13 RebuildChecker checker;
14
15 public bool ReadOnly { get { return input.readOnly; } }
16
17 public string text
18 {
19 get { return input.text; }
20 set { input.text = value; }
21 }
22
23 public string placeholder
24 {
25 get
26 {
27 if (!input.placeholder) return "";
28 var text = input.placeholder.GetComponent<Text>();
29 return text ? text.text : "";
30 }
31 }
32
33 public int fontSize
34 {
35 get { return input.textComponent.fontSize; }
36 }
37
39 {
40 get { return (ContentType)input.contentType; }
41 }
42
44 {
45 get { return (LineType)input.lineType; }
46 }
47
48 public int characterLimit
49 {
50 get { return input.characterLimit; }
51 }
52
53 public int caretPosition
54 {
55 get { return input.caretPosition; }
56 }
57
58 public bool isFocused
59 {
60 get { return input.isFocused; }
61 }
62
64 {
65 get { return input.selectionFocusPosition; }
66 set { input.selectionFocusPosition = value; }
67 }
68
70 {
71 get { return input.selectionAnchorPosition; }
72 set { input.selectionAnchorPosition = value; }
73 }
74
75 public bool OnFocusSelectAll
76 {
77 get { return true; }
78 }
79
80 public WrappedInputField(InputField input)
81 {
82 this.input = input;
83 checker = new RebuildChecker(this);
84 }
85
87 {
88 return input.GetComponent<RectTransform>();
89 }
90
91 public void ActivateInputField()
92 {
93 input.ActivateInputField();
94 }
95
97 {
98 input.DeactivateInputField();
99 }
100
101 public void Rebuild()
102 {
103 if (checker.NeedRebuild())
104 {
105 input.textComponent.SetAllDirty();
106 input.Rebuild(CanvasUpdate.LatePreRender);
107 }
108 }
109 }
110}
bool NeedRebuild(bool debug=false)
Wrapper for UnityEngine.UI.InputField