Elin Decompiled Documentation EA 23.102 Nightly
Loading...
Searching...
No Matches
UIMagicChest Class Reference
Inheritance diagram for UIMagicChest:
EMono

Public Member Functions

void Init ()
 
void OnAfterRedraw ()
 
void RefreshCats ()
 
void RefreshBottom ()
 
void Search (string s)
 
void ClearSearch ()
 
void Redraw ()
 

Public Attributes

LayoutGroup layoutPage
 
LayoutGroup layoutCat
 
LayoutGroup layoutBottom
 
UIButton itemNum
 
UIButton itemElec
 
UIButton buttonClearSearch
 
UIButton moldCat
 
UISelectableGroup groupPage
 
List< UIButtonbuttonsPage
 
UIInventory uiInventory
 
InputField inputSearch
 
float intervalSearch
 
int page
 
int pageMax
 
List< ThingfilteredList = new List<Thing>()
 
Color colorCat
 
Color colorCatSelected
 
HashSet< string > cats = new HashSet<string>()
 
Dictionary< string, UIButtoncatButton = new Dictionary<string, UIButton>()
 
Dictionary< string, int > catCount = new Dictionary<string, int>()
 
string idCat = ""
 
string lastSearch = ""
 
HashSet< RecipesearchRecipes = new HashSet<Recipe>()
 

Properties

Card container [get]
 
int GridSize [get]
 
- Properties inherited from EMono
static Game game [get]
 
static bool AdvMode [get]
 
static Player player [get]
 
static Chara pc [get]
 
static UI ui [get]
 
static Map _map [get]
 
static Zone _zone [get]
 
static FactionBranch Branch [get]
 
static FactionBranch BranchOrHomeBranch [get]
 
static Faction Home [get]
 
static Scene scene [get]
 
static BaseGameScreen screen [get]
 
static GameSetting setting [get]
 
static GameData gamedata [get]
 
static ColorProfile Colors [get]
 
static World world [get]
 
static SoundManager Sound [get]
 
static SourceManager sources [get]
 
static SourceManager editorSources [get]
 
static CoreDebug debug [get]
 

Private Member Functions

void LateUpdate ()
 

Private Attributes

bool firstSearch = true
 
float timerSearch
 

Additional Inherited Members

- Static Public Member Functions inherited from EMono
static int rnd (int a)
 
- Static Public Attributes inherited from EMono
static Core core
 

Detailed Description

Definition at line 5 of file UIMagicChest.cs.

Member Function Documentation

◆ ClearSearch()

void UIMagicChest.ClearSearch ( )
inline

Definition at line 200 of file UIMagicChest.cs.

201 {
202 inputSearch.text = "";
203 timerSearch = 0f;
204 lastSearch = "";
205 Redraw();
206 }
string lastSearch
Definition: UIMagicChest.cs:53
float timerSearch
Definition: UIMagicChest.cs:51

◆ Init()

void UIMagicChest.Init ( )
inline

Definition at line 61 of file UIMagicChest.cs.

62 {
63 UIButton t = layoutPage.CreateMold<UIButton>();
64 moldCat = layoutCat.CreateMold<UIButton>();
65 for (int i = 0; i < 9; i++)
66 {
68 b.mainText.text = (i + 1).ToString() ?? "";
69 buttonsPage.Add(b);
70 int _i = i;
71 b.SetOnClick(delegate
72 {
74 {
75 page = _i;
77 SE.Tab();
78 Redraw();
79 }
80 });
81 }
83 inputSearch.onValueChanged.AddListener(Search);
84 inputSearch.onSubmit.AddListener(Search);
86 itemNum.RebuildLayout();
87 itemElec.RebuildLayout();
88 layoutBottom.RebuildLayout();
89 }
static UIContextMenu Current
List< UIButton > buttonsPage
Definition: UIMagicChest.cs:23
LayoutGroup layoutCat
Definition: UIMagicChest.cs:9
UIButton itemNum
Definition: UIMagicChest.cs:13
UISelectableGroup groupPage
Definition: UIMagicChest.cs:21
LayoutGroup layoutBottom
Definition: UIMagicChest.cs:11
void RefreshBottom()
InputField inputSearch
Definition: UIMagicChest.cs:27
UIButton moldCat
Definition: UIMagicChest.cs:19
LayoutGroup layoutPage
Definition: UIMagicChest.cs:7
UIButton itemElec
Definition: UIMagicChest.cs:15
void Select(UIButton button, bool check=true)
virtual void Init(int index=0, UnityAction< int > action=null, bool directChildren=false)
Definition: Util.cs:10
static Transform Instantiate(string path, Component parent=null)
Definition: Util.cs:67

References buttonsPage, UIContextMenu.Current, groupPage, UISelectableGroup.Init(), inputSearch, itemElec, itemNum, layoutBottom, layoutCat, layoutPage, moldCat, page, Redraw(), RefreshBottom(), Search, UISelectableGroup.Select(), and Util.

