Elin Decompiled Documentation EA 23.240 Nightly
Loading...
Searching...
No Matches
UIInputText Class Reference
Inheritance diagram for UIInputText:

Public Types

enum  Type { Number , Name }
 

Public Member Functions

void OnValueChange (string s)
 
void SetMinMax (int _min, int _max)
 
void SetMin ()
 
void SetMax ()
 
void ModNum (int a)
 
void Validate ()
 
void Focus ()
 

Public Attributes

Type type
 
InputField field
 
bool number
 
bool showMax
 
int min
 
int max
 
Action< int > onValueChanged
 
Text textMax
 
UIButton[] buttons
 

Properties

int Num [get, set]
 
string Text [get, set]
 

Private Member Functions

void Awake ()
 
void Update ()
 

Private Attributes

float timer
 
UIButton buttonClicked
 

Detailed Description

Definition at line 5 of file UIInputText.cs.

Member Enumeration Documentation

◆ Type

Enumerator
Number 
Name 

Definition at line 7 of file UIInputText.cs.

Member Function Documentation

◆ Awake()

void UIInputText.Awake ( )
inlineprivate

Definition at line 60 of file UIInputText.cs.

61 {
62 field.onValueChanged.AddListener(OnValueChange);
63 buttons = GetComponentsInChildren<UIButton>();
64 field.textComponent.font = SkinManager.Instance.fontSet.ui.source.font;
65 }
Font font
Definition: FontSource.cs:9
FontSet fontSet
Definition: SkinManager.cs:74
static SkinManager Instance
Definition: SkinManager.cs:78
InputField field
Definition: UIInputText.cs:15
void OnValueChange(string s)
Definition: UIInputText.cs:67
UIButton[] buttons
Definition: UIInputText.cs:29

References buttons, field, FontSource.font, SkinManager.fontSet, SkinManager.Instance, OnValueChange(), SkinManager.FontData.source, and SkinManager.FontSet.ui.

◆ Focus()

void UIInputText.Focus ( )
inline

Definition at line 130 of file UIInputText.cs.

131 {
132 field.ActivateInputField();
133 field.Select();
134 }

References field.

Referenced by Dialog.OnAfterInit().

◆ ModNum()

void UIInputText.ModNum ( int  a)
inline

Definition at line 100 of file UIInputText.cs.

101 {
102 int num = Num;
103 Num += a;
104 OnValueChange("");
105 if (num != Num)
106 {
107 SE.Click();
108 }
109 else
110 {
111 SE.BeepSmall();
112 }
113 }

References Num, and OnValueChange().

◆ OnValueChange()

void UIInputText.OnValueChange ( string  s)
inline

Definition at line 67 of file UIInputText.cs.

68 {
69 Validate();
70 if (onValueChanged != null)
71 {
73 }
74 }
Action< int > onValueChanged
Definition: UIInputText.cs:25
void Validate()
Definition: UIInputText.cs:115

References Num, onValueChanged, and Validate().

Referenced by Awake(), ModNum(), SetMax(), and SetMin().

◆ SetMax()

void UIInputText.SetMax ( )
inline

Definition at line 93 of file UIInputText.cs.

94 {
95 Num = max;
96 OnValueChange("");
97 SE.Click();
98 }

References max, Num, and OnValueChange().

◆ SetMin()

void UIInputText.SetMin ( )
inline

Definition at line 86 of file UIInputText.cs.

87 {
88 Num = min;
89 OnValueChange("");
90 SE.Click();
91 }

References min, Num, and OnValueChange().

◆ SetMinMax()

void UIInputText.SetMinMax ( int  _min,
int  _max 
)
inline

Definition at line 76 of file UIInputText.cs.

77 {
78 min = _min;
79 max = _max;
80 if ((bool)textMax)
81 {
82 textMax.text = "/" + max;
83 }
84 }
Text textMax
Definition: UIInputText.cs:27

References max, min, and textMax.

