Elin Modding Docs Doc
Loading...
Searching...
No Matches
ContentPopulation.cs
1using System;
2using System.Collections.Generic;
3using UnityEngine;
4
5// Token: 0x02000588 RID: 1416
7{
8 // Token: 0x06002707 RID: 9991 RVA: 0x000DD440 File Offset: 0x000DB640
9 public override void OnSwitchContent(int idTab)
10 {
11 ContentPopulation.Instance = this;
12 this.groupQueryTarget.Init(ContentPopulation.queryTarget, delegate(int a)
13 {
14 ContentPopulation.queryTarget = a;
15 this.Refresh();
16 }, false);
17 this.groupQueryType.Init(ContentPopulation.queryType, delegate(int a)
18 {
19 ContentPopulation.queryType = a;
20 this.Refresh();
21 }, false);
22 this.Refresh();
23 }
24
25 // Token: 0x06002708 RID: 9992 RVA: 0x000DD494 File Offset: 0x000DB694
26 public void Refresh()
27 {
28 this.list.Clear();
29 BaseList baseList = this.list;
30 UIList.Callback<ContentPopulation.Topic, ItemPopulation> callback = new UIList.Callback<ContentPopulation.Topic, ItemPopulation>();
31 callback.onInstantiate = delegate(ContentPopulation.Topic a, ItemPopulation b)
32 {
33 b.SetTopic(a);
34 };
35 callback.onSort = this.onSort;
36 baseList.callbacks = callback;
37 this.onSort = ((ContentPopulation.Topic t, UIList.SortMode m) => -this.list.items.IndexOf(t) + t.sortVal * 100);
38 this.topics = new Dictionary<string, ContentPopulation.Topic>();
39 List<Chara> list = EClass._map.ListChara((ContentPopulation.queryTarget == 0) ? EClass.Home : EClass.game.factions.Wilds);
40 switch (ContentPopulation.queryType)
41 {
42 case 0:
43 using (List<Chara>.Enumerator enumerator = list.GetEnumerator())
44 {
45 while (enumerator.MoveNext())
46 {
47 Chara chara = enumerator.Current;
48 if (chara.happiness > 70)
49 {
50 this.Add("happy".lang(), chara, 1, 10);
51 }
52 else if (chara.happiness > 30)
53 {
54 this.Add("normal".lang(), chara, 0, 5);
55 }
56 else
57 {
58 this.Add("unhappy".lang(), chara, 2, 0);
59 }
60 }
61 goto IL_287;
62 }
63 break;
64 case 1:
65 break;
66 case 2:
67 goto IL_177;
68 case 3:
69 goto IL_1B9;
70 case 4:
71 using (List<Chara>.Enumerator enumerator = list.GetEnumerator())
72 {
73 while (enumerator.MoveNext())
74 {
75 Chara c = enumerator.Current;
76 this.Add("querySingle".lang(), c, 2, 0);
77 }
78 goto IL_287;
79 }
80 goto IL_24D;
81 default:
82 goto IL_24D;
83 }
84 using (List<Chara>.Enumerator enumerator = list.GetEnumerator())
85 {
86 while (enumerator.MoveNext())
87 {
88 Chara c2 = enumerator.Current;
89 this.Add("noJob".lang(), c2, 2, 0);
90 }
91 goto IL_287;
92 }
93 IL_177:
94 using (List<Chara>.Enumerator enumerator = list.GetEnumerator())
95 {
96 while (enumerator.MoveNext())
97 {
98 Chara c3 = enumerator.Current;
99 this.Add("houseless".lang(), c3, 2, 0);
100 }
101 goto IL_287;
102 }
103 IL_1B9:
104 foreach (Chara chara2 in list)
105 {
106 this.Add(chara2.faith.Name, chara2, 1, 0);
107 }
108 this.onSort = ((ContentPopulation.Topic t, UIList.SortMode m) => t.list.Count * 1000 - this.list.items.IndexOf(t));
109 goto IL_287;
110 IL_24D:
111 foreach (Chara c4 in list)
112 {
113 this.Add("test", c4, 1, 0);
114 }
115 IL_287:
116 this.list.Refresh(false);
117 this.RebuildLayout(true);
118 }
119
120 // Token: 0x06002709 RID: 9993 RVA: 0x000DD788 File Offset: 0x000DB988
121 public void Add(string idTopic, Chara c, int color = 1, int sortVal = 0)
122 {
123 ContentPopulation.Topic topic = this.topics.TryGetValue(idTopic, null);
124 if (topic == null)
125 {
126 topic = new ContentPopulation.Topic
127 {
128 header = idTopic,
129 color = color,
130 sortVal = sortVal
131 };
132 this.topics.Add(idTopic, topic);
133 this.list.Add(topic);
134 }
135 topic.list.Add(c);
136 }
137
138 // Token: 0x0400158F RID: 5519
139 public static ContentPopulation Instance;
140
141 // Token: 0x04001590 RID: 5520
142 public static int queryTarget;
143
144 // Token: 0x04001591 RID: 5521
145 public static int queryType;
146
147 // Token: 0x04001592 RID: 5522
148 public Color[] colors;
149
150 // Token: 0x04001593 RID: 5523
151 public UIList list;
152
153 // Token: 0x04001594 RID: 5524
154 public UISelectableGroup groupQueryTarget;
155
156 // Token: 0x04001595 RID: 5525
157 public UISelectableGroup groupQueryType;
158
159 // Token: 0x04001596 RID: 5526
160 public Dictionary<string, ContentPopulation.Topic> topics;
161
162 // Token: 0x04001597 RID: 5527
163 public Func<ContentPopulation.Topic, UIList.SortMode, int> onSort;
164
165 // Token: 0x02000ACF RID: 2767
166 public class Topic
167 {
168 // Token: 0x04002BFD RID: 11261
169 public string header;
170
171 // Token: 0x04002BFE RID: 11262
172 public List<Chara> list = new List<Chara>();
173
174 // Token: 0x04002BFF RID: 11263
175 public int color;
176
177 // Token: 0x04002C00 RID: 11264
178 public int sortVal;
179 }
180}
Definition Chara.cs:12