Elin Decompiled Documentation EA 23.102 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
 

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 58 of file UIInputText.cs.

59 {
60 field.onValueChanged.AddListener(OnValueChange);
61 buttons = GetComponentsInChildren<UIButton>();
62 field.textComponent.font = SkinManager.Instance.fontSet.ui.source.font;
63 }
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:65
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 128 of file UIInputText.cs.

129 {
130 field.ActivateInputField();
131 field.Select();
132 }

References field.

Referenced by Dialog.OnAfterInit().

◆ ModNum()

void UIInputText.ModNum ( int  a)
inline

Definition at line 98 of file UIInputText.cs.

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

References Num, and OnValueChange().

◆ OnValueChange()

void UIInputText.OnValueChange ( string  s)
inline

Definition at line 65 of file UIInputText.cs.

66 {
67 Validate();
68 if (onValueChanged != null)
69 {
71 }
72 }
Action< int > onValueChanged
Definition: UIInputText.cs:25
void Validate()
Definition: UIInputText.cs:113

References Num, onValueChanged, and Validate().

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

◆ SetMax()

void UIInputText.SetMax ( )
inline

Definition at line 91 of file UIInputText.cs.

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

References max, Num, and OnValueChange().

◆ SetMin()

void UIInputText.SetMin ( )
inline

Definition at line 84 of file UIInputText.cs.

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

References min, Num, and OnValueChange().

◆ SetMinMax()

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

Definition at line 74 of file UIInputText.cs.

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

References max, min, and textMax.

Referenced by LayerCraft.RefreshInputNum().

◆ Update()

void UIInputText.Update ( )
inlineprivate

Definition at line 134 of file UIInputText.cs.

135 {
136 timer -= Time.deltaTime;
137 if (!EInput.leftMouse.pressedLong || !(timer < 0f))
138 {
139 return;
140 }
141 timer = 0.1f;
142 UIButton componentOf = InputModuleEX.GetComponentOf<UIButton>();
143 UIButton[] array = buttons;
144 foreach (UIButton uIButton in array)
145 {
146 if (uIButton == componentOf)
147 {
148 uIButton.onClick.Invoke();
149 }
150 }
151 }
bool pressedLong
Definition: ButtonState.cs:64
Definition: EInput.cs:8
static ButtonState leftMouse
Definition: EInput.cs:349
float timer
Definition: UIInputText.cs:31

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

◆ Validate()

void UIInputText.Validate ( )
inline

Definition at line 113 of file UIInputText.cs.

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

References max, min, Num, and type.

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

Member Data Documentation

◆ 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 33 of file UIInputText.cs.

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

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

◆ Text

string UIInputText.Text
getset

Definition at line 46 of file UIInputText.cs.

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

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


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