Referenced by LayerCraft.RefreshInputNum().

◆ Update()

void UIInputText.Update ( )
inlineprivate

Definition at line 136 of file UIInputText.cs.

137 {
138 timer -= Time.deltaTime;
140 {
141 if (!(timer < 0f))
142 {
143 return;
144 }
145 timer = 0.1f;
146 UIButton componentOf = InputModuleEX.GetComponentOf<UIButton>();
147 UIButton[] array = buttons;
148 foreach (UIButton uIButton in array)
149 {
150 if (uIButton == componentOf && uIButton == buttonClicked)
151 {
152 uIButton.onClick.Invoke();
153 }
154 }
155 }
156 else if (EInput.leftMouse.down)
157 {
158 buttonClicked = InputModuleEX.GetComponentOf<UIButton>();
159 }
160 }
bool pressedLong
Definition: ButtonState.cs:64
Definition: EInput.cs:8
static ButtonState leftMouse
Definition: EInput.cs:349
float timer
Definition: UIInputText.cs:31
UIButton buttonClicked
Definition: UIInputText.cs:33

References buttonClicked, buttons, ButtonState.down, EInput.leftMouse, ButtonState.pressedLong, and timer.

◆ Validate()

void UIInputText.Validate ( )
inline

Definition at line 115 of file UIInputText.cs.

116 {
117 if (type == Type.Number)
118 {
119 if (Num < min)
120 {
121 Num = min;
122 }
123 if (Num > max)
124 {
125 Num = max;
126 }
127 }
128 }

References max, min, Num, and type.

Referenced by OnValueChange(), and LayerCraft.RefreshInputNum().

Member Data Documentation

◆ buttonClicked

UIButton UIInputText.buttonClicked
private

Definition at line 33 of file UIInputText.cs.

Referenced by Update().

◆ buttons

UIButton [] UIInputText.buttons

Definition at line 29 of file UIInputText.cs.

Referenced by Awake(), and Update().

◆ field

InputField UIInputText.field

Definition at line 15 of file UIInputText.cs.

Referenced by Awake(), Focus(), and Dialog.OnKill().

◆ max

int UIInputText.max

Definition at line 23 of file UIInputText.cs.

Referenced by SetMax(), SetMinMax(), and Validate().

◆ min

int UIInputText.min

Definition at line 21 of file UIInputText.cs.

Referenced by SetMin(), SetMinMax(), and Validate().

◆ number

bool UIInputText.number

Definition at line 17 of file UIInputText.cs.

◆ onValueChanged

Action<int> UIInputText.onValueChanged

Definition at line 25 of file UIInputText.cs.

Referenced by OnValueChange().

◆ showMax

bool UIInputText.showMax

Definition at line 19 of file UIInputText.cs.

◆ textMax

Text UIInputText.textMax

Definition at line 27 of file UIInputText.cs.

Referenced by SetMinMax().

◆ timer

float UIInputText.timer
private

Definition at line 31 of file UIInputText.cs.

Referenced by Update().

◆ type

Type UIInputText.type

Definition at line 13 of file UIInputText.cs.

Referenced by Validate().

Property Documentation

◆ Num

int UIInputText.Num
getset

Definition at line 35 of file UIInputText.cs.

36 {
37 get
38 {
39 int.TryParse(field.text, out var result);
40 return result;
41 }
42 set
43 {
44 field.SetTextWithoutNotify(value.ToString() ?? "");
45 }
46 }

Referenced by LayerCraft.GetReqIngredient(), ModNum(), LayerCraft.OnClickCraft(), OnValueChange(), LayerCraft.RefreshProduct(), SetMax(), SetMin(), and Validate().

◆ Text

string UIInputText.Text
getset

Definition at line 48 of file UIInputText.cs.

49 {
50 get
51 {
52 return field.text;
53 }
54 set
55 {
56 field.SetTextWithoutNotify(value);
57 }
58 }

Referenced by Dialog.InputName(), and Dialog.OnKill().


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