16 return (this.currentTab ?? this.tabs[0]).owner;
26 return this.currentTab.dest;
36 return this.window.saveData.useBG || !this.UseGrid;
46 return EMono.core.config.game.useGrid;
52 public bool IsMagicChest
62 public bool IsToolbelt
86 return EMono.core.refs.invStyle[(this.UseBG || this.IsToolbelt) ? this.owner.Container.trait.IDInvStyle :
"transparent"];
92 public bool IsMainMode
96 switch (this.currentTab.mode)
117 public CurrencyType CurrencyType
121 return this.currentTab.owner.currency;
127 public string IDCurrency
131 CurrencyType currencyType = this.CurrencyType;
132 if (currencyType == CurrencyType.Medal)
136 if (currencyType != CurrencyType.Ecopo)
145 public static void RefreshAllList()
148 for (
int i = 0; i < componentsInChildren.Length; i++)
150 componentsInChildren[i].list.Redraw();
155 public void SetHeader(
string s)
157 this.window.SetCaption(s.lang());
163 return this.AddTab(
new InvOwner(c, container, CurrencyType.None, PriceType.Default), mode);
182 this.interactMode =
EMono.player.pref.interactMode;
183 using (List<
UIInventory.
Tab>.Enumerator enumerator = this.tabs.GetEnumerator())
185 while (enumerator.MoveNext())
188 string text = t.textTab.IsEmpty(
"inv" + t.mode.ToString());
191 string str = text.lang();
194 if (!t.owner.owner.IsPC)
196 Chara chara = t.owner.Chara;
197 str3 = (((chara !=
null) ? chara.Name :
null) ?? t.owner.Container.Name);
201 str3 =
"you".lang().ToTitleCase(
false);
203 text = str + str2 + str3;
205 Window.Setting.Tab tab = this.window.AddTab(text, this.content, delegate
208 },
EMono.core.refs.icons.invTab.TryGetValue(t.mode,
null), text);
211 tab.customTab = this.moldSmallTab;
217 this.layer.mini.SetActive(this.owner.Container.isChara);
218 if (this.owner.Container.isChara)
220 this.layer.mini.SetChara(this.owner.Container.Chara);
225 this.uiMagic.SetActive(this.IsMagicChest);
226 if (this.IsMagicChest)
231 if (this.IsMagicChest)
233 TooltipManager.Instance.disableTimer = 0.1f;
238 public void RefreshWindow()
240 if (this.window.saveData ==
null)
242 Window window = this.window;
243 Window.SaveData saveData;
244 if ((saveData = Window.dictData.TryGetValue(
this.window.idWindow,
null)) ==
null)
246 (saveData =
new Window.SaveData()).useBG =
EMono.core.config.game.showInvBG;
248 window.saveData = saveData;
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);
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;
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);
268 if (
EMono.core.config.ui.showFloatButtons &&
this.window.cgFloatMenu)
270 this.window.cgFloatMenu.alpha = 1f;
271 this.window.cgFloatMenu.enabled =
false;
272 this.window.cgFloatMenu.SetActive(
true);
288 if (this.currentTab == tab)
292 this.currentTab = tab;
293 this.RefreshWindow();
294 this.destNum = (this.lastNum = (this.DestNumIsMax() ? -1 : 0));
307 if (this.layer.uiCurrency)
309 tab.owner.BuildUICurrency(this.layer.uiCurrency, tab.owner.owner.trait.CostRerollShop != 0);
311 this.layer.TryShowHint(
"h_inv" + tab.mode.ToString());
314 UIHeader[] componentsInChildren = this.headerRow.GetComponentsInChildren<UIHeader>(
true);
315 componentsInChildren[0].SetText(
"headerItem");
316 UIInventory.Mode mode = tab.mode;
319 componentsInChildren[1].SetText(
"headerPrice".lang(this.IDCurrency.lang(),
null,
null,
null,
null));
324 componentsInChildren[1].SetText(
"headerWeight");
327 componentsInChildren[1].SetText(
"headerRecycle");
332 public void DoAct(
Act act)
334 if (!
EMono.pc.HasNoGoal || (act.LocalAct &&
EMono._zone.IsRegion))
339 EMono.player.hotItemToRestore =
EMono.player.currentHotItem;
342 act.Perform(
EMono.pc,
null,
null);
345 this.currentAct = (act as
AIAct);
346 EMono.pc.SetAI(this.currentAct);
356 private void Update()
358 if (this.owner.Container.isDestroyed)
363 this.imageHighlightGrid.SetActive(
LayerInventory.highlightInv ==
this.owner);
365 if (EInput.action == EAction.GetAll &&
this.buttonTakeAll && !
this.IsMagicChest)
367 this.buttonTakeAll.onClick.Invoke();
369 if (this.IsMagicChest && this.wasDirty && (Input.GetMouseButtonUp(1) || Input.GetKeyUp(KeyCode.LeftShift) || Input.GetKeyUp(KeyCode.RightShift)))
372 this.wasDirty =
false;
374 if (Input.GetMouseButtonDown(1))
376 this.firstMouseRightDown =
true;
381 public void CheckDirty()
385 this.wasDirty =
true;
392 this.list.List(
false);
394 UIButton.TryShowTip(
null,
true,
true);
399 public void RefreshDestNum()
401 if (this.destNum > 0)
405 this.destNum = (this.DestNumIsMax() ? (EInput.isShiftDown ? 0 : -1) : (EInput.isShiftDown ? -1 : 0));
406 if (this.destNum != this.lastNum)
408 this.lastNum = this.destNum;
414 public bool DestNumIsMax()
416 UIInventory.Mode mode = this.currentTab.mode;
417 return mode - UIInventory.Mode.Buy > 1;
421 public void RefreshMenu()
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)
429 CS$<>8__locals1.b.onClick.RemoveAllListeners();
430 CS$<>8__locals1.b.onClick.AddListener(delegate()
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++)
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()
445 if (CS$<>8__locals4.CS$<>8__locals1.<>4__this.IsShop)
447 EMono.player.pref.sortInvShop = _sort;
451 EMono.player.pref.sortInv = _sort;
453 CS$<>8__locals4.CS$<>8__locals1.<>4__this.Sort(
false);
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)
463 action = (CS$<>8__locals1.<>9__3 = delegate(
bool a)
465 if (CS$<>8__locals1.<>4__this.IsShop)
467 EMono.player.pref.sort_ascending_shop = a;
471 EMono.player.pref.sort_ascending = a;
473 CS$<>8__locals1.<>4__this.Sort(
false);
477 uicontextMenu3.AddToggle(idLang, isOn, action);
478 if (CS$<>8__locals1.<>4__this.IsMagicChest)
480 UIContextMenu uicontextMenu4 = uicontextMenu.AddChild(
"catFilterType", TextAnchor.UpperRight);
481 foreach (Window.SaveData.CategoryType categoryType in Util.EnumToList<Window.SaveData.CategoryType>())
483 Window.SaveData.CategoryType _c = categoryType;
484 uicontextMenu4.AddButton(((CS$<>8__locals1.data.category == categoryType) ?
"context_checker".lang() :
"") + (
"catFilterType_" + _c.ToString()).lang(), delegate()
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();
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)
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)
516 action2 = (CS$<>8__locals1.<>9__14 = delegate(
float a)
518 CS$<>8__locals1.data.priority = (int)a;
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)
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)
533 action3 = (CS$<>8__locals1.<>9__16 = delegate(bool a)
535 CS$<>8__locals1.data.onlyRottable = a;
539 dis2.AddToggle(idLang2, onlyRottable, action3);
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)
547 action4 = (CS$<>8__locals1.<>9__17 = delegate(
bool a)
549 CS$<>8__locals1.data.noRotten = a;
553 dis3.AddToggle(idLang3, noRotten, action4);
554 CS$<>8__locals7.dis.AddToggle(
"advDistribution", CS$<>8__locals1.data.advDistribution, delegate(
bool a)
556 CS$<>8__locals7.CS$<>8__locals4.CS$<>8__locals1.data.advDistribution = a;
557 base.<RefreshMenu>g__RefreshDist|15();
563 UIContextMenu uicontextMenu5 = uicontextMenu.AddChild(
"autodump", TextAnchor.UpperRight);
564 foreach (AutodumpFlag autodumpFlag
in new List<AutodumpFlag>
566 AutodumpFlag.existing,
567 AutodumpFlag.sameCategory,
568 AutodumpFlag.distribution,
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()
577 CS$<>8__locals4.CS$<>8__locals1.data.autodump = _e;
579 if (autodumpFlag != AutodumpFlag.none)
581 uibutton.SetTooltipLang(
"dump_" + autodumpFlag.ToString() +
"_tip");
585 if (CS$<>8__locals4.con.IsPC || (CS$<>8__locals4.con.isThing && !(CS$<>8__locals4.con.trait is
TraitChestMerchant) && !CS$<>8__locals4.con.isNPCProperty))
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)
594 action5 = (CS$<>8__locals1.<>9__20 = delegate(
bool a)
596 CS$<>8__locals1.data.excludeCraft = a;
600 uicontextMenu7.AddToggle(idLang4, excludeCraft, action5);
601 if (CS$<>8__locals4.con.GetRootCard() ==
EMono.pc)
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)
609 action6 = (CS$<>8__locals1.<>9__21 = delegate(
bool a)
611 CS$<>8__locals1.data.excludeDump = a;
615 uicontextMenu8.AddToggle(idLang5, excludeDump, action6);
617 if (
EMono.core.config.game.advancedMenu)
619 if (!CS$<>8__locals4.con.IsPC)
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)
627 action7 = (CS$<>8__locals1.<>9__22 = delegate(
bool a)
629 CS$<>8__locals1.data.noRightClickClose = a;
633 uicontextMenu9.AddToggle(idLang6, noRightClickClose, action7);
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)
641 action8 = (CS$<>8__locals1.<>9__23 = delegate(
bool a)
643 CS$<>8__locals1.data.fixedPos = a;
644 CS$<>8__locals1.<>4__this.RefreshWindow();
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)
655 action9 = (CS$<>8__locals1.<>9__24 = delegate(
bool a)
657 CS$<>8__locals1.data.compress = a;
661 uicontextMenu11.AddToggle(idLang8, compress, action9);
663 if (!CS$<>8__locals4.con.isChara && !CS$<>8__locals4.con.trait.IsSpecialContainer)
665 uicontextMenu6.AddButton(
"changeName", delegate()
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)
672 onClose = (CS$<>8__locals4.<>9__26 = delegate(
bool cancel,
string text)
676 CS$<>8__locals4.con.c_altName = text;
680 Dialog.InputName(langDetail, text5, onClose,
Dialog.InputType.Default);
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)
691 action10 = (CS$<>8__locals1.<>9__4 = delegate(
bool a)
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();
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)
708 action11 = (CS$<>8__locals1.<>9__6 = delegate(
float b)
710 CS$<>8__locals1.data.size = (int)b;
711 CS$<>8__locals1.<>4__this.RefreshGrid();
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)
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)
724 action12 = (CS$<>8__locals1.<>9__8 = delegate(
float b)
726 CS$<>8__locals1.data.columns = (int)b;
727 CS$<>8__locals1.<>4__this.RefreshGrid();
730 uicontextMenu15.AddSlider(text3, textFunc3, value3, action12, 0f, 20f,
true,
false,
false);
732 UIContextMenu uicontextMenu16 = uicontextMenu12;
733 string idLang10 =
"colorGrid";
735 if ((action13 = CS$<>8__locals1.<>9__9) ==
null)
737 action13 = (CS$<>8__locals1.<>9__9 = delegate()
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)
745 onChangeColor = (CS$<>8__locals1.<>9__27 = delegate(PickerState state, Color _c)
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)
751 CS$<>8__locals1.<>4__this.list.bgGrid.color = CS$<>8__locals1.<>4__this.InvStyle.gridColor;
755 layerColorPicker.SetColor(startColor, gridColor, onChangeColor);
758 uicontextMenu16.AddButton(idLang10, action13,
true);
759 if (!CS$<>8__locals4.con.isChara)
761 UIContextMenu uicontextMenu17 = uicontextMenu12;
762 string idLang11 =
"changeIcon";
764 if ((action14 = CS$<>8__locals1.<>9__10) ==
null)
766 action14 = (CS$<>8__locals1.<>9__10 = delegate()
768 EMono.ui.contextMenu.currentMenu.Hide();
769 UIContextMenu uicontextMenu19 =
EMono.ui.CreateContextMenuInteraction();
770 GridLayoutGroup parent = uicontextMenu19.AddGridLayout();
772 foreach (Sprite sprite
in EMono.core.refs.spritesContainerIcon)
774 UIButton uibutton2 = Util.Instantiate<UIButton>(
"UI/Element/Button/ButtonContainerIcon", parent);
776 uibutton2.icon.sprite =
EMono.core.refs.spritesContainerIcon[_i];
777 uibutton2.SetOnClick(delegate
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();
786 uicontextMenu19.Show();
789 uicontextMenu17.AddButton(idLang11, action14,
true);
791 if (
EMono.debug.enable)
793 UIContextMenu uicontextMenu18 = uicontextMenu.AddChild(
"debug", TextAnchor.UpperRight);
794 uicontextMenu18.AddToggle(
"toggleGrid",
EMono.core.config.game.useGrid, delegate(
bool a)
796 EMono.core.config.game.useGrid = a;
799 layerInventory.invs[0].RefreshWindow();
800 layerInventory.invs[0].RefreshGrid();
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)
809 action15 = (CS$<>8__locals1.<>9__31 = delegate(
float b)
811 EMono.game.config.gridIconSize = (int)b;
812 CS$<>8__locals1.<>4__this.RefreshGrid();
815 uicontextMenu18.AddSlider(text4, textFunc4, value4, action15, 100f, 150f,
true,
false,
false);
817 uicontextMenu.Show();
820 CS$<>8__locals1.b = this.window.buttonQuickSort;
821 if (CS$<>8__locals1.b)
823 CS$<>8__locals1.b.onClick.RemoveAllListeners();
824 CS$<>8__locals1.b.onClick.AddListener(delegate()
826 CS$<>8__locals1.<>4__this.Sort(
false);
830 CS$<>8__locals1.b = this.window.buttonExtra;
831 if (CS$<>8__locals1.b)
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()
837 if (!
EMono.ui.AllowInventoryInteractions)
843 Msg.Say(
"dump_invalid");
846 if (!
EMono.pc.HasNoGoal)
854 CS$<>8__locals1.b = this.window.buttonShared;
855 if (CS$<>8__locals1.b)
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);
862 CS$<>8__locals1.<RefreshMenu>g__RefreshShareButton|32();
863 CS$<>8__locals1.b.SetOnClick(delegate
865 bool flag2 = CS$<>8__locals1.data.sharedType == ContainerSharedType.Shared;
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();
873 UIInventory.Mode mode = this.currentTab.mode;
874 WindowMenu menuBottom = this.window.menuBottom;
878 if (mode ==
UIInventory.Mode.Take && !
this.owner.Container.isNPCProperty && !
this.owner.Container.isChara && !
this.IsMagicChest)
880 this.buttonTakeAll = menuBottom.AddButton(
"takeAll".lang(EInput.keys.getAll.key.ToString().ToLower(),
null,
null,
null,
null), delegate(UIButton b)
882 CS$<>8__locals1.<>4__this.owner.Container.things.ForeachReverse(delegate(
Thing t)
884 if (!
EMono.pc.things.IsFull(t,
true,
true))
886 EMono.pc.Pick(t,
false,
true);
889 if (CS$<>8__locals1.<>4__this.owner.Container.things.Count > 0)
894 SE.Play(
"pick_thing");
895 CS$<>8__locals1.<>4__this.Close();
902 Card _owner = this.owner.owner;
903 int cost = _owner.trait.CostRerollShop;
906 menuBottom.AddButton(
"rerollShop".lang(cost.ToString() ??
"",
null,
null,
null,
null), delegate(UIButton b)
908 if (
EMono._zone.influence < cost)
911 Msg.Say(
"notEnoughInfluence");
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");
927 public Transform ShowDistribution(UIContextMenu dis, Window.SaveData data)
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)
938 foreach (UIContextMenuItem uicontextMenuItem2
in CS$<>8__locals1.items)
940 uicontextMenuItem2.toggle.isOn = a;
942 base.<ShowDistribution>g__Refresh|0();
945 using (List<ContainerFlag>.Enumerator enumerator = list.GetEnumerator())
947 while (enumerator.MoveNext())
949 ContainerFlag f = enumerator.Current;
951 CS$<>8__locals1.items.Add(dis.AddToggle(row.GetName(), !CS$<>8__locals1.data.flag.HasFlag(f), delegate(
bool a)
953 CS$<>8__locals1.<ShowDistribution>g__SetOn|1(f, !a);
954 CS$<>8__locals1.<ShowDistribution>g__Refresh|0();
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)
963 uicontextMenuItem.transform.SetParent(gridLayoutGroup.transform);
965 CS$<>8__locals1.<ShowDistribution>g__Refresh|0();
966 return gridLayoutGroup.transform;
970 public Transform ShowAdvDistribution(UIContextMenu dis, Window.SaveData data)
973 uidistribution.SetContainer(this.owner.Container, data);
974 return dis.AddGameObject<
UIDistribution>(uidistribution).transform;
978 public void Sort(
bool magicSort =
false)
980 UIList.SortMode m = this.IsShop ? EMono.player.pref.sortInvShop :
EMono.player.pref.sortInv;
985 foreach (
Thing thing
in this.owner.Container.things)
989 foreach (
Thing thing2
in this.owner.Container.things)
991 if (thing != thing2 && thing2.invY != 1 && thing.TryStackTo(thing2))
1005 foreach (
Thing thing3
in this.owner.Container.things)
1007 if (thing3.invY != 1)
1012 thing3.SetSortVal(m, this.owner.currency);
1015 this.owner.Container.things.Sort(delegate(
Thing a,
Thing b)
1017 bool flag2 = this.IsShop ? EMono.player.pref.sort_ascending_shop :
EMono.player.pref.sort_ascending;
1018 if (m == UIList.SortMode.ByName)
1022 return string.Compare(a.GetName(NameStyle.FullNoArticle, 1), b.GetName(NameStyle.FullNoArticle, 1));
1024 return string.Compare(b.GetName(NameStyle.FullNoArticle, 1), a.GetName(NameStyle.FullNoArticle, 1));
1028 if (a.sortVal == b.sortVal)
1030 return b.SecondaryCompare(m, a);
1034 return a.sortVal - b.sortVal;
1036 return b.sortVal - a.sortVal;
1043 Vector2 sizeDelta = this.list.Rect().sizeDelta;
1046 foreach (
Thing thing4
in this.owner.Container.things)
1048 if (thing4.invY == 0)
1050 thing4.posInvX = num2 + 30;
1051 thing4.posInvY = (int)sizeDelta.y - num3 + 30;
1053 if ((
float)num2 > sizeDelta.x)
1057 if ((
float)num3 > sizeDelta.y)
1072 public void RefreshList()
1074 UIInventory.Mode mode = this.currentTab.mode;
1075 UIInventory.SubMode subMode = this.currentTab.subMode;
1082 if (this.destNum != 0)
1084 if (this.destNum != -1)
1086 int num = this.destNum;
1093 if (this.actionClick !=
null)
1095 this.actionClick(a);
1099 EMono.pc.HoldCard(a, -1);
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);
1114 b.SetCard(a,
ButtonGrid.Mode.Default, delegate(UINote n)
1116 UIInventory.Mode mode = mode;
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);
1125 if (flag && b.subText)
1127 b.subText.SetText((cost.ToString() ??
"").TagColorGoodBad(() => mode ==
UIInventory.Mode.Sell || cost <=
EMono.pc.GetCurrency(
this.IDCurrency),
false));
1130 onList = delegate(UIList.SortMode m)
1132 List<Thing> list =
new List<Thing>();
1133 foreach (
Thing thing
in this.owner.Things)
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)))
1141 UIList uilist = this.list;
1142 foreach (
Thing thing2
in list)
1144 num += thing2.ChildrenAndSelfWeight;
1145 this.list.Add(thing2);
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);
1152 this.list.callbacks = callbacks;
1153 this.list.List(
false);
1157 public void RefreshHighlight()
1159 if (!this.imageHighlight)
1163 this.imageHighlight.SetActive(
false);
1164 if (!
EMono.game.altInv)
1168 Thing thing =
EMono.player.currentHotItem.Thing;
1169 if (this.currentTab.mode ==
UIInventory.Mode.All && thing !=
null && !thing.isDestroyed)
1172 Card container = this.owner.Container;
1177 public void RefreshGrid()
1179 UIInventory.Mode mode = this.currentTab.mode;
1180 UIInventory.SubMode subMode = this.currentTab.subMode;
1183 GridLayoutGroup g = this.list.GetComponent<GridLayoutGroup>();
1184 ContentSizeFitter component = this.list.GetComponent<ContentSizeFitter>();
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);
1194 g.enabled = (component.enabled =
false);
1195 this.list.Rect().sizeDelta = style.sizeContainer;
1198 int maxCapacity = this.IsMagicChest ? this.owner.Container.things.MaxCapacity : 0;
1205 bool flag = i >= this.owner.Things.Count;
1206 if (this.IsMagicChest)
1208 flag = (this.uiMagic.page * this.uiMagic.GridSize + i >= maxCapacity);
1212 b.SetCardGrid(a, flag ?
null : this.owner);
1216 b.SetCardGrid(a, this.owner);
1219 b.Rect().anchoredPosition =
new Vector2((
float)a.posInvX, (
float)a.posInvY);
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;
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;
1233 b.image.raycastTarget =
true;
1235 onList = delegate(UIList.SortMode m)
1237 this.list.bgType = (this.UseGrid ? UIList.BGType.grid : UIList.BGType.none);
1238 if (this.list.bgGrid)
1240 this.list.bgGrid.SetActive(this.UseGrid);
1241 this.list.bgGrid.color = style.gridColor;
1242 if (this.window.saveData.color.a != 0)
1244 this.list.bgGrid.color = this.window.saveData.color;
1247 if (this.IsMagicChest)
1249 this.owner.Container.things.RefreshGrid(this.uiMagic, this.window.saveData);
1253 this.owner.Container.things.RefreshGrid();
1257 if (this.IsMagicChest)
1259 for (
int i = 0; i < this.owner.Container.things.GridSize; i++)
1261 this.list.Add(this.owner.Things[i]);
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++)
1270 this.list.Add((j < count) ? this.owner.Things[j] :
null);
1276 Vector2 sizeDelta2 = this.list.Rect().sizeDelta;
1277 foreach (
Thing thing2
in this.owner.Things)
1281 this.list.Add(thing2);
1282 if (thing2.posInvX == 0 && thing2.posInvY == 0)
1284 thing2.posInvX =
EMono.rnd((
int)sizeDelta2.x - 60) + 30;
1285 thing2.posInvY =
EMono.rnd((
int)sizeDelta2.y - 60) + 30;
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);
1296 this.list.callbacks = callback;
1297 this.list.onBeforeRedraw = delegate()
1299 if (this.IsMagicChest)
1301 if (this.firstMouseRightDown || (!Input.GetMouseButton(1) && !Input.GetKey(KeyCode.LeftShift) && !Input.GetKey(KeyCode.RightShift)))
1304 this.firstMouseRightDown =
false;
1305 this.owner.Container.things.RefreshGrid(this.uiMagic, this.window.saveData);
1310 this.owner.Container.things.RefreshGrid();
1315 UIList uilist = this.list;
1316 for (
int i = 0; i < uilist.buttons.Count; i++)
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;
1324 this.list.onAfterRedraw = delegate()
1326 if (!this.layer.floatInv)
1329 foreach (UIList.ButtonPair buttonPair in
this.list.buttons)
1334 num += thing2.ChildrenAndSelfWeight;
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);
1340 if (this.owner.Container.things.IsOverflowing())
1342 if (!this.transOverflow)
1344 this.transOverflow = Util.Instantiate(
"UI/Element/Other/InvOverflow", this.window.transform);
1347 else if (this.transOverflow)
1349 UnityEngine.Object.Destroy(this.transOverflow.gameObject);
1352 if (this.layer.mini)
1354 this.layer.mini.Refresh(this.layer.mini.window.idTab);
1358 this.uiMagic.OnAfterRedraw();
1361 callback.mold = (this.UseGrid ? this.moldButtonGrid : this.moldButtonGridless);
1362 if (!this.UseGrid && !this.window.saveData.firstSorted)
1364 Vector2 sizeDelta = this.list.Rect().sizeDelta;
1365 foreach (
Thing thing
in this.owner.Things)
1369 thing.posInvX =
EMono.rnd((
int)sizeDelta.x - 60) + 30;
1370 thing.posInvY =
EMono.rnd((
int)sizeDelta.y - 60) + 30;
1373 this.window.saveData.firstSorted =
true;
1375 this.list.List(
false);
1376 g.RebuildLayoutTo<Layer>();
1377 this.list.onAfterRedraw();
1378 if (this.list.bgGrid)
1380 this.list.bgGrid.color = style.gridColor;
1381 if (this.window.saveData.color.a != 0)
1383 this.list.bgGrid.color = this.window.saveData.color;
1386 if (this.owner ==
InvOwner.Trader &&
this.owner.UseGuide)
1402 public Transform headerRow;
1405 public Transform transOverflow;
1408 public string idMold;
1411 public Func<Thing, bool> funcList;
1414 public Action<Thing> actionClick;
1417 public Window window;
1420 public UIContent content;
1426 public AIAct currentAct;
1429 public UIInventory.InteractMode interactMode;
1432 public bool floatMode;
1444 public Image imageHighlight;
1447 public Image imageHighlightGrid;
1450 public UIButton moldSmallTab;
1459 public UIButton buttonTakeAll;
1465 private int destNum;
1468 private int lastNum;
1471 private bool firstMouseRightDown;
1477 public bool wasDirty;
1492 public UIInventory.Mode mode;
1565 public enum InteractMode
1585 public UIInventory.Mode mode;
1588 public UIInventory.SubMode subMode;
1591 public string textTab;
1594 public bool smallTab;