Elin Decompiled Documentation EA 23.346 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
 
int pageJump = 7
 
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 208 of file UIMagicChest.cs.

209 {
210 inputSearch.text = "";
211 timerSearch = 0f;
212 lastSearch = "";
213 Redraw();
214 }
string lastSearch
Definition: UIMagicChest.cs:55
float timerSearch
Definition: UIMagicChest.cs:53

◆ Init()

void UIMagicChest.Init ( )
inline

Definition at line 63 of file UIMagicChest.cs.

64 {
65 UIButton t = layoutPage.CreateMold<UIButton>();
66 moldCat = layoutCat.CreateMold<UIButton>();
67 for (int i = 0; i < 9; i++)
68 {
70 buttonsPage.Add(b);
71 b.SetOnClick(delegate
72 {
74 {
75 page = b.refInt;
76 SE.Tab();
77 Redraw();
78 }
79 });
80 }
81 groupPage.selectOnClick = false;
83 inputSearch.onValueChanged.AddListener(Search);
84 inputSearch.onSubmit.AddListener(Search);
86 itemNum.RebuildLayout();
87 itemElec.RebuildLayout();
88 layoutBottom.RebuildLayout();
89 }
int refInt
Definition: UIButton.cs:154
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
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(), UIButton.refInt, RefreshBottom(), Search, and Util.

◆ LateUpdate()

void UIMagicChest.LateUpdate ( )
inlineprivate

Definition at line 157 of file UIMagicChest.cs.

158 {
159 if (timerSearch > 0f)
160 {
162 if (timerSearch <= 0f)
163 {
164 Search(inputSearch.text);
165 }
166 }
167 if (EInput.wheel != 0 && !UIContextMenu.Current)
168 {
169 SE.Tab();
170 page -= EInput.wheel;
171 if (page < 0)
172 {
173 page = pageMax;
174 }
175 if (page > pageMax)
176 {
177 page = 0;
178 }
179 Redraw();
180 }
181 }
Definition: Core.cs:14
static float delta
Definition: Core.cs:17
Definition: EInput.cs:8
static int wheel
Definition: EInput.cs:300

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

◆ OnAfterRedraw()

void UIMagicChest.OnAfterRedraw ( )
inline

Definition at line 91 of file UIMagicChest.cs.

92 {
94 int count = buttonsPage.Count;
95 bool flag = pageMax >= count;
96 int num = ((!flag) ? 1 : Mathf.Clamp(page - count / 2 + 1, 1, pageMax - count + 2));
97 for (int i = 0; i < count; i++)
98 {
99 UIButton uIButton = buttonsPage[i];
100 int num2 = ((i != 0) ? ((flag && i == count - 1) ? pageMax : (num + i - 1)) : 0);
101 bool flag2 = (i == 1 && num2 > 1) || (i == count - 2 && num2 < pageMax - 1);
102 uIButton.refInt = (flag2 ? Mathf.Clamp(page + ((i == 1) ? (-pageJump) : pageJump), 0, pageMax) : num2);
103 uIButton.mainText.text = (flag2 ? "…" : ((num2 + 1).ToString() ?? ""));
104 uIButton.interactable = num2 <= pageMax;
105 }
106 groupPage.selected = null;
107 groupPage.Select((UIButton a) => a.refInt == page);
108 }
void Select(UIButton button, bool check=true)

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

◆ Redraw()

void UIMagicChest.Redraw ( )
inline

Definition at line 216 of file UIMagicChest.cs.

217 {
219 }
UIList list
Definition: UIInventory.cs:79
override void Redraw()
Definition: UIList.cs:793
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 151 of file UIMagicChest.cs.

152 {
153 itemNum.mainText.text = container.things.Count + " / " + container.things.MaxCapacity;
154 itemElec.mainText.SetText(Mathf.Abs(container.trait.Electricity) + " " + "mw".lang(), (container.trait.Electricity == 0 || container.isOn) ? FontColor.Good : FontColor.Bad);
155 }
FontColor
Definition: FontColor.cs:2
Trait trait
Definition: Card.cs:54
ThingContainer things
Definition: Card.cs:39
bool isOn
Definition: Card.cs:545
virtual int Electricity
Definition: Trait.cs:119
UIText mainText
Definition: UIButton.cs:102
void SetText(string s)
Definition: UIText.cs:163

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 110 of file UIMagicChest.cs.

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

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

Referenced by ThingContainer.RefreshGrid().

◆ Search()

void UIMagicChest.Search ( string  s)
inline

Definition at line 183 of file UIMagicChest.cs.

184 {
185 s = s.ToLower();
186 if (s.IsEmpty())
187 {
188 s = "";
189 }
190 buttonClearSearch.SetActive(inputSearch.text != "");
191 if (s == lastSearch)
192 {
193 return;
194 }
195 if (firstSearch)
196 {
197 firstSearch = false;
198 foreach (Thing thing in container.things)
199 {
200 thing.tempName = thing.GetName(NameStyle.Full, 1).ToLower();
201 }
202 }
204 lastSearch = s;
205 Redraw();
206 }
NameStyle
Definition: NameStyle.cs:2
Definition: Thing.cs:8
override string GetName(NameStyle style, int _num=-1)
Definition: Thing.cs:532
float intervalSearch
Definition: UIMagicChest.cs:29
bool firstSearch
Definition: UIMagicChest.cs:51
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 45 of file UIMagicChest.cs.

Referenced by RefreshCats().

◆ catCount

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

Definition at line 47 of file UIMagicChest.cs.

Referenced by ThingContainer.RefreshGrid().

◆ cats

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

Definition at line 43 of file UIMagicChest.cs.

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

◆ colorCat

Color UIMagicChest.colorCat

Definition at line 39 of file UIMagicChest.cs.

◆ colorCatSelected

Color UIMagicChest.colorCatSelected

Definition at line 41 of file UIMagicChest.cs.

◆ filteredList

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

Definition at line 37 of file UIMagicChest.cs.

Referenced by ThingContainer.RefreshGrid().

◆ firstSearch

bool UIMagicChest.firstSearch = true
private

Definition at line 51 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 49 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 55 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().

◆ pageJump

int UIMagicChest.pageJump = 7

Definition at line 35 of file UIMagicChest.cs.

Referenced by OnAfterRedraw().

◆ 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 57 of file UIMagicChest.cs.

◆ timerSearch

float UIMagicChest.timerSearch
private

Definition at line 53 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 59 of file UIMagicChest.cs.

◆ GridSize

int UIMagicChest.GridSize
get

Definition at line 61 of file UIMagicChest.cs.


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