Elin Decompiled Documentation EA 23.355 Stable
Loading...
Searching...
No Matches
UIDragGridIngredients.cs
Go to the documentation of this file.
1using System.Collections.Generic;
2using System.Linq;
3using UnityEngine;
4
6{
8
9 public UIList list;
10
12
13 public GameObject goList;
14
15 public void Update()
16 {
17 bool activeSelf = goList.activeSelf;
18 bool flag = EMono.pc.ai.IsNoGoal || !EMono.pc.ai.IsRunning;
19 goList.SetActive(flag);
20 if (activeSelf != flag && flag)
21 {
22 Refresh();
23 }
25 {
26 return;
27 }
28 ButtonGrid componentOf = InputModuleEX.GetComponentOf<ButtonGrid>();
29 if ((bool)componentOf && (bool)componentOf.GetComponentInParent<UIDragGridIngredients>())
30 {
31 Thing t = componentOf.card.Thing;
32 Thing container = t.parent as Thing;
33 t.ShowSplitMenu2(componentOf, "actPutIn", delegate(int n)
34 {
35 Thing t2 = t.Split(n);
36 t2 = EMono.pc.Pick(t2, msg: true, tryStack: false);
37 int currentIndex = layer.currentIndex;
38 layer.AddPutBack(t2, container);
39 layer.buttons[currentIndex].SetCardGrid(t2, layer.owner);
41 });
42 }
43 }
44
45 public void Refresh()
46 {
47 List<Thing> list = new List<Thing>();
49 {
50 foreach (Thing thing in EMono._map.Stocked.Things)
51 {
53 {
54 Window.SaveData windowSaveData = thing.parentCard.GetWindowSaveData();
55 if (windowSaveData == null || !windowSaveData.excludeCraft)
56 {
57 list.Add(thing);
58 }
59 }
60 }
61 list.Sort(UIList.SortMode.ByCategory);
62 }
63 if (this.list.buttons.Count > 0 && this.list.items.SequenceEqual(list))
64 {
65 this.list.Redraw();
66 return;
67 }
68 this.list.callbacks = new UIList.Callback<Thing, ButtonGrid>
69 {
70 onClick = delegate(Thing a, ButtonGrid b)
71 {
72 int currentIndex = layer.currentIndex;
73 layer.buttons[currentIndex].SetCardGrid(a, layer.owner);
76 },
77 onInstantiate = delegate(Thing a, ButtonGrid b)
78 {
79 b.SetOnClick(delegate
80 {
81 });
82 b.onRightClick = delegate
83 {
84 this.list.callbacks.OnClick(a, b);
85 };
86 },
87 onRedraw = delegate(Thing a, ButtonGrid b, int i)
88 {
89 b.SetCard(a, ButtonGrid.Mode.Grid);
90 }
91 };
92 this.list.Clear();
93 foreach (Thing item in list)
94 {
95 this.list.Add(item);
96 }
97 this.list.Refresh();
98 }
99}
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:3665
ICardParent parent
Definition: Card.cs:56
Window.SaveData GetWindowSaveData()
Definition: Card.cs:2649
virtual Thing Thing
Definition: Card.cs:2110
Card parentCard
Definition: Card.cs:106
bool c_isDisableStockUse
Definition: Card.cs:1111
AIAct ai
Definition: Chara.cs:208
Thing Pick(Thing t, bool msg=true, bool tryStack=true)
Definition: Chara.cs:4612
Definition: EInput.cs:8
static ButtonState middleMouse
Definition: EInput.cs:364
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:533
virtual bool ShouldShowGuide(Thing t)
Definition: InvOwner.cs:688
void AddPutBack(Thing t, Thing container)
InvOwnerDraglet owner
List< ButtonGrid > buttons
PropsStocked Stocked
Definition: Map.cs:126
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:1972
Definition: UIList.cs:9
SortMode
Definition: UIList.cs:27
override void Add(object item)
Definition: UIList.cs:357
void Sort()
Definition: UIList.cs:753
bool excludeCraft
Definition: Window.cs:379