Elin Modding Docs Doc
All Classes Namespaces
UIDragGridInfo.cs
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using UnityEngine;
5using UnityEngine.UI;
6
7// Token: 0x0200057D RID: 1405
8public class UIDragGridInfo : EMono
9{
10 // Token: 0x06002698 RID: 9880 RVA: 0x000DA0C4 File Offset: 0x000D82C4
11 private void Awake()
12 {
13 this.window.SetActive(false);
14 this.transMold.SetActive(false);
15 }
16
17 // Token: 0x06002699 RID: 9881 RVA: 0x000DA0DE File Offset: 0x000D82DE
18 public void Refresh()
19 {
20 this.Init(this.owner);
21 }
22
23 // Token: 0x0600269A RID: 9882 RVA: 0x000DA0EC File Offset: 0x000D82EC
24 public void Init(Card _owner)
25 {
26 this.owner = _owner;
27 TraitCrafter crafter = this.owner.trait as TraitCrafter;
28 if (crafter == null)
29 {
30 return;
31 }
32 this.textHeader.text = "knownRecipe".lang();
33 List<SourceRecipe.Row> recipes = (from r in EMono.sources.recipes.rows
34 where r.factory == crafter.IdSource
35 select r).ToList<SourceRecipe.Row>();
36 if (recipes.Count == 0)
37 {
38 return;
39 }
40 BaseList baseList = this.list;
41 UIList.Callback<SourceRecipe.Row, LayoutGroup> callback = new UIList.Callback<SourceRecipe.Row, LayoutGroup>();
42 callback.onClick = delegate(SourceRecipe.Row a, LayoutGroup b)
43 {
44 };
45 callback.onInstantiate = delegate(SourceRecipe.Row a, LayoutGroup b)
46 {
47 UIDragGridInfo.<>c__DisplayClass13_1 CS$<>8__locals2;
48 CS$<>8__locals2.b = b;
49 for (int i = 0; i < crafter.numIng; i++)
50 {
51 if (i != 0)
52 {
53 Util.Instantiate<Transform>(this.moldPlus, CS$<>8__locals2.b);
54 }
55 string[] array = (i == 0) ? a.ing1 : ((i == 1) ? a.ing2 : a.ing3);
56 if (array.IsEmpty())
57 {
58 break;
59 }
60 foreach (string text in array)
61 {
62 if (text != array[0])
63 {
64 Util.Instantiate<Transform>(this.moldOr, CS$<>8__locals2.b);
65 }
66 base.<Init>g__AddThing|4(text, ref CS$<>8__locals2);
67 }
68 }
69 Util.Instantiate<Transform>(this.moldEqual, CS$<>8__locals2.b);
70 base.<Init>g__AddThing|4(a.thing, ref CS$<>8__locals2);
71 };
72 callback.onList = delegate(UIList.SortMode m)
73 {
74 foreach (SourceRecipe.Row row in recipes)
75 {
76 if (row.tag.Contains("known") || EMono.player.knownCraft.Contains(row.id) || EMono.debug.godCraft)
77 {
78 this.list.Add(row);
79 }
80 }
81 };
82 baseList.callbacks = callback;
83 this.list.List(false);
84 this.window.SetActive(true);
85 this.window.RebuildLayout(true);
86 }
87
88 // Token: 0x0600269B RID: 9883 RVA: 0x000DA1F8 File Offset: 0x000D83F8
89 public void InitFuel(Card _owner)
90 {
91 this.owner = _owner;
92 this.textHeader.text = "knownFuel".lang();
93 List<SourceThing.Row> fuels = new List<SourceThing.Row>();
94 foreach (SourceThing.Row row in EMono.sources.things.rows)
95 {
96 if (this.owner.trait.IsFuel(row.id))
97 {
98 fuels.Add(row);
99 }
100 }
101 BaseList baseList = this.list;
102 UIList.Callback<SourceThing.Row, LayoutGroup> callback = new UIList.Callback<SourceThing.Row, LayoutGroup>();
103 callback.onClick = delegate(SourceThing.Row a, LayoutGroup b)
104 {
105 };
106 callback.onInstantiate = delegate(SourceThing.Row a, LayoutGroup b)
107 {
108 UIDragGridInfo.<>c__DisplayClass14_1 CS$<>8__locals2;
109 CS$<>8__locals2.b = b;
110 base.<InitFuel>g__AddThing|3(a.id, ref CS$<>8__locals2);
111 Util.Instantiate<Transform>(this.moldEqual, CS$<>8__locals2.b);
112 base.<InitFuel>g__AddThing|3(this.owner.id, ref CS$<>8__locals2);
113 };
114 callback.onList = delegate(UIList.SortMode m)
115 {
116 foreach (SourceThing.Row o in fuels)
117 {
118 this.list.Add(o);
119 }
120 };
121 baseList.callbacks = callback;
122 this.list.List(false);
123 this.window.SetActive(true);
124 this.window.RebuildLayout(true);
125 }
126
127 // Token: 0x04001522 RID: 5410
128 public Window window;
129
130 // Token: 0x04001523 RID: 5411
131 public UIText textHeader;
132
133 // Token: 0x04001524 RID: 5412
134 public Transform transMold;
135
136 // Token: 0x04001525 RID: 5413
137 public Transform moldThing;
138
139 // Token: 0x04001526 RID: 5414
140 public Transform moldPlus;
141
142 // Token: 0x04001527 RID: 5415
143 public Transform moldEqual;
144
145 // Token: 0x04001528 RID: 5416
146 public Transform moldOr;
147
148 // Token: 0x04001529 RID: 5417
149 public Transform moldCat;
150
151 // Token: 0x0400152A RID: 5418
152 public Transform moldUnknown;
153
154 // Token: 0x0400152B RID: 5419
155 public UIList list;
156
157 // Token: 0x0400152C RID: 5420
158 public Card owner;
159}
Definition Card.cs:13
Definition EMono.cs:6