Elin Modding Docs Doc
Loading...
Searching...
No Matches
UIInventory.cs
1using System;
2using System.Collections.Generic;
3using UnityEngine;
4using UnityEngine.Events;
5using UnityEngine.UI;
6
7// Token: 0x0200057E RID: 1406
8public class UIInventory : EMono
9{
10 // Token: 0x17000B8C RID: 2956
11 // (get) Token: 0x0600269D RID: 9885 RVA: 0x000DA32C File Offset: 0x000D852C
12 public InvOwner owner
13 {
14 get
15 {
16 return (this.currentTab ?? this.tabs[0]).owner;
17 }
18 }
19
20 // Token: 0x17000B8D RID: 2957
21 // (get) Token: 0x0600269E RID: 9886 RVA: 0x000DA349 File Offset: 0x000D8549
22 public Card dest
23 {
24 get
25 {
26 return this.currentTab.dest;
27 }
28 }
29
30 // Token: 0x17000B8E RID: 2958
31 // (get) Token: 0x0600269F RID: 9887 RVA: 0x000DA356 File Offset: 0x000D8556
32 public bool UseBG
33 {
34 get
35 {
36 return this.window.saveData.useBG || !this.UseGrid;
37 }
38 }
39
40 // Token: 0x17000B8F RID: 2959
41 // (get) Token: 0x060026A0 RID: 9888 RVA: 0x000DA375 File Offset: 0x000D8575
42 public bool UseGrid
43 {
44 get
45 {
46 return EMono.core.config.game.useGrid;
47 }
48 }
49
50 // Token: 0x17000B90 RID: 2960
51 // (get) Token: 0x060026A1 RID: 9889 RVA: 0x000DA38B File Offset: 0x000D858B
52 public bool IsMagicChest
53 {
54 get
55 {
56 return this.owner.Container.trait is TraitMagicChest;
57 }
58 }
59
60 // Token: 0x17000B91 RID: 2961
61 // (get) Token: 0x060026A2 RID: 9890 RVA: 0x000DA3A5 File Offset: 0x000D85A5
62 public bool IsToolbelt
63 {
64 get
65 {
66 return this.owner.Container.trait is TraitToolBelt;
67 }
68 }
69
70 // Token: 0x17000B92 RID: 2962
71 // (get) Token: 0x060026A3 RID: 9891 RVA: 0x000DA3BF File Offset: 0x000D85BF
72 public bool IsShop
73 {
74 get
75 {
76 return this.owner.Container.trait is TraitChestMerchant;
77 }
78 }
79
80 // Token: 0x17000B93 RID: 2963
81 // (get) Token: 0x060026A4 RID: 9892 RVA: 0x000DA3DC File Offset: 0x000D85DC
82 public CoreRef.InventoryStyle InvStyle
83 {
84 get
85 {
86 return EMono.core.refs.invStyle[(this.UseBG || this.IsToolbelt) ? this.owner.Container.trait.IDInvStyle : "transparent"];
87 }
88 }
89
90 // Token: 0x17000B94 RID: 2964
91 // (get) Token: 0x060026A5 RID: 9893 RVA: 0x000DA42C File Offset: 0x000D862C
92 public bool IsMainMode
93 {
94 get
95 {
96 switch (this.currentTab.mode)
97 {
98 case UIInventory.Mode.Gear:
99 case UIInventory.Mode.Food:
100 case UIInventory.Mode.Item:
101 case UIInventory.Mode.Resource:
102 case UIInventory.Mode.Read:
103 case UIInventory.Mode.Hold:
104 case UIInventory.Mode.Tool:
105 case UIInventory.Mode.All:
106 case UIInventory.Mode.Drink:
107 case UIInventory.Mode.HoldFurniture:
108 case UIInventory.Mode.HoldBlock:
109 return true;
110 }
111 return false;
112 }
113 }
114
115 // Token: 0x17000B95 RID: 2965
116 // (get) Token: 0x060026A6 RID: 9894 RVA: 0x000DA4A2 File Offset: 0x000D86A2
117 public CurrencyType CurrencyType
118 {
119 get
120 {
121 return this.currentTab.owner.currency;
122 }
123 }
124
125 // Token: 0x17000B96 RID: 2966
126 // (get) Token: 0x060026A7 RID: 9895 RVA: 0x000DA4B4 File Offset: 0x000D86B4
127 public string IDCurrency
128 {
129 get
130 {
131 CurrencyType currencyType = this.CurrencyType;
132 if (currencyType == CurrencyType.Medal)
133 {
134 return "medal";
135 }
136 if (currencyType != CurrencyType.Ecopo)
137 {
138 return "money";
139 }
140 return "ecopo";
141 }
142 }
143
144 // Token: 0x060026A8 RID: 9896 RVA: 0x000DA4E4 File Offset: 0x000D86E4
145 public static void RefreshAllList()
146 {
147 UIInventory[] componentsInChildren = EMono.ui.rectLayers.GetComponentsInChildren<UIInventory>();
148 for (int i = 0; i < componentsInChildren.Length; i++)
149 {
150 componentsInChildren[i].list.Redraw();
151 }
152 }
153
154 // Token: 0x060026A9 RID: 9897 RVA: 0x000DA51C File Offset: 0x000D871C
155 public void SetHeader(string s)
156 {
157 this.window.SetCaption(s.lang());
158 }
159
160 // Token: 0x060026AA RID: 9898 RVA: 0x000DA52F File Offset: 0x000D872F
161 public UIInventory.Tab AddTab(Card c, UIInventory.Mode mode, Thing container = null)
162 {
163 return this.AddTab(new InvOwner(c, container, CurrencyType.None, PriceType.Default), mode);
164 }
165
166 // Token: 0x060026AB RID: 9899 RVA: 0x000DA544 File Offset: 0x000D8744
167 public UIInventory.Tab AddTab(InvOwner owner, UIInventory.Mode mode = UIInventory.Mode.All)
168 {
169 owner.Init();
171 {
172 mode = mode,
173 owner = owner
174 };
175 this.tabs.Add(tab);
176 return tab;
177 }
178
179 // Token: 0x060026AC RID: 9900 RVA: 0x000DA578 File Offset: 0x000D8778
180 public void OnInit()
181 {
182 this.interactMode = EMono.player.pref.interactMode;
183 using (List<UIInventory.Tab>.Enumerator enumerator = this.tabs.GetEnumerator())
184 {
185 while (enumerator.MoveNext())
186 {
187 UIInventory.Tab t = enumerator.Current;
188 string text = t.textTab.IsEmpty("inv" + t.mode.ToString());
189 if (!this.floatMode)
190 {
191 string str = text.lang();
192 string str2 = " - ";
193 string str3;
194 if (!t.owner.owner.IsPC)
195 {
196 Chara chara = t.owner.Chara;
197 str3 = (((chara != null) ? chara.Name : null) ?? t.owner.Container.Name);
198 }
199 else
200 {
201 str3 = "you".lang().ToTitleCase(false);
202 }
203 text = str + str2 + str3;
204 }
205 Window.Setting.Tab tab = this.window.AddTab(text, this.content, delegate
206 {
207 this.SwitchTab(t);
208 }, EMono.core.refs.icons.invTab.TryGetValue(t.mode, null), text);
209 if (t.smallTab)
210 {
211 tab.customTab = this.moldSmallTab;
212 }
213 }
214 }
215 if (this.layer.mini)
216 {
217 this.layer.mini.SetActive(this.owner.Container.isChara);
218 if (this.owner.Container.isChara)
219 {
220 this.layer.mini.SetChara(this.owner.Container.Chara);
221 }
222 }
223 if (this.uiMagic)
224 {
225 this.uiMagic.SetActive(this.IsMagicChest);
226 if (this.IsMagicChest)
227 {
228 this.uiMagic.Init();
229 }
230 }
231 if (this.IsMagicChest)
232 {
233 TooltipManager.Instance.disableTimer = 0.1f;
234 }
235 }
236
237 // Token: 0x060026AD RID: 9901 RVA: 0x000DA7B0 File Offset: 0x000D89B0
238 public void RefreshWindow()
239 {
240 if (this.window.saveData == null)
241 {
242 Window window = this.window;
243 Window.SaveData saveData;
244 if ((saveData = Window.dictData.TryGetValue(this.window.idWindow, null)) == null)
245 {
246 (saveData = new Window.SaveData()).useBG = EMono.core.config.game.showInvBG;
247 }
248 window.saveData = saveData;
249 }
250 this.window.setting.allowMove = !this.window.saveData.fixedPos;
251 this.window.bgCollider.raycastTarget = (!this.window.saveData.fixedPos || this.window.saveData.useBG);
252 this.window.imageBG.SetActive(this.UseBG);
253 CoreRef.InventoryStyle inventoryStyle = EMono.core.refs.invStyle[this.owner.Container.trait.IDInvStyle];
254 if (this.UseBG)
255 {
256 this.window.imageBG.sprite = inventoryStyle.bg;
257 this.window.imageBG.rectTransform.anchoredPosition = inventoryStyle.posFix;
258 this.window.imageBG.rectTransform.sizeDelta = inventoryStyle.sizeDelta;
259 this.window.imageBG.alphaHitTestMinimumThreshold = 1f;
260 }
261 if (this.IsToolbelt)
262 {
263 this.window.cgFloatMenu.SetActive(false);
264 this.window.cgFloatMenu = null;
265 this.window.bgCollider.rectTransform.anchoredPosition = new Vector2(-2.5f, 0f);
266 this.window.bgCollider.rectTransform.sizeDelta = new Vector2(-20f, -20f);
267 }
268 if (EMono.core.config.ui.showFloatButtons && this.window.cgFloatMenu)
269 {
270 this.window.cgFloatMenu.alpha = 1f;
271 this.window.cgFloatMenu.enabled = false;
272 this.window.cgFloatMenu.SetActive(true);
273 }
274 }
275
276 // Token: 0x060026AE RID: 9902 RVA: 0x000DA9DB File Offset: 0x000D8BDB
277 public void Close()
278 {
279 if (!this.floatMode)
280 {
281 this.layer.Close();
282 }
283 }
284
285 // Token: 0x060026AF RID: 9903 RVA: 0x000DA9F0 File Offset: 0x000D8BF0
286 public void SwitchTab(UIInventory.Tab tab)
287 {
288 if (this.currentTab == tab)
289 {
290 return;
291 }
292 this.currentTab = tab;
293 this.RefreshWindow();
294 this.destNum = (this.lastNum = (this.DestNumIsMax() ? -1 : 0));
295 if (this.isList)
296 {
297 this.RefreshList();
298 }
299 else
300 {
301 this.RefreshGrid();
302 }
303 if (this.IsShop)
304 {
305 this.Sort(false);
306 }
307 if (this.layer.uiCurrency)
308 {
309 tab.owner.BuildUICurrency(this.layer.uiCurrency, tab.owner.owner.trait.CostRerollShop != 0);
310 }
311 this.layer.TryShowHint("h_inv" + tab.mode.ToString());
312 if (this.headerRow)
313 {
314 UIHeader[] componentsInChildren = this.headerRow.GetComponentsInChildren<UIHeader>(true);
315 componentsInChildren[0].SetText("headerItem");
316 UIInventory.Mode mode = tab.mode;
317 if (mode - UIInventory.Mode.Buy <= 1 || mode == UIInventory.Mode.Identify)
318 {
319 componentsInChildren[1].SetText("headerPrice".lang(this.IDCurrency.lang(), null, null, null, null));
320 return;
321 }
322 if (mode != UIInventory.Mode.Recycle)
323 {
324 componentsInChildren[1].SetText("headerWeight");
325 return;
326 }
327 componentsInChildren[1].SetText("headerRecycle");
328 }
329 }
330
331 // Token: 0x060026B0 RID: 9904 RVA: 0x000DAB38 File Offset: 0x000D8D38
332 public void DoAct(Act act)
333 {
334 if (!EMono.pc.HasNoGoal || (act.LocalAct && EMono._zone.IsRegion))
335 {
336 SE.Beep();
337 return;
338 }
339 EMono.player.hotItemToRestore = EMono.player.currentHotItem;
340 if (act.IsAct)
341 {
342 act.Perform(EMono.pc, null, null);
343 return;
344 }
345 this.currentAct = (act as AIAct);
346 EMono.pc.SetAI(this.currentAct);
347 ActionMode.Adv.SetTurbo(-1);
348 if (!this.floatMode)
349 {
350 this.Close();
351 return;
352 }
353 }
354
355 // Token: 0x060026B1 RID: 9905 RVA: 0x000DABD0 File Offset: 0x000D8DD0
356 private void Update()
357 {
358 if (this.owner.Container.isDestroyed)
359 {
360 this.Close();
361 return;
362 }
363 this.imageHighlightGrid.SetActive(LayerInventory.highlightInv == this.owner);
364 this.CheckDirty();
365 if (EInput.action == EAction.GetAll && this.buttonTakeAll && !this.IsMagicChest)
366 {
367 this.buttonTakeAll.onClick.Invoke();
368 }
369 if (this.IsMagicChest && this.wasDirty && (Input.GetMouseButtonUp(1) || Input.GetKeyUp(KeyCode.LeftShift) || Input.GetKeyUp(KeyCode.RightShift)))
370 {
371 this.list.Redraw();
372 this.wasDirty = false;
373 }
374 if (Input.GetMouseButtonDown(1))
375 {
376 this.firstMouseRightDown = true;
377 }
378 }
379
380 // Token: 0x060026B2 RID: 9906 RVA: 0x000DAC93 File Offset: 0x000D8E93
381 public void CheckDirty()
382 {
383 if (this.dirty)
384 {
385 this.wasDirty = true;
386 if (this.UseGrid)
387 {
388 this.list.Redraw();
389 }
390 else
391 {
392 this.list.List(false);
393 }
394 UIButton.TryShowTip(null, true, true);
395 }
396 }
397
398 // Token: 0x060026B3 RID: 9907 RVA: 0x000DACD0 File Offset: 0x000D8ED0
399 public void RefreshDestNum()
400 {
401 if (this.destNum > 0)
402 {
403 return;
404 }
405 this.destNum = (this.DestNumIsMax() ? (EInput.isShiftDown ? 0 : -1) : (EInput.isShiftDown ? -1 : 0));
406 if (this.destNum != this.lastNum)
407 {
408 this.lastNum = this.destNum;
409 this.list.Redraw();
410 }
411 }
412
413 // Token: 0x060026B4 RID: 9908 RVA: 0x000DAD34 File Offset: 0x000D8F34
414 public bool DestNumIsMax()
415 {
416 UIInventory.Mode mode = this.currentTab.mode;
417 return mode - UIInventory.Mode.Buy > 1;
418 }
419
420 // Token: 0x060026B5 RID: 9909 RVA: 0x000DAD58 File Offset: 0x000D8F58
421 public void RefreshMenu()
422 {
423 UIInventory.<>c__DisplayClass69_0 CS$<>8__locals1 = new UIInventory.<>c__DisplayClass69_0();
424 CS$<>8__locals1.<>4__this = this;
425 CS$<>8__locals1.b = this.window.buttonSort;
426 CS$<>8__locals1.data = this.window.saveData;
427 if (CS$<>8__locals1.b)
428 {
429 CS$<>8__locals1.b.onClick.RemoveAllListeners();
430 CS$<>8__locals1.b.onClick.AddListener(delegate()
431 {
432 UIInventory.<>c__DisplayClass69_1 CS$<>8__locals4 = new UIInventory.<>c__DisplayClass69_1();
433 CS$<>8__locals4.CS$<>8__locals1 = CS$<>8__locals1;
434 UIContextMenu uicontextMenu = EMono.ui.CreateContextMenuInteraction();
435 uicontextMenu.layoutGroup.childAlignment = TextAnchor.UpperLeft;
436 uicontextMenu.alwaysPopLeft = true;
437 UIContextMenu uicontextMenu2 = uicontextMenu.AddChild("sort", TextAnchor.UpperRight);
438 UIList.SortMode[] sorts = CS$<>8__locals1.<>4__this.list.sorts;
439 for (int i = 0; i < sorts.Length; i++)
440 {
441 UIList.SortMode sort = sorts[i];
442 UIList.SortMode _sort = sort;
443 uicontextMenu2.AddButton((((CS$<>8__locals1.<>4__this.IsShop ? EMono.player.pref.sortInvShop : EMono.player.pref.sortInv) == _sort) ? "context_checker".lang() : "") + _sort.ToString().lang(), delegate()
444 {
445 if (CS$<>8__locals4.CS$<>8__locals1.<>4__this.IsShop)
446 {
447 EMono.player.pref.sortInvShop = _sort;
448 }
449 else
450 {
451 EMono.player.pref.sortInv = _sort;
452 }
453 CS$<>8__locals4.CS$<>8__locals1.<>4__this.Sort(false);
454 SE.Click();
455 }, true);
456 }
457 UIContextMenu uicontextMenu3 = uicontextMenu2;
458 string idLang = "sort_ascending";
459 bool isOn = CS$<>8__locals1.<>4__this.IsShop ? EMono.player.pref.sort_ascending_shop : EMono.player.pref.sort_ascending;
460 UnityAction<bool> action;
461 if ((action = CS$<>8__locals1.<>9__3) == null)
462 {
463 action = (CS$<>8__locals1.<>9__3 = delegate(bool a)
464 {
465 if (CS$<>8__locals1.<>4__this.IsShop)
466 {
467 EMono.player.pref.sort_ascending_shop = a;
468 }
469 else
470 {
471 EMono.player.pref.sort_ascending = a;
472 }
473 CS$<>8__locals1.<>4__this.Sort(false);
474 SE.Click();
475 });
476 }
477 uicontextMenu3.AddToggle(idLang, isOn, action);
478 if (CS$<>8__locals1.<>4__this.IsMagicChest)
479 {
480 UIContextMenu uicontextMenu4 = uicontextMenu.AddChild("catFilterType", TextAnchor.UpperRight);
481 foreach (Window.SaveData.CategoryType categoryType in Util.EnumToList<Window.SaveData.CategoryType>())
482 {
483 Window.SaveData.CategoryType _c = categoryType;
484 uicontextMenu4.AddButton(((CS$<>8__locals1.data.category == categoryType) ? "context_checker".lang() : "") + ("catFilterType_" + _c.ToString()).lang(), delegate()
485 {
486 CS$<>8__locals4.CS$<>8__locals1.data.category = _c;
487 CS$<>8__locals4.CS$<>8__locals1.<>4__this.uiMagic.idCat = "";
488 CS$<>8__locals4.CS$<>8__locals1.<>4__this.list.Redraw();
489 SE.Click();
490 }, true);
491 }
492 }
493 CS$<>8__locals4.con = CS$<>8__locals1.<>4__this.owner.Container;
494 bool flag2 = (!CS$<>8__locals4.con.isNPCProperty && !CS$<>8__locals4.con.isChara && (CS$<>8__locals4.con.trait is TraitShippingChest || (CS$<>8__locals4.con.GetRoot() is Zone && EMono._zone.IsPCFaction) || CS$<>8__locals4.con.GetRootCard() == EMono.pc)) || EMono._zone is Zone_Tent;
495 if (CS$<>8__locals4.con.IsPC)
496 {
497 flag2 = true;
498 }
499 if (CS$<>8__locals4.con.trait is TraitChestMerchant)
500 {
501 flag2 = false;
502 }
503 string text;
504 if (flag2)
505 {
506 UIInventory.<>c__DisplayClass69_4 CS$<>8__locals7 = new UIInventory.<>c__DisplayClass69_4();
507 CS$<>8__locals7.CS$<>8__locals4 = CS$<>8__locals4;
508 CS$<>8__locals7.dis = uicontextMenu.AddChild("distribution", TextAnchor.UpperRight);
509 UIContextMenu dis = CS$<>8__locals7.dis;
510 text = "priority_hint";
511 Func<float, string> textFunc = (float a) => a.ToString() ?? "";
512 float value = (float)CS$<>8__locals1.data.priority;
513 Action<float> action2;
514 if ((action2 = CS$<>8__locals1.<>9__14) == null)
515 {
516 action2 = (CS$<>8__locals1.<>9__14 = delegate(float a)
517 {
518 CS$<>8__locals1.data.priority = (int)a;
519 });
520 }
521 dis.AddSlider(text, textFunc, value, action2, 0f, 20f, true, false, false);
522 CS$<>8__locals7.dist = CS$<>8__locals1.<>4__this.ShowDistribution(CS$<>8__locals7.dis, CS$<>8__locals1.data);
523 CS$<>8__locals7.distAdv = CS$<>8__locals1.<>4__this.ShowAdvDistribution(CS$<>8__locals7.dis, CS$<>8__locals1.data);
524 CS$<>8__locals7.<RefreshMenu>g__RefreshDist|15();
525 if (CS$<>8__locals7.CS$<>8__locals4.con.trait.IsFridge)
526 {
527 UIContextMenu dis2 = CS$<>8__locals7.dis;
528 string idLang2 = "onlyRottable";
529 bool onlyRottable = CS$<>8__locals1.data.onlyRottable;
530 UnityAction<bool> action3;
531 if ((action3 = CS$<>8__locals1.<>9__16) == null)
532 {
533 action3 = (CS$<>8__locals1.<>9__16 = delegate(bool a)
534 {
535 CS$<>8__locals1.data.onlyRottable = a;
536 SE.ClickOk();
537 });
538 }
539 dis2.AddToggle(idLang2, onlyRottable, action3);
540 }
541 UIContextMenu dis3 = CS$<>8__locals7.dis;
542 string idLang3 = "noRotten";
543 bool noRotten = CS$<>8__locals1.data.noRotten;
544 UnityAction<bool> action4;
545 if ((action4 = CS$<>8__locals1.<>9__17) == null)
546 {
547 action4 = (CS$<>8__locals1.<>9__17 = delegate(bool a)
548 {
549 CS$<>8__locals1.data.noRotten = a;
550 SE.ClickOk();
551 });
552 }
553 dis3.AddToggle(idLang3, noRotten, action4);
554 CS$<>8__locals7.dis.AddToggle("advDistribution", CS$<>8__locals1.data.advDistribution, delegate(bool a)
555 {
556 CS$<>8__locals7.CS$<>8__locals4.CS$<>8__locals1.data.advDistribution = a;
557 base.<RefreshMenu>g__RefreshDist|15();
558 SE.ClickOk();
559 });
560 }
561 if (CS$<>8__locals4.con.trait is TraitShippingChest || (CS$<>8__locals4.con.IsInstalled && (EMono._zone.IsPCFaction || EMono._zone is Zone_Tent)))
562 {
563 UIContextMenu uicontextMenu5 = uicontextMenu.AddChild("autodump", TextAnchor.UpperRight);
564 foreach (AutodumpFlag autodumpFlag in new List<AutodumpFlag>
565 {
566 AutodumpFlag.existing,
567 AutodumpFlag.sameCategory,
568 AutodumpFlag.distribution,
569 AutodumpFlag.none
570 })
571 {
572 string str = (CS$<>8__locals1.data.autodump == autodumpFlag) ? "context_checker".lang() : "";
573 AutodumpFlag _e = autodumpFlag;
574 UIButton uibutton = uicontextMenu5.AddButton(str + ("dump_" + autodumpFlag.ToString()).lang(), delegate()
575 {
576 SE.Click();
577 CS$<>8__locals4.CS$<>8__locals1.data.autodump = _e;
578 }, true);
579 if (autodumpFlag != AutodumpFlag.none)
580 {
581 uibutton.SetTooltipLang("dump_" + autodumpFlag.ToString() + "_tip");
582 }
583 }
584 }
585 if (CS$<>8__locals4.con.IsPC || (CS$<>8__locals4.con.isThing && !(CS$<>8__locals4.con.trait is TraitChestMerchant) && !CS$<>8__locals4.con.isNPCProperty))
586 {
587 UIContextMenu uicontextMenu6 = uicontextMenu.AddChild("config", TextAnchor.UpperRight);
588 UIContextMenu uicontextMenu7 = uicontextMenu6;
589 string idLang4 = "toggleExcludeCraft";
590 bool excludeCraft = CS$<>8__locals1.data.excludeCraft;
591 UnityAction<bool> action5;
592 if ((action5 = CS$<>8__locals1.<>9__20) == null)
593 {
594 action5 = (CS$<>8__locals1.<>9__20 = delegate(bool a)
595 {
596 CS$<>8__locals1.data.excludeCraft = a;
597 SE.ClickOk();
598 });
599 }
600 uicontextMenu7.AddToggle(idLang4, excludeCraft, action5);
601 if (CS$<>8__locals4.con.GetRootCard() == EMono.pc)
602 {
603 UIContextMenu uicontextMenu8 = uicontextMenu6;
604 string idLang5 = "toggleDump";
605 bool excludeDump = CS$<>8__locals1.data.excludeDump;
606 UnityAction<bool> action6;
607 if ((action6 = CS$<>8__locals1.<>9__21) == null)
608 {
609 action6 = (CS$<>8__locals1.<>9__21 = delegate(bool a)
610 {
611 CS$<>8__locals1.data.excludeDump = a;
612 SE.ClickOk();
613 });
614 }
615 uicontextMenu8.AddToggle(idLang5, excludeDump, action6);
616 }
617 if (EMono.core.config.game.advancedMenu)
618 {
619 if (!CS$<>8__locals4.con.IsPC)
620 {
621 UIContextMenu uicontextMenu9 = uicontextMenu6;
622 string idLang6 = "noRightClickClose";
623 bool noRightClickClose = CS$<>8__locals1.data.noRightClickClose;
624 UnityAction<bool> action7;
625 if ((action7 = CS$<>8__locals1.<>9__22) == null)
626 {
627 action7 = (CS$<>8__locals1.<>9__22 = delegate(bool a)
628 {
629 CS$<>8__locals1.data.noRightClickClose = a;
630 SE.ClickOk();
631 });
632 }
633 uicontextMenu9.AddToggle(idLang6, noRightClickClose, action7);
634 }
635 UIContextMenu uicontextMenu10 = uicontextMenu6;
636 string idLang7 = "fixedPos";
637 bool fixedPos = CS$<>8__locals1.data.fixedPos;
638 UnityAction<bool> action8;
639 if ((action8 = CS$<>8__locals1.<>9__23) == null)
640 {
641 action8 = (CS$<>8__locals1.<>9__23 = delegate(bool a)
642 {
643 CS$<>8__locals1.data.fixedPos = a;
644 CS$<>8__locals1.<>4__this.RefreshWindow();
645 SE.ClickOk();
646 });
647 }
648 uicontextMenu10.AddToggle(idLang7, fixedPos, action8);
649 UIContextMenu uicontextMenu11 = uicontextMenu6;
650 string idLang8 = "toggleItemCompress";
651 bool compress = CS$<>8__locals1.data.compress;
652 UnityAction<bool> action9;
653 if ((action9 = CS$<>8__locals1.<>9__24) == null)
654 {
655 action9 = (CS$<>8__locals1.<>9__24 = delegate(bool a)
656 {
657 CS$<>8__locals1.data.compress = a;
658 SE.ClickOk();
659 });
660 }
661 uicontextMenu11.AddToggle(idLang8, compress, action9);
662 }
663 if (!CS$<>8__locals4.con.isChara && !CS$<>8__locals4.con.trait.IsSpecialContainer)
664 {
665 uicontextMenu6.AddButton("changeName", delegate()
666 {
667 string langDetail = "dialogChangeName";
668 string text5 = CS$<>8__locals4.con.c_altName.IsEmpty("");
669 Action<bool, string> onClose;
670 if ((onClose = CS$<>8__locals4.<>9__26) == null)
671 {
672 onClose = (CS$<>8__locals4.<>9__26 = delegate(bool cancel, string text)
673 {
674 if (!cancel)
675 {
676 CS$<>8__locals4.con.c_altName = text;
677 }
678 });
679 }
680 Dialog.InputName(langDetail, text5, onClose, Dialog.InputType.Default);
681 }, true);
682 }
683 }
684 UIContextMenu uicontextMenu12 = uicontextMenu.AddChild("appearanceWindow", TextAnchor.UpperRight);
685 UIContextMenu uicontextMenu13 = uicontextMenu12;
686 string idLang9 = "toggleBG";
687 bool useBG = CS$<>8__locals1.data.useBG;
688 UnityAction<bool> action10;
689 if ((action10 = CS$<>8__locals1.<>9__4) == null)
690 {
691 action10 = (CS$<>8__locals1.<>9__4 = delegate(bool a)
692 {
693 CS$<>8__locals1.data.useBG = a;
694 CS$<>8__locals1.data.color = CS$<>8__locals1.<>4__this.InvStyle.gridColor;
695 CS$<>8__locals1.<>4__this.RefreshWindow();
696 CS$<>8__locals1.<>4__this.RefreshGrid();
697 SE.ClickOk();
698 });
699 }
700 uicontextMenu13.AddToggle(idLang9, useBG, action10);
701 UIContextMenu uicontextMenu14 = uicontextMenu12;
702 string text2 = "size";
703 Func<float, string> textFunc2 = (float a) => a.ToString() ?? "";
704 float value2 = (float)CS$<>8__locals1.data.size;
705 Action<float> action11;
706 if ((action11 = CS$<>8__locals1.<>9__6) == null)
707 {
708 action11 = (CS$<>8__locals1.<>9__6 = delegate(float b)
709 {
710 CS$<>8__locals1.data.size = (int)b;
711 CS$<>8__locals1.<>4__this.RefreshGrid();
712 });
713 }
714 uicontextMenu14.AddSlider(text2, textFunc2, value2, action11, -25f, 25f, true, false, false);
715 if (EMono.core.config.game.advancedMenu && !CS$<>8__locals1.<>4__this.IsMagicChest)
716 {
717 UIContextMenu uicontextMenu15 = uicontextMenu12;
718 string text3 = "columns";
719 Func<float, string> textFunc3 = (float a) => a.ToString() ?? "";
720 float value3 = (float)CS$<>8__locals1.data.columns;
721 Action<float> action12;
722 if ((action12 = CS$<>8__locals1.<>9__8) == null)
723 {
724 action12 = (CS$<>8__locals1.<>9__8 = delegate(float b)
725 {
726 CS$<>8__locals1.data.columns = (int)b;
727 CS$<>8__locals1.<>4__this.RefreshGrid();
728 });
729 }
730 uicontextMenu15.AddSlider(text3, textFunc3, value3, action12, 0f, 20f, true, false, false);
731 }
732 UIContextMenu uicontextMenu16 = uicontextMenu12;
733 string idLang10 = "colorGrid";
734 Action action13;
735 if ((action13 = CS$<>8__locals1.<>9__9) == null)
736 {
737 action13 = (CS$<>8__locals1.<>9__9 = delegate()
738 {
739 LayerColorPicker layerColorPicker = EMono.ui.AddLayer<LayerColorPicker>();
740 Color startColor = CS$<>8__locals1.data.color;
741 Color gridColor = CS$<>8__locals1.<>4__this.InvStyle.gridColor;
742 Action<PickerState, Color> onChangeColor;
743 if ((onChangeColor = CS$<>8__locals1.<>9__27) == null)
744 {
745 onChangeColor = (CS$<>8__locals1.<>9__27 = delegate(PickerState state, Color _c)
746 {
747 CS$<>8__locals1.data.color = _c;
748 CS$<>8__locals1.<>4__this.list.bgGrid.color = _c;
749 if (CS$<>8__locals1.data.color.a == 0)
750 {
751 CS$<>8__locals1.<>4__this.list.bgGrid.color = CS$<>8__locals1.<>4__this.InvStyle.gridColor;
752 }
753 });
754 }
755 layerColorPicker.SetColor(startColor, gridColor, onChangeColor);
756 });
757 }
758 uicontextMenu16.AddButton(idLang10, action13, true);
759 if (!CS$<>8__locals4.con.isChara)
760 {
761 UIContextMenu uicontextMenu17 = uicontextMenu12;
762 string idLang11 = "changeIcon";
763 Action action14;
764 if ((action14 = CS$<>8__locals1.<>9__10) == null)
765 {
766 action14 = (CS$<>8__locals1.<>9__10 = delegate()
767 {
768 EMono.ui.contextMenu.currentMenu.Hide();
769 UIContextMenu uicontextMenu19 = EMono.ui.CreateContextMenuInteraction();
770 GridLayoutGroup parent = uicontextMenu19.AddGridLayout();
771 int num = 0;
772 foreach (Sprite sprite in EMono.core.refs.spritesContainerIcon)
773 {
774 UIButton uibutton2 = Util.Instantiate<UIButton>("UI/Element/Button/ButtonContainerIcon", parent);
775 int _i = num;
776 uibutton2.icon.sprite = EMono.core.refs.spritesContainerIcon[_i];
777 uibutton2.SetOnClick(delegate
778 {
779 SE.Click();
780 CS$<>8__locals1.<>4__this.owner.Container.c_indexContainerIcon = _i;
781 LayerInventory.SetDirty(CS$<>8__locals1.<>4__this.owner.Container.Thing);
782 EMono.ui.contextMenu.currentMenu.Hide();
783 });
784 num++;
785 }
786 uicontextMenu19.Show();
787 });
788 }
789 uicontextMenu17.AddButton(idLang11, action14, true);
790 }
791 if (EMono.debug.enable)
792 {
793 UIContextMenu uicontextMenu18 = uicontextMenu.AddChild("debug", TextAnchor.UpperRight);
794 uicontextMenu18.AddToggle("toggleGrid", EMono.core.config.game.useGrid, delegate(bool a)
795 {
796 EMono.core.config.game.useGrid = a;
797 foreach (LayerInventory layerInventory in LayerInventory.listInv)
798 {
799 layerInventory.invs[0].RefreshWindow();
800 layerInventory.invs[0].RefreshGrid();
801 }
802 });
803 string text4 = "iconSize";
804 Func<float, string> textFunc4 = (float a) => a.ToString() ?? "";
805 float value4 = (float)EMono.game.config.gridIconSize;
806 Action<float> action15;
807 if ((action15 = CS$<>8__locals1.<>9__31) == null)
808 {
809 action15 = (CS$<>8__locals1.<>9__31 = delegate(float b)
810 {
811 EMono.game.config.gridIconSize = (int)b;
812 CS$<>8__locals1.<>4__this.RefreshGrid();
813 });
814 }
815 uicontextMenu18.AddSlider(text4, textFunc4, value4, action15, 100f, 150f, true, false, false);
816 }
817 uicontextMenu.Show();
818 });
819 }
820 CS$<>8__locals1.b = this.window.buttonQuickSort;
821 if (CS$<>8__locals1.b)
822 {
823 CS$<>8__locals1.b.onClick.RemoveAllListeners();
824 CS$<>8__locals1.b.onClick.AddListener(delegate()
825 {
826 CS$<>8__locals1.<>4__this.Sort(false);
827 SE.Click();
828 });
829 }
830 CS$<>8__locals1.b = this.window.buttonExtra;
831 if (CS$<>8__locals1.b)
832 {
833 CS$<>8__locals1.b.SetActive(this.owner.Container.IsPC);
834 CS$<>8__locals1.b.onClick.RemoveAllListeners();
835 CS$<>8__locals1.b.onClick.AddListener(delegate()
836 {
837 if (!EMono.ui.AllowInventoryInteractions)
838 {
839 return;
840 }
841 if (!EMono._zone.IsPCFaction && !(EMono._zone is Zone_Tent))
842 {
843 Msg.Say("dump_invalid");
844 return;
845 }
846 if (!EMono.pc.HasNoGoal)
847 {
848 SE.Beep();
849 return;
850 }
851 EMono.pc.SetAIImmediate(new TaskDump());
852 });
853 }
854 CS$<>8__locals1.b = this.window.buttonShared;
855 if (CS$<>8__locals1.b)
856 {
857 Card con = this.owner.Container;
858 bool flag = !con.isChara && ((con.IsInstalled && EMono._zone.IsPCFaction) || this.owner.owner.IsPC);
859 CS$<>8__locals1.b.SetActive(flag);
860 if (flag)
861 {
862 CS$<>8__locals1.<RefreshMenu>g__RefreshShareButton|32();
863 CS$<>8__locals1.b.SetOnClick(delegate
864 {
865 bool flag2 = CS$<>8__locals1.data.sharedType == ContainerSharedType.Shared;
866 SE.ClickOk();
867 Msg.Say("changePermission", con, (flag2 ? "stPersonal" : "stShared").lang(), null, null);
868 CS$<>8__locals1.data.sharedType = (flag2 ? ContainerSharedType.Personal : ContainerSharedType.Shared);
869 CS$<>8__locals1.<RefreshMenu>g__RefreshShareButton|32();
870 });
871 }
872 }
873 UIInventory.Mode mode = this.currentTab.mode;
874 WindowMenu menuBottom = this.window.menuBottom;
875 menuBottom.Clear();
876 if (mode != UIInventory.Mode.Buy)
877 {
878 if (mode == UIInventory.Mode.Take && !this.owner.Container.isNPCProperty && !this.owner.Container.isChara && !this.IsMagicChest)
879 {
880 this.buttonTakeAll = menuBottom.AddButton("takeAll".lang(EInput.keys.getAll.key.ToString().ToLower(), null, null, null, null), delegate(UIButton b)
881 {
882 CS$<>8__locals1.<>4__this.owner.Container.things.ForeachReverse(delegate(Thing t)
883 {
884 if (!EMono.pc.things.IsFull(t, true, true))
885 {
886 EMono.pc.Pick(t, false, true);
887 }
888 });
889 if (CS$<>8__locals1.<>4__this.owner.Container.things.Count > 0)
890 {
891 SE.Beep();
892 return;
893 }
894 SE.Play("pick_thing");
895 CS$<>8__locals1.<>4__this.Close();
896 }, null, "Default");
897 return;
898 }
899 }
900 else
901 {
902 Card _owner = this.owner.owner;
903 int cost = _owner.trait.CostRerollShop;
904 if (cost > 0)
905 {
906 menuBottom.AddButton("rerollShop".lang(cost.ToString() ?? "", null, null, null, null), delegate(UIButton b)
907 {
908 if (EMono._zone.influence < cost)
909 {
910 SE.Beep();
911 Msg.Say("notEnoughInfluence");
912 return;
913 }
914 SE.Dice();
915 EMono._zone.influence -= cost;
916 _owner.c_dateStockExpire = 0;
917 _owner.trait.OnBarter();
918 CS$<>8__locals1.<>4__this.RefreshGrid();
919 CS$<>8__locals1.<>4__this.Sort(false);
920 SE.Play("shop_open");
921 }, null, "Default");
922 }
923 }
924 }
925
926 // Token: 0x060026B6 RID: 9910 RVA: 0x000DB080 File Offset: 0x000D9280
927 public Transform ShowDistribution(UIContextMenu dis, Window.SaveData data)
928 {
929 UIInventory.<>c__DisplayClass70_0 CS$<>8__locals1 = new UIInventory.<>c__DisplayClass70_0();
930 CS$<>8__locals1.data = data;
931 CS$<>8__locals1.items = new List<UIContextMenuItem>();
932 CS$<>8__locals1.itemAll = null;
933 List<ContainerFlag> list = Util.EnumToList<ContainerFlag>();
934 list.Remove(ContainerFlag.none);
935 GridLayoutGroup gridLayoutGroup = dis.AddGridLayout("Context_LayoutDistribution");
936 CS$<>8__locals1.itemAll = dis.AddToggle("all", false, delegate(bool a)
937 {
938 foreach (UIContextMenuItem uicontextMenuItem2 in CS$<>8__locals1.items)
939 {
940 uicontextMenuItem2.toggle.isOn = a;
941 }
942 base.<ShowDistribution>g__Refresh|0();
943 SE.ClickOk();
944 });
945 using (List<ContainerFlag>.Enumerator enumerator = list.GetEnumerator())
946 {
947 while (enumerator.MoveNext())
948 {
949 ContainerFlag f = enumerator.Current;
950 SourceCategory.Row row = EMono.sources.categories.map[f.ToString()];
951 CS$<>8__locals1.items.Add(dis.AddToggle(row.GetName(), !CS$<>8__locals1.data.flag.HasFlag(f), delegate(bool a)
952 {
953 CS$<>8__locals1.<ShowDistribution>g__SetOn|1(f, !a);
954 CS$<>8__locals1.<ShowDistribution>g__Refresh|0();
955 SE.ClickOk();
956 }));
957 }
958 }
959 CS$<>8__locals1.itemAll.transform.SetParent(gridLayoutGroup.transform);
960 CS$<>8__locals1.itemAll.GetComponentInChildren<UIText>().SetText("all".lang(), FontColor.Topic);
961 foreach (UIContextMenuItem uicontextMenuItem in CS$<>8__locals1.items)
962 {
963 uicontextMenuItem.transform.SetParent(gridLayoutGroup.transform);
964 }
965 CS$<>8__locals1.<ShowDistribution>g__Refresh|0();
966 return gridLayoutGroup.transform;
967 }
968
969 // Token: 0x060026B7 RID: 9911 RVA: 0x000DB234 File Offset: 0x000D9434
970 public Transform ShowAdvDistribution(UIContextMenu dis, Window.SaveData data)
971 {
972 UIDistribution uidistribution = Util.Instantiate<UIDistribution>("UI/Layer/UIDistribution", null);
973 uidistribution.SetContainer(this.owner.Container, data);
974 return dis.AddGameObject<UIDistribution>(uidistribution).transform;
975 }
976
977 // Token: 0x060026B8 RID: 9912 RVA: 0x000DB26C File Offset: 0x000D946C
978 public void Sort(bool magicSort = false)
979 {
980 UIList.SortMode m = this.IsShop ? EMono.player.pref.sortInvShop : EMono.player.pref.sortInv;
981 bool flag = true;
982 while (flag)
983 {
984 flag = false;
985 foreach (Thing thing in this.owner.Container.things)
986 {
987 if (thing.invY != 1)
988 {
989 foreach (Thing thing2 in this.owner.Container.things)
990 {
991 if (thing != thing2 && thing2.invY != 1 && thing.TryStackTo(thing2))
992 {
993 flag = true;
994 break;
995 }
996 }
997 if (flag)
998 {
999 break;
1000 }
1001 }
1002 }
1003 }
1004 int num = 0;
1005 foreach (Thing thing3 in this.owner.Container.things)
1006 {
1007 if (thing3.invY != 1)
1008 {
1009 thing3.invY = 0;
1010 thing3.invX = -1;
1011 }
1012 thing3.SetSortVal(m, this.owner.currency);
1013 num++;
1014 }
1015 this.owner.Container.things.Sort(delegate(Thing a, Thing b)
1016 {
1017 bool flag2 = this.IsShop ? EMono.player.pref.sort_ascending_shop : EMono.player.pref.sort_ascending;
1018 if (m == UIList.SortMode.ByName)
1019 {
1020 if (flag2)
1021 {
1022 return string.Compare(a.GetName(NameStyle.FullNoArticle, 1), b.GetName(NameStyle.FullNoArticle, 1));
1023 }
1024 return string.Compare(b.GetName(NameStyle.FullNoArticle, 1), a.GetName(NameStyle.FullNoArticle, 1));
1025 }
1026 else
1027 {
1028 if (a.sortVal == b.sortVal)
1029 {
1030 return b.SecondaryCompare(m, a);
1031 }
1032 if (!flag2)
1033 {
1034 return a.sortVal - b.sortVal;
1035 }
1036 return b.sortVal - a.sortVal;
1037 }
1038 });
1039 if (!this.UseGrid)
1040 {
1041 int num2 = 0;
1042 int num3 = 0;
1043 Vector2 sizeDelta = this.list.Rect().sizeDelta;
1044 sizeDelta.x -= 60f;
1045 sizeDelta.y -= 60f;
1046 foreach (Thing thing4 in this.owner.Container.things)
1047 {
1048 if (thing4.invY == 0)
1049 {
1050 thing4.posInvX = num2 + 30;
1051 thing4.posInvY = (int)sizeDelta.y - num3 + 30;
1052 num2 += 40;
1053 if ((float)num2 > sizeDelta.x)
1054 {
1055 num2 = 0;
1056 num3 += 40;
1057 if ((float)num3 > sizeDelta.y)
1058 {
1059 num3 = 20;
1060 }
1061 }
1062 }
1063 }
1064 }
1065 if (!magicSort)
1066 {
1067 this.list.Redraw();
1068 }
1069 }
1070
1071 // Token: 0x060026B9 RID: 9913 RVA: 0x000DB510 File Offset: 0x000D9710
1072 public void RefreshList()
1073 {
1074 UIInventory.Mode mode = this.currentTab.mode;
1075 UIInventory.SubMode subMode = this.currentTab.subMode;
1076 this.RefreshMenu();
1077 this.list.Clear();
1078 UIList.Callback<Thing, ButtonGrid> callbacks = new UIList.Callback<Thing, ButtonGrid>
1079 {
1080 onClick = delegate(Thing a, ButtonGrid b)
1081 {
1082 if (this.destNum != 0)
1083 {
1084 if (this.destNum != -1)
1085 {
1086 int num = this.destNum;
1087 }
1088 else
1089 {
1090 int num2 = a.Num;
1091 }
1092 }
1093 if (this.actionClick != null)
1094 {
1095 this.actionClick(a);
1096 this.Close();
1097 return;
1098 }
1099 EMono.pc.HoldCard(a, -1);
1100 SE.SelectHotitem();
1101 },
1102 onInstantiate = delegate(Thing a, ButtonGrid b)
1103 {
1104 this.dirty = false;
1105 string name = a.Name;
1106 bool flag = mode == UIInventory.Mode.Buy || mode == UIInventory.Mode.Sell || mode == UIInventory.Mode.Identify;
1107 int num = (this.destNum == -1) ? a.Num : 1;
1108 int cost = flag ? (a.GetPrice(this.CurrencyType, mode == UIInventory.Mode.Sell, PriceType.Default, null) * num) : 0;
1109 bool canPay = cost < EMono.pc.GetCurrency(this.IDCurrency);
1110 if (mode == UIInventory.Mode.Identify)
1111 {
1112 cost = 100;
1113 }
1114 b.SetCard(a, ButtonGrid.Mode.Default, delegate(UINote n)
1115 {
1116 UIInventory.Mode mode = mode;
1117 if (mode - UIInventory.Mode.Buy <= 1)
1118 {
1119 n.Space(8, 1);
1120 UIItem uiitem = n.AddExtra<UIItem>("costPrice");
1121 uiitem.text1.SetText(Lang._currency(cost, false, 14), canPay ? FontColor.Good : FontColor.Bad);
1122 uiitem.image1.sprite = SpriteSheet.Get("icon_" + this.IDCurrency);
1123 }
1124 });
1125 if (flag && b.subText)
1126 {
1127 b.subText.SetText((cost.ToString() ?? "").TagColorGoodBad(() => mode == UIInventory.Mode.Sell || cost <= EMono.pc.GetCurrency(this.IDCurrency), false));
1128 }
1129 },
1130 onList = delegate(UIList.SortMode m)
1131 {
1132 List<Thing> list = new List<Thing>();
1133 foreach (Thing thing in this.owner.Things)
1134 {
1135 if (thing != null && (this.funcList == null || this.funcList(thing)) && !thing.HasTag(CTAG.noDrop) && (thing.c_equippedSlot == 0 || mode == UIInventory.Mode.Equip || mode == UIInventory.Mode.Identify) && (!(thing.category.id == "currency") || (mode != UIInventory.Mode.Buy && mode != UIInventory.Mode.Sell)))
1136 {
1137 list.Add(thing);
1138 }
1139 }
1140 int num = 0;
1141 UIList uilist = this.list;
1142 foreach (Thing thing2 in list)
1143 {
1144 num += thing2.ChildrenAndSelfWeight;
1145 this.list.Add(thing2);
1146 }
1147 string text = "statsInv".lang(this.owner.Container.things.Count.ToString() ?? "", this.list.ItemCount.ToString() ?? "", Lang._weight(num, true, 0), null, null);
1148 this.layer.windows[0].textStats.SetText(text);
1149 },
1150 onSort = null
1151 };
1152 this.list.callbacks = callbacks;
1153 this.list.List(false);
1154 }
1155
1156 // Token: 0x060026BA RID: 9914 RVA: 0x000DB5B4 File Offset: 0x000D97B4
1157 public void RefreshHighlight()
1158 {
1159 if (!this.imageHighlight)
1160 {
1161 return;
1162 }
1163 this.imageHighlight.SetActive(false);
1164 if (!EMono.game.altInv)
1165 {
1166 return;
1167 }
1168 Thing thing = EMono.player.currentHotItem.Thing;
1169 if (this.currentTab.mode == UIInventory.Mode.All && thing != null && !thing.isDestroyed)
1170 {
1171 ICardParent parent = thing.parent;
1172 Card container = this.owner.Container;
1173 }
1174 }
1175
1176 // Token: 0x060026BB RID: 9915 RVA: 0x000DB628 File Offset: 0x000D9828
1177 public void RefreshGrid()
1178 {
1179 UIInventory.Mode mode = this.currentTab.mode;
1180 UIInventory.SubMode subMode = this.currentTab.subMode;
1181 CoreRef.InventoryStyle style = this.InvStyle;
1182 this.RefreshMenu();
1183 GridLayoutGroup g = this.list.GetComponent<GridLayoutGroup>();
1184 ContentSizeFitter component = this.list.GetComponent<ContentSizeFitter>();
1185 if (this.UseGrid)
1186 {
1187 g.constraintCount = ((this.window.saveData.columns == 0) ? this.owner.Container.things.width : this.window.saveData.columns);
1188 Vector2 cellSize = style.gridSize * (float)(100 + this.window.saveData.size) / 100f;
1189 g.cellSize = cellSize;
1190 g.enabled = (component.enabled = true);
1191 }
1192 else
1193 {
1194 g.enabled = (component.enabled = false);
1195 this.list.Rect().sizeDelta = style.sizeContainer;
1196 }
1197 this.list.Clear();
1198 int maxCapacity = this.IsMagicChest ? this.owner.Container.things.MaxCapacity : 0;
1199 UIList.Callback<Thing, ButtonGrid> callback = new UIList.Callback<Thing, ButtonGrid>
1200 {
1201 onRedraw = delegate(Thing a, ButtonGrid b, int i)
1202 {
1203 this.dirty = false;
1204 b.index = i;
1205 bool flag = i >= this.owner.Things.Count;
1206 if (this.IsMagicChest)
1207 {
1208 flag = (this.uiMagic.page * this.uiMagic.GridSize + i >= maxCapacity);
1209 }
1210 if (this.UseGrid)
1211 {
1212 b.SetCardGrid(a, flag ? null : this.owner);
1213 }
1214 else
1215 {
1216 b.SetCardGrid(a, this.owner);
1217 if (a != null)
1218 {
1219 b.Rect().anchoredPosition = new Vector2((float)a.posInvX, (float)a.posInvY);
1220 }
1221 float num = 0.01f * (float)EMono.game.config.gridIconSize;
1222 b.icon.Rect().localScale = new Vector3(num, num, 1f);
1223 b.Rect().sizeDelta = b.icon.rectTransform.sizeDelta;
1224 }
1225 if (flag)
1226 {
1227 b.interactable = false;
1228 b.image.sprite = null;
1229 b.image.color = new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, 120);
1230 b.image.raycastTarget = false;
1231 return;
1232 }
1233 b.image.raycastTarget = true;
1234 },
1235 onList = delegate(UIList.SortMode m)
1236 {
1237 this.list.bgType = (this.UseGrid ? UIList.BGType.grid : UIList.BGType.none);
1238 if (this.list.bgGrid)
1239 {
1240 this.list.bgGrid.SetActive(this.UseGrid);
1241 this.list.bgGrid.color = style.gridColor;
1242 if (this.window.saveData.color.a != 0)
1243 {
1244 this.list.bgGrid.color = this.window.saveData.color;
1245 }
1246 }
1247 if (this.IsMagicChest)
1248 {
1249 this.owner.Container.things.RefreshGrid(this.uiMagic, this.window.saveData);
1250 }
1251 else
1252 {
1253 this.owner.Container.things.RefreshGrid();
1254 }
1255 if (this.UseGrid)
1256 {
1257 if (this.IsMagicChest)
1258 {
1259 for (int i = 0; i < this.owner.Container.things.GridSize; i++)
1260 {
1261 this.list.Add(this.owner.Things[i]);
1262 }
1263 }
1264 else
1265 {
1266 int count = this.owner.Things.Count;
1267 int num = (int)Mathf.Ceil((float)(count / g.constraintCount + ((count % g.constraintCount == 0) ? 0 : 1))) * g.constraintCount;
1268 for (int j = 0; j < num; j++)
1269 {
1270 this.list.Add((j < count) ? this.owner.Things[j] : null);
1271 }
1272 }
1273 }
1274 else
1275 {
1276 Vector2 sizeDelta2 = this.list.Rect().sizeDelta;
1277 foreach (Thing thing2 in this.owner.Things)
1278 {
1279 if (thing2 != null)
1280 {
1281 this.list.Add(thing2);
1282 if (thing2.posInvX == 0 && thing2.posInvY == 0)
1283 {
1284 thing2.posInvX = EMono.rnd((int)sizeDelta2.x - 60) + 30;
1285 thing2.posInvY = EMono.rnd((int)sizeDelta2.y - 60) + 30;
1286 }
1287 }
1288 }
1289 }
1290 if (this.floatMode)
1291 {
1292 this.window.setting.tabs[0].idLang = "captionInvFloat".lang(this.owner.Container.IsPC ? "" : this.owner.Container.Name, ((float)this.owner.Container.ChildrenWeight / 1000f).ToString("F1") + "/" + ((float)this.owner.Container.WeightLimit / 1000f).ToString("F1"), null, null, null);
1293 }
1294 }
1295 };
1296 this.list.callbacks = callback;
1297 this.list.onBeforeRedraw = delegate()
1298 {
1299 if (this.IsMagicChest)
1300 {
1301 if (this.firstMouseRightDown || (!Input.GetMouseButton(1) && !Input.GetKey(KeyCode.LeftShift) && !Input.GetKey(KeyCode.RightShift)))
1302 {
1303 this.Sort(true);
1304 this.firstMouseRightDown = false;
1305 this.owner.Container.things.RefreshGrid(this.uiMagic, this.window.saveData);
1306 }
1307 }
1308 else
1309 {
1310 this.owner.Container.things.RefreshGrid();
1311 }
1312 this.dirty = false;
1313 if (this.UseGrid)
1314 {
1315 UIList uilist = this.list;
1316 for (int i = 0; i < uilist.buttons.Count; i++)
1317 {
1318 UIList.ButtonPair value = uilist.buttons[i];
1319 value.obj = ((i < this.owner.Container.things.grid.Count) ? this.owner.Container.things.grid[i] : null);
1320 uilist.buttons[i] = value;
1321 }
1322 }
1323 };
1324 this.list.onAfterRedraw = delegate()
1325 {
1326 if (!this.layer.floatInv)
1327 {
1328 int num = 0;
1329 foreach (UIList.ButtonPair buttonPair in this.list.buttons)
1330 {
1331 Thing thing2 = (buttonPair.component as ButtonGrid).card as Thing;
1332 if (thing2 != null)
1333 {
1334 num += thing2.ChildrenAndSelfWeight;
1335 }
1336 }
1337 string text = "statsInv2".lang(this.owner.Container.things.Count.ToString() ?? "", this.list.ItemCount.ToString() ?? "", Lang._weight(num, true, 0) + "/" + Lang._weight(this.owner.Container.WeightLimit, true, 0), null, null);
1338 this.layer.windows[0].textStats.SetText(text);
1339 }
1340 if (this.owner.Container.things.IsOverflowing())
1341 {
1342 if (!this.transOverflow)
1343 {
1344 this.transOverflow = Util.Instantiate("UI/Element/Other/InvOverflow", this.window.transform);
1345 }
1346 }
1347 else if (this.transOverflow)
1348 {
1349 UnityEngine.Object.Destroy(this.transOverflow.gameObject);
1350 }
1351 LayerInventory.TryShowGuide(this.list);
1352 if (this.layer.mini)
1353 {
1354 this.layer.mini.Refresh(this.layer.mini.window.idTab);
1355 }
1356 if (this.uiMagic)
1357 {
1358 this.uiMagic.OnAfterRedraw();
1359 }
1360 };
1361 callback.mold = (this.UseGrid ? this.moldButtonGrid : this.moldButtonGridless);
1362 if (!this.UseGrid && !this.window.saveData.firstSorted)
1363 {
1364 Vector2 sizeDelta = this.list.Rect().sizeDelta;
1365 foreach (Thing thing in this.owner.Things)
1366 {
1367 if (thing != null)
1368 {
1369 thing.posInvX = EMono.rnd((int)sizeDelta.x - 60) + 30;
1370 thing.posInvY = EMono.rnd((int)sizeDelta.y - 60) + 30;
1371 }
1372 }
1373 this.window.saveData.firstSorted = true;
1374 }
1375 this.list.List(false);
1376 g.RebuildLayoutTo<Layer>();
1377 this.list.onAfterRedraw();
1378 if (this.list.bgGrid)
1379 {
1380 this.list.bgGrid.color = style.gridColor;
1381 if (this.window.saveData.color.a != 0)
1382 {
1383 this.list.bgGrid.color = this.window.saveData.color;
1384 }
1385 }
1386 if (this.owner == InvOwner.Trader && this.owner.UseGuide)
1387 {
1388 LayerInventory.SetDirtyAll(false);
1389 }
1390 }
1391
1392 // Token: 0x0400152D RID: 5421
1393 public UIList list;
1394
1395 // Token: 0x0400152E RID: 5422
1396 public BodySlot bodySlot;
1397
1398 // Token: 0x0400152F RID: 5423
1399 public LayerInventory layer;
1400
1401 // Token: 0x04001530 RID: 5424
1402 public Transform headerRow;
1403
1404 // Token: 0x04001531 RID: 5425
1405 public Transform transOverflow;
1406
1407 // Token: 0x04001532 RID: 5426
1408 public string idMold;
1409
1410 // Token: 0x04001533 RID: 5427
1411 public Func<Thing, bool> funcList;
1412
1413 // Token: 0x04001534 RID: 5428
1414 public Action<Thing> actionClick;
1415
1416 // Token: 0x04001535 RID: 5429
1417 public Window window;
1418
1419 // Token: 0x04001536 RID: 5430
1420 public UIContent content;
1421
1422 // Token: 0x04001537 RID: 5431
1423 public UIInventory.Tab currentTab;
1424
1425 // Token: 0x04001538 RID: 5432
1426 public AIAct currentAct;
1427
1428 // Token: 0x04001539 RID: 5433
1429 public UIInventory.InteractMode interactMode;
1430
1431 // Token: 0x0400153A RID: 5434
1432 public bool floatMode;
1433
1434 // Token: 0x0400153B RID: 5435
1435 public bool dirty;
1436
1437 // Token: 0x0400153C RID: 5436
1438 public bool isList;
1439
1440 // Token: 0x0400153D RID: 5437
1441 public UIInventory.Transaction lastTransaction;
1442
1443 // Token: 0x0400153E RID: 5438
1444 public Image imageHighlight;
1445
1446 // Token: 0x0400153F RID: 5439
1447 public Image imageHighlightGrid;
1448
1449 // Token: 0x04001540 RID: 5440
1450 public UIButton moldSmallTab;
1451
1452 // Token: 0x04001541 RID: 5441
1453 public ButtonGrid moldButtonGrid;
1454
1455 // Token: 0x04001542 RID: 5442
1456 public ButtonGrid moldButtonGridless;
1457
1458 // Token: 0x04001543 RID: 5443
1459 public UIButton buttonTakeAll;
1460
1461 // Token: 0x04001544 RID: 5444
1462 public UIMagicChest uiMagic;
1463
1464 // Token: 0x04001545 RID: 5445
1465 private int destNum;
1466
1467 // Token: 0x04001546 RID: 5446
1468 private int lastNum;
1469
1470 // Token: 0x04001547 RID: 5447
1471 private bool firstMouseRightDown;
1472
1473 // Token: 0x04001548 RID: 5448
1474 public List<UIInventory.Tab> tabs = new List<UIInventory.Tab>();
1475
1476 // Token: 0x04001549 RID: 5449
1477 public bool wasDirty;
1478
1479 // Token: 0x02000AB1 RID: 2737
1480 public class Transaction
1481 {
1482 // Token: 0x04002B7C RID: 11132
1483 public Thing thing;
1484
1485 // Token: 0x04002B7D RID: 11133
1486 public int num;
1487
1488 // Token: 0x04002B7E RID: 11134
1489 public int price;
1490
1491 // Token: 0x04002B7F RID: 11135
1492 public UIInventory.Mode mode;
1493
1494 // Token: 0x04002B80 RID: 11136
1495 public Card from;
1496 }
1497
1498 // Token: 0x02000AB2 RID: 2738
1499 public enum Mode
1500 {
1501 // Token: 0x04002B82 RID: 11138
1502 Default,
1503 // Token: 0x04002B83 RID: 11139
1504 Equip,
1505 // Token: 0x04002B84 RID: 11140
1506 Buy,
1507 // Token: 0x04002B85 RID: 11141
1508 Sell,
1509 // Token: 0x04002B86 RID: 11142
1510 Gear,
1511 // Token: 0x04002B87 RID: 11143
1512 Other,
1513 // Token: 0x04002B88 RID: 11144
1514 Select,
1515 // Token: 0x04002B89 RID: 11145
1516 Food,
1517 // Token: 0x04002B8A RID: 11146
1518 Item,
1519 // Token: 0x04002B8B RID: 11147
1520 Resource,
1521 // Token: 0x04002B8C RID: 11148
1522 Read,
1523 // Token: 0x04002B8D RID: 11149
1524 Hold,
1525 // Token: 0x04002B8E RID: 11150
1526 Tool,
1527 // Token: 0x04002B8F RID: 11151
1528 Put,
1529 // Token: 0x04002B90 RID: 11152
1530 Take,
1531 // Token: 0x04002B91 RID: 11153
1532 Give,
1533 // Token: 0x04002B92 RID: 11154
1534 Trade,
1535 // Token: 0x04002B93 RID: 11155
1536 All,
1537 // Token: 0x04002B94 RID: 11156
1538 Offer,
1539 // Token: 0x04002B95 RID: 11157
1540 Identify,
1541 // Token: 0x04002B96 RID: 11158
1542 Drink,
1543 // Token: 0x04002B97 RID: 11159
1544 Deliver,
1545 // Token: 0x04002B98 RID: 11160
1546 HoldFurniture,
1547 // Token: 0x04002B99 RID: 11161
1548 HoldBlock,
1549 // Token: 0x04002B9A RID: 11162
1550 Recycle
1551 }
1552
1553 // Token: 0x02000AB3 RID: 2739
1554 public enum SubMode
1555 {
1556 // Token: 0x04002B9C RID: 11164
1557 Default,
1558 // Token: 0x04002B9D RID: 11165
1559 IdentifyScroll,
1560 // Token: 0x04002B9E RID: 11166
1561 DeliverTax
1562 }
1563
1564 // Token: 0x02000AB4 RID: 2740
1565 public enum InteractMode
1566 {
1567 // Token: 0x04002BA0 RID: 11168
1568 Auto,
1569 // Token: 0x04002BA1 RID: 11169
1570 Hold,
1571 // Token: 0x04002BA2 RID: 11170
1572 Drop
1573 }
1574
1575 // Token: 0x02000AB5 RID: 2741
1576 public class Tab
1577 {
1578 // Token: 0x04002BA3 RID: 11171
1579 public Card dest;
1580
1581 // Token: 0x04002BA4 RID: 11172
1582 public InvOwner owner;
1583
1584 // Token: 0x04002BA5 RID: 11173
1585 public UIInventory.Mode mode;
1586
1587 // Token: 0x04002BA6 RID: 11174
1588 public UIInventory.SubMode subMode;
1589
1590 // Token: 0x04002BA7 RID: 11175
1591 public string textTab;
1592
1593 // Token: 0x04002BA8 RID: 11176
1594 public bool smallTab;
1595 }
1596}
Definition AIAct.cs:7
Definition Act.2.cs:7
Definition Card.cs:13
Definition Chara.cs:12
Definition EMono.cs:6
Definition Msg.cs:7
Definition Thing.cs:10
Definition Zone.cs:14