Elin Modding Docs Doc
Loading...
Searching...
No Matches
WidgetEquip.cs
1using System;
2using UnityEngine;
3using UnityEngine.UI;
4
5// Token: 0x020005FB RID: 1531
6public class WidgetEquip : Widget
7{
8 // Token: 0x06002A69 RID: 10857 RVA: 0x000EF14D File Offset: 0x000ED34D
9 public static void SetDirty()
10 {
11 WidgetEquip.dirty = true;
12 }
13
14 // Token: 0x06002A6A RID: 10858 RVA: 0x000EF158 File Offset: 0x000ED358
15 public override void OnActivate()
16 {
17 this.chara = EMono.pc;
18 WidgetEquip.Instance = this;
19 foreach (Thing thing in EMono.pc.things)
20 {
21 if (thing.trait is TraitToolBelt)
22 {
23 base.AddLayer(LayerInventory.CreateContainer(thing), this.transLayer);
24 }
25 }
26 this.Rebuild();
27 }
28
29 // Token: 0x06002A6B RID: 10859 RVA: 0x000EF1E0 File Offset: 0x000ED3E0
30 public void Rebuild()
31 {
32 this.RefreshEquipment(this.listMain, false);
33 this.RefreshEquipment(this.listEtc, true);
34 WidgetEquip.dirty = true;
35 this.RebuildLayout(true);
36 }
37
38 // Token: 0x06002A6C RID: 10860 RVA: 0x000EF209 File Offset: 0x000ED409
39 public void CheckDirty()
40 {
41 if (WidgetEquip.dirty)
42 {
43 this._Redraw();
44 }
45 }
46
47 // Token: 0x06002A6D RID: 10861 RVA: 0x000EF218 File Offset: 0x000ED418
48 public static void Redraw()
49 {
50 if (WidgetEquip.Instance)
51 {
52 WidgetEquip.Instance._Redraw();
53 }
54 }
55
56 // Token: 0x06002A6E RID: 10862 RVA: 0x000EF230 File Offset: 0x000ED430
57 public void _Redraw()
58 {
59 WidgetEquip.dirty = false;
60 this.listMain.Redraw();
61 this.listEtc.Redraw();
62 }
63
64 // Token: 0x06002A6F RID: 10863 RVA: 0x000EF250 File Offset: 0x000ED450
65 public void RefreshEquipment(UIList list, bool etc = false)
66 {
67 list.Clear();
68 BaseList list2 = list;
69 UIList.Callback<BodySlot, ButtonGridDrag> callback = new UIList.Callback<BodySlot, ButtonGridDrag>();
70 callback.onInstantiate = delegate(BodySlot a, ButtonGridDrag b)
71 {
72 b.SetBodySlot(a, new InvOwnerEquip(this.chara, a, null, CurrencyType.None));
73 };
74 callback.onRedraw = delegate(BodySlot a, ButtonGridDrag b, int i)
75 {
76 b.SetBodySlot(a, new InvOwnerEquip(this.chara, a, null, CurrencyType.None));
77 };
78 callback.onSort = ((BodySlot a, UIList.SortMode b) => -a.element.sort);
79 callback.onList = delegate(UIList.SortMode m)
80 {
81 int num = 0;
82 foreach (BodySlot bodySlot in this.chara.body.slots)
83 {
84 if (bodySlot.elementId != 44)
85 {
86 if (bodySlot.elementId == 36 || bodySlot.elementId == 31 || bodySlot.elementId == 45)
87 {
88 if (!etc)
89 {
90 continue;
91 }
92 }
93 else if (etc)
94 {
95 continue;
96 }
97 list.Add(bodySlot);
98 num++;
99 }
100 }
101 if (list == this.listMain)
102 {
103 this.grid.constraintCount = num / 12 + 1;
104 }
105 };
106 list2.callbacks = callback;
107 list.onAfterRedraw = delegate()
108 {
109 LayerInventory.TryShowGuide(list);
110 };
111 list.sortMode = UIList.SortMode.ByNumber;
112 list.List(false);
113 }
114
115 // Token: 0x06002A70 RID: 10864 RVA: 0x000EF320 File Offset: 0x000ED520
116 public override bool CanShowContextMenu()
117 {
118 ButtonGrid componentOf = InputModuleEX.GetComponentOf<ButtonGrid>();
119 return (!componentOf || componentOf.card == null) && base.CanShowContextMenu();
120 }
121
122 // Token: 0x040017EC RID: 6124
123 public static WidgetEquip Instance;
124
125 // Token: 0x040017ED RID: 6125
126 public static bool dirty;
127
128 // Token: 0x040017EE RID: 6126
129 public static Thing dragEquip;
130
131 // Token: 0x040017EF RID: 6127
132 public UIList listMain;
133
134 // Token: 0x040017F0 RID: 6128
135 public UIList listEtc;
136
137 // Token: 0x040017F1 RID: 6129
138 public Chara chara;
139
140 // Token: 0x040017F2 RID: 6130
141 public RectTransform transLayer;
142
143 // Token: 0x040017F3 RID: 6131
144 public GridLayoutGroup grid;
145}
Definition Chara.cs:12
Definition EMono.cs:6
Definition Thing.cs:10