◆ LateUpdate()

void UIMagicChest.LateUpdate ( )
inlineprivate

Definition at line 149 of file UIMagicChest.cs.

150 {
151 if (timerSearch > 0f)
152 {
154 if (timerSearch <= 0f)
155 {
156 Search(inputSearch.text);
157 }
158 }
159 if (EInput.wheel != 0 && !UIContextMenu.Current)
160 {
161 SE.Tab();
162 page -= EInput.wheel;
163 if (page < 0)
164 {
165 page = pageMax;
166 }
167 if (page > pageMax)
168 {
169 page = 0;
170 }
171 Redraw();
172 }
173 }
Definition: Core.cs:14
static float delta
Definition: Core.cs:17
Definition: EInput.cs:8
static int wheel
Definition: EInput.cs:289

References UIContextMenu.Current, Core.delta, Search, and EInput.wheel.

◆ OnAfterRedraw()

void UIMagicChest.OnAfterRedraw ( )
inline

Definition at line 91 of file UIMagicChest.cs.

92 {
94 for (int i = 0; i < buttonsPage.Count; i++)
95 {
96 buttonsPage[i].interactable = i <= pageMax;
97 }
98 groupPage.selected = null;
100 }

References buttonsPage, groupPage, page, pageMax, RefreshBottom(), and UISelectableGroup.Select().

◆ Redraw()

void UIMagicChest.Redraw ( )
inline

Definition at line 208 of file UIMagicChest.cs.

209 {
211 }
UIList list
Definition: UIInventory.cs:79
override void Redraw()
Definition: UIList.cs:740
UIInventory uiInventory
Definition: UIMagicChest.cs:25

References UIInventory.list, and UIList.Redraw().

Referenced by Init(), and RefreshCats().

◆ RefreshBottom()

void UIMagicChest.RefreshBottom ( )
inline

Definition at line 143 of file UIMagicChest.cs.

144 {
145 itemNum.mainText.text = container.things.Count + " / " + container.things.MaxCapacity;
146 itemElec.mainText.SetText(Mathf.Abs(container.trait.Electricity) + " " + "mw".lang(), (container.trait.Electricity == 0 || container.isOn) ? FontColor.Good : FontColor.Bad);
147 }
FontColor
Definition: FontColor.cs:2
Trait trait
Definition: Card.cs:49
ThingContainer things
Definition: Card.cs:34
bool isOn
Definition: Card.cs:514
virtual int Electricity
Definition: Trait.cs:97
UIText mainText
Definition: UIButton.cs:102
void SetText(string s)
Definition: UIText.cs:159

References Trait.Electricity, Card.isOn, UIButton.mainText, ThingContainer.MaxCapacity, UIText.SetText(), Card.things, and Card.trait.

Referenced by Init(), and OnAfterRedraw().

◆ RefreshCats()

void UIMagicChest.RefreshCats ( )
inline

Definition at line 102 of file UIMagicChest.cs.

103 {
104 foreach (string cat in cats)
105 {
106 if (catButton.ContainsKey(cat))
107 {
108 continue;
109 }
111 catButton[cat] = uIButton;
112 string _c = cat;
113 uIButton.SetOnClick(delegate
114 {
116 {
117 SE.Tab();
118 if (idCat == _c)
119 {
120 idCat = "";
121 }
122 else
123 {
124 idCat = _c;
125 }
126 Redraw();
127 }
128 });
129 }
130 foreach (KeyValuePair<string, UIButton> item in catButton)
131 {
132 bool flag = cats.Contains(item.Key);
133 UIButton value = item.Value;
134 value.SetActive(flag);
135 if (flag)
136 {
137 value.mainText.text = EMono.sources.categories.map[item.Key].GetName() + " (" + catCount[item.Key] + ")";
138 value.image.color = ((item.Key == idCat) ? colorCatSelected : colorCat);
139 }
140 }
141 }
Definition: EMono.cs:4
static SourceManager sources
Definition: EMono.cs:41
SourceCategory categories
Dictionary< string, UIButton > catButton
Definition: UIMagicChest.cs:43
string idCat
Definition: UIMagicChest.cs:47
Dictionary< string, int > catCount
Definition: UIMagicChest.cs:45
Color colorCatSelected
Definition: UIMagicChest.cs:39
HashSet< string > cats
Definition: UIMagicChest.cs:41
Color colorCat
Definition: UIMagicChest.cs:37

References catButton, cats, UIContextMenu.Current, layoutCat, moldCat, Redraw(), and Util.

Referenced by ThingContainer.RefreshGrid().

◆ Search()

void UIMagicChest.Search ( string  s)
inline

Definition at line 175 of file UIMagicChest.cs.

