Elin Modding Docs Doc
Loading...
Searching...
No Matches
WidgetDate.cs
1using System;
2using System.Collections.Generic;
3using UnityEngine;
4using UnityEngine.UI;
5
6// Token: 0x020005F9 RID: 1529
7public class WidgetDate : Widget
8{
9 // Token: 0x06002A52 RID: 10834 RVA: 0x000EE25A File Offset: 0x000EC45A
10 public override object CreateExtra()
11 {
12 return new WidgetDate.Extra();
13 }
14
15 // Token: 0x17000C20 RID: 3104
16 // (get) Token: 0x06002A53 RID: 10835 RVA: 0x000EE261 File Offset: 0x000EC461
17 public WidgetDate.Extra extra
18 {
19 get
20 {
21 return base.config.extra as WidgetDate.Extra;
22 }
23 }
24
25 // Token: 0x06002A54 RID: 10836 RVA: 0x000EE273 File Offset: 0x000EC473
26 public override void OnActivate()
27 {
28 WidgetDate.Instance = this;
29 this._Refresh();
30 base.InvokeRepeating("_Refresh", 0.1f, 0.1f);
31 }
32
33 // Token: 0x06002A55 RID: 10837 RVA: 0x000EE298 File Offset: 0x000EC498
34 public void _Refresh()
35 {
36 if (EMono.game.activeZone == null)
37 {
38 return;
39 }
40 string text = "";
41 GameDate date = EMono.world.date;
42 text += (this.extra.date ? EMono.world.date.GetText(Date.TextFormat.Widget) : "");
43 if (this.extra.period)
44 {
45 text = text + " (" + EMono.world.date.periodOfDay.ToString().lang() + ") ";
46 }
47 text += (this.extra.realDate ? (" (" + DateTime.Now.ToString("H:mm") + ") ") : "");
48 if (this.extra.loc)
49 {
50 text = text + " " + EMono._zone.NameWithLevel;
51 if (EMono._zone.isClaimable && !EMono._zone.IsPCFaction)
52 {
53 text += "(";
54 List<Element> list = EMono._zone.ListLandFeats();
55 foreach (Element element in list)
56 {
57 if (element != list[0])
58 {
59 text += ", ";
60 }
61 text += element.Name;
62 }
63 text += ")";
64 }
65 }
66 if (EMono._zone.idCurrentSubset != null)
67 {
68 text += ("(" + (EMono._zone.idExport + "_" + EMono._zone.idCurrentSubset).lang() + ")").TagColor(this.colorFestival);
69 }
70 if (EMono.debug.showExtra)
71 {
72 text = string.Concat(new string[]
73 {
74 text,
75 " (",
76 EMono._zone.biome.name,
77 "/Lv:",
78 EMono._zone.lv.ToString(),
79 "/Danger:",
80 EMono._zone.DangerLv.ToString(),
81 "/_danger:",
82 EMono._zone._dangerLv.ToString(),
83 "/elec:",
84 EMono._zone.electricity.ToString(),
85 ")"
86 });
87 if (EMono._zone.IsInstance)
88 {
89 text += "Instance";
90 }
91 }
92 if (this.extra.weather)
93 {
94 text = text + " - " + EMono.world.weather.GetName();
95 }
96 if (this.extra.room && EMono.pc.IsInActiveZone && EMono._zone.IsPCFaction)
97 {
98 Room room = EMono.pc.Cell.room;
99 if (room != null)
100 {
101 text = text + " (" + room.Name + ")";
102 }
103 if (EMono.pc.pos.area != null)
104 {
105 text = text + " (" + EMono.pc.pos.area.Name + ")";
106 }
107 }
108 text += EMono._zone.TextWidgetDate;
109 foreach (ZoneEvent zoneEvent in EMono._zone.events.list)
110 {
111 text += zoneEvent.TextWidgetDate;
112 }
113 this.textTime.text = text;
114 this.rectClock.SetActive(this.extra.clock);
115 if (this.extra.clock)
116 {
117 this.imageHour.transform.localEulerAngles = new Vector3(0f, 0f, (float)(-(float)date.hour * 30 + 90));
118 }
119 float num = base.transform.position.x / (float)Screen.width;
120 bool flag = base.config.pivot == RectPosition.BottomRIGHT || base.config.pivot == RectPosition.TopRIGHT || base.config.pivot == RectPosition.Right;
121 this.Rect().SetPivot((float)(flag ? 1 : 0), 0f);
122 this.rectClock.SetAnchor((float)(flag ? 1 : 0), 1f, (float)(flag ? 1 : 0), 1f);
123 this.rectClock.anchoredPosition = new Vector2((float)(flag ? -60 : 60), -75f);
124 this.textTime.RebuildLayout(false);
125 }
126
127 // Token: 0x06002A56 RID: 10838 RVA: 0x000EE778 File Offset: 0x000EC978
128 public override void OnChangePivot()
129 {
130 this._Refresh();
131 }
132
133 // Token: 0x06002A57 RID: 10839 RVA: 0x000EE780 File Offset: 0x000EC980
134 public static void Refresh()
135 {
136 if (WidgetDate.Instance)
137 {
138 WidgetDate.Instance._Refresh();
139 }
140 }
141
142 // Token: 0x06002A58 RID: 10840 RVA: 0x000EE798 File Offset: 0x000EC998
143 public override void OnSetContextMenu(UIContextMenu m)
144 {
145 UIContextMenu uicontextMenu = m.AddChild("setting");
146 uicontextMenu.AddToggle("showPeriodOfDay", this.extra.period, delegate(bool a)
147 {
148 this.extra.period = a;
149 this._Refresh();
150 });
151 uicontextMenu.AddToggle("showRealDate", this.extra.realDate, delegate(bool a)
152 {
153 this.extra.realDate = a;
154 this._Refresh();
155 });
156 uicontextMenu.AddToggle("showRoom", this.extra.room, delegate(bool a)
157 {
158 this.extra.room = a;
159 this._Refresh();
160 });
161 uicontextMenu.AddToggle("showClock", this.extra.clock, delegate(bool a)
162 {
163 this.extra.clock = a;
164 this._Refresh();
165 });
166 uicontextMenu.AddToggle("showLoc", this.extra.loc, delegate(bool a)
167 {
168 this.extra.loc = a;
169 this._Refresh();
170 });
171 uicontextMenu.AddToggle("showWeather", this.extra.weather, delegate(bool a)
172 {
173 this.extra.weather = a;
174 this._Refresh();
175 });
176 base.SetBaseContextMenu(m);
177 }
178
179 // Token: 0x040017DD RID: 6109
180 public static WidgetDate Instance;
181
182 // Token: 0x040017DE RID: 6110
183 public Text textTime;
184
185 // Token: 0x040017DF RID: 6111
186 public Text textLevel;
187
188 // Token: 0x040017E0 RID: 6112
189 public RectTransform rectClock;
190
191 // Token: 0x040017E1 RID: 6113
192 public Image imageHour;
193
194 // Token: 0x040017E2 RID: 6114
195 public Color colorFestival;
196
197 // Token: 0x02000B69 RID: 2921
198 public class Extra
199 {
200 // Token: 0x04002DD1 RID: 11729
201 public bool date;
202
203 // Token: 0x04002DD2 RID: 11730
204 public bool realDate;
205
206 // Token: 0x04002DD3 RID: 11731
207 public bool period;
208
209 // Token: 0x04002DD4 RID: 11732
210 public bool room;
211
212 // Token: 0x04002DD5 RID: 11733
213 public bool clock;
214
215 // Token: 0x04002DD6 RID: 11734
216 public bool loc;
217
218 // Token: 0x04002DD7 RID: 11735
219 public bool weather;
220 }
221}
Definition Date.cs:6
Definition EMono.cs:6
Definition Room.cs:6