8 public override void OnInit()
10 this.list2.sortMode =
ELayer.player.pref.sortResources;
11 this.RefreshCategory();
18 this.list.Select(0,
true);
20 LayerResource.selectCat =
null;
21 WindowMenu menuRight = this.windows[0].menuRight;
22 menuRight.AddButton2Line(
"sort", () => this.list2.sortMode.ToString(), delegate(UIButton b)
24 this.list2.NextSort();
26 menuRight.AddButton2Line(
"stockCapacity", () =>
ELayer._map.Stocked.weight.ToString() +
"/" +
ELayer._map.Stocked.maxWeight.ToString(),
null,
null,
"2line");
30 public override void OnKill()
32 ELayer.player.pref.sortResources = this.list2.sortMode;
36 public void RefreshCategory()
38 HashSet<string> track =
ELayer.player.trackedCategories;
48 b.toggle.SetActive(
true);
49 b.toggle.isOn = track.Contains(cat.id);
50 b.toggle.onValueChanged.AddListener(delegate(
bool isOn)
63 int sum =
ELayer._map.Stocked.categoryMap[cat.id].sum;
64 b.mainText.text = cat.GetText(
"name",
false).ToTitleCase(
false) +
" (" + sum.ToString() +
")";
65 b.SetFold(cat.children.Count > 0,
true, delegate(UIList l)
69 if (row2.parent == cat)
80 if (!(row.id ==
"new") && !(row.id ==
"stash") && row.parent ==
null)
85 this.list.Refresh(
false);
92 HashSet<string> track =
ELayer.player.trackedCards;
98 bool check = track.Contains(a.source.id);
103 if (!track.Contains(a.source.id))
105 track.Add(a.source.id);
109 track.Remove(a.source.id);
112 this.list2.dsv.refresh();
115 onList = delegate(UIList.SortMode m)
117 List<Thing> list =
new List<Thing>();
118 list =
ELayer._map.Stocked.ListThingsInCategory(cat);
119 for (
int i = 0; i < list.Count; i++)
121 list[i].SetSortVal(m, CurrencyType.Money);
123 list.Sort((
Thing a,
Thing b) => a.sortVal - b.sortVal);
126 foreach (
Thing thing
in list)
128 this.list2.Add(thing);
132 this.windows[0].textStats.SetText(
"statsTotal".lang(list.Count.ToString() ??
"", num.ToString() ??
"", num2.ToString() ??
"",
null,
null));
142 public UIDynamicList list2;
148 public UINote noteOverview;
151 public static string selectCat;