Elin Decompiled Documentation EA 23.130 Nightly
Loading...
Searching...
No Matches
UIDragGridIngredients.cs
Go to the documentation of this file.
1using System.Collections.Generic;
2using UnityEngine;
3
5{
7
8 public UIList list;
9
11
12 public GameObject goList;
13
14 public void Update()
15 {
16 bool activeSelf = goList.activeSelf;
17 bool flag = EMono.pc.ai.IsNoGoal || !EMono.pc.ai.IsRunning;
18 goList.SetActive(flag);
19 if (activeSelf != flag)
20 {
21 Refresh();
22 }
24 {
25 return;
26 }
27 ButtonGrid componentOf = InputModuleEX.GetComponentOf<ButtonGrid>();
28 if ((bool)componentOf && (bool)componentOf.GetComponentInParent<UIDragGridIngredients>())
29 {
30 Thing t = componentOf.card.Thing;
31 Thing container = t.parent as Thing;
32 t.ShowSplitMenu2(componentOf, "actPutIn", delegate(int n)
33 {
34 Thing t2 = t.Split(n);
35 t2 = EMono.pc.Pick(t2, msg: true, tryStack: false);
36 int currentIndex = layer.currentIndex;
37 layer.AddPutBack(t2, container);
38 layer.buttons[currentIndex].SetCardGrid(t2, layer.owner);
40 });
41 }
42 }
43
44 public void Refresh()
45 {
46 List<Thing> list = new List<Thing>();
48 {
49 foreach (Thing thing in EMono._map.Stocked.Things)
50 {
52 {
53 Window.SaveData windowSaveData = thing.parentCard.GetWindowSaveData();
54 if (windowSaveData == null || !windowSaveData.excludeCraft)
55 {
56 list.Add(thing);
57 }
58 }
59 }
60 list.Sort(UIList.SortMode.ByCategory);
61 }
62 this.list.callbacks = new UIList.Callback<Thing, ButtonGrid>
63 {
64 onClick = delegate(Thing a, ButtonGrid b)
65 {
66 int currentIndex = layer.currentIndex;
67 layer.buttons[currentIndex].SetCardGrid(a, layer.owner);
70 },
71 onInstantiate = delegate(Thing a, ButtonGrid b)
72 {
73 b.SetCard(a, ButtonGrid.Mode.Grid);
74 b.SetOnClick(delegate
75 {
76 });
77 b.onRightClick = delegate
78 {
79 this.list.callbacks.OnClick(a, b);
80 };
81 }
82 };
83 this.list.Clear();
84 foreach (Thing item in list)
85 {
86 this.list.Add(item);
87 }
88 this.list.Refresh();
89 }
90}
virtual bool IsRunning
Definition: AIAct.cs:31
Card card
Definition: ButtonGrid.cs:24
void SetCard(Card c, Mode mode=Mode.Default, Action< UINote > onWriteNote=null)
Definition: ButtonGrid.cs:184
Thing Split(int a)
Definition: Card.cs:3275
ICardParent parent
Definition: Card.cs:51
Window.SaveData GetWindowSaveData()
Definition: Card.cs:2416
virtual Thing Thing
Definition: Card.cs:1958
Card parentCard
Definition: Card.cs:99
bool c_isDisableStockUse
Definition: Card.cs:1044
AIAct ai
Definition: Chara.cs:192
Thing Pick(Thing t, bool msg=true, bool tryStack=true)
Definition: Chara.cs:3940
Definition: EInput.cs:8
static ButtonState middleMouse
Definition: EInput.cs:353
Definition: EMono.cs:4
static Chara pc
Definition: EMono.cs:13
static Map _map
Definition: EMono.cs:17
virtual bool AllowStockIngredients
sealed override void OnProcess(Thing t)
Card owner
Definition: InvOwner.cs:538
virtual bool ShouldShowGuide(Thing t)
Definition: InvOwner.cs:686
void AddPutBack(Thing t, Thing container)
InvOwnerDraglet owner
List< ButtonGrid > buttons
PropsStocked Stocked
Definition: Map.cs:121
List< Thing > Things
Definition: Props.cs:37
bool ShouldListAsResource(Thing t)
Definition: Props.cs:174
Definition: Thing.cs:8
void ShowSplitMenu2(ButtonGrid button, string lang, Action< int > onSplit=null)
Definition: Thing.cs:1799
Definition: UIList.cs:9
SortMode
Definition: UIList.cs:27
override void Add(object item)
Definition: UIList.cs:302
void Sort()
Definition: UIList.cs:697
bool excludeCraft
Definition: Window.cs:379