176 {
177 s = s.ToLower();
178 if (s.IsEmpty())
179 {
180 s = "";
181 }
182 buttonClearSearch.SetActive(inputSearch.text != "");
183 if (s == lastSearch)
184 {
185 return;
186 }
187 if (firstSearch)
188 {
189 firstSearch = false;
190 foreach (Thing thing in container.things)
191 {
192 thing.tempName = thing.GetName(NameStyle.Full, 1).ToLower();
193 }
194 }
196 lastSearch = s;
197 Redraw();
198 }
NameStyle
Definition: NameStyle.cs:2
Definition: Thing.cs:8
override string GetName(NameStyle style, int _num=-1)
Definition: Thing.cs:494
float intervalSearch
Definition: UIMagicChest.cs:29
bool firstSearch
Definition: UIMagicChest.cs:49
UIButton buttonClearSearch
Definition: UIMagicChest.cs:17

References Thing.GetName(), and Card.things.

Member Data Documentation

◆ buttonClearSearch

UIButton UIMagicChest.buttonClearSearch

Definition at line 17 of file UIMagicChest.cs.

◆ buttonsPage

List<UIButton> UIMagicChest.buttonsPage

Definition at line 23 of file UIMagicChest.cs.

Referenced by Init(), and OnAfterRedraw().

◆ catButton

Dictionary<string, UIButton> UIMagicChest.catButton = new Dictionary<string, UIButton>()

Definition at line 43 of file UIMagicChest.cs.

Referenced by RefreshCats().

◆ catCount

Dictionary<string, int> UIMagicChest.catCount = new Dictionary<string, int>()

Definition at line 45 of file UIMagicChest.cs.

Referenced by ThingContainer.RefreshGrid().

◆ cats

HashSet<string> UIMagicChest.cats = new HashSet<string>()

Definition at line 41 of file UIMagicChest.cs.

Referenced by RefreshCats(), and ThingContainer.RefreshGrid().

◆ colorCat

Color UIMagicChest.colorCat

Definition at line 37 of file UIMagicChest.cs.

◆ colorCatSelected

Color UIMagicChest.colorCatSelected

Definition at line 39 of file UIMagicChest.cs.

◆ filteredList

List<Thing> UIMagicChest.filteredList = new List<Thing>()

Definition at line 35 of file UIMagicChest.cs.

Referenced by ThingContainer.RefreshGrid().

◆ firstSearch

bool UIMagicChest.firstSearch = true
private

Definition at line 49 of file UIMagicChest.cs.

◆ groupPage

UISelectableGroup UIMagicChest.groupPage

Definition at line 21 of file UIMagicChest.cs.

Referenced by Init(), and OnAfterRedraw().

◆ idCat

string UIMagicChest.idCat = ""

Definition at line 47 of file UIMagicChest.cs.

Referenced by ThingContainer.RefreshGrid().

◆ inputSearch

InputField UIMagicChest.inputSearch

Definition at line 27 of file UIMagicChest.cs.

Referenced by Init().

◆ intervalSearch

float UIMagicChest.intervalSearch

Definition at line 29 of file UIMagicChest.cs.

◆ itemElec

UIButton UIMagicChest.itemElec

Definition at line 15 of file UIMagicChest.cs.

Referenced by Init().

◆ itemNum

UIButton UIMagicChest.itemNum

Definition at line 13 of file UIMagicChest.cs.

Referenced by Init().

◆ lastSearch

string UIMagicChest.lastSearch = ""

Definition at line 53 of file UIMagicChest.cs.

Referenced by ThingContainer.RefreshGrid().

◆ layoutBottom

LayoutGroup UIMagicChest.layoutBottom

Definition at line 11 of file UIMagicChest.cs.

Referenced by Init().

◆ layoutCat

LayoutGroup UIMagicChest.layoutCat

Definition at line 9 of file UIMagicChest.cs.

Referenced by Init(), and RefreshCats().

◆ layoutPage

LayoutGroup UIMagicChest.layoutPage

Definition at line 7 of file UIMagicChest.cs.

Referenced by Init().

◆ moldCat

UIButton UIMagicChest.moldCat

Definition at line 19 of file UIMagicChest.cs.

Referenced by Init(), and RefreshCats().

◆ page

int UIMagicChest.page

Definition at line 31 of file UIMagicChest.cs.

Referenced by Init(), OnAfterRedraw(), and ThingContainer.RefreshGrid().

◆ pageMax

int UIMagicChest.pageMax

Definition at line 33 of file UIMagicChest.cs.

Referenced by OnAfterRedraw(), and ThingContainer.RefreshGrid().

◆ searchRecipes

HashSet<Recipe> UIMagicChest.searchRecipes = new HashSet<Recipe>()

Definition at line 55 of file UIMagicChest.cs.

◆ timerSearch

float UIMagicChest.timerSearch
private

Definition at line 51 of file UIMagicChest.cs.

◆ uiInventory

UIInventory UIMagicChest.uiInventory

Definition at line 25 of file UIMagicChest.cs.

Property Documentation

◆ container

Card UIMagicChest.container
get

Definition at line 57 of file UIMagicChest.cs.

◆ GridSize

int UIMagicChest.GridSize
get

Definition at line 59 of file UIMagicChest.cs.


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