private static void DrawStatsWorker(Rect rect, Thing optionalThing, WorldObject optionalWorldObject) { Rect rect2 = new Rect(rect); rect2.width *= 0.5f; Rect rect3 = new Rect(rect); rect3.x = rect2.xMax; rect3.width = rect.xMax - rect3.x; Text.Font = GameFont.Small; Rect viewRect = new Rect(0f, 0f, rect2.width - 16f, listHeight); Widgets.BeginScrollView(rect2, ref scrollPosition, viewRect); float curY = 0f; string b = null; mousedOverEntry = null; for (int i = 0; i < cachedDrawEntries.Count; i++) { StatDrawEntry ent = cachedDrawEntries[i]; if (ent.category.LabelCap != b) { Widgets.ListSeparator(ref curY, viewRect.width, ent.category.LabelCap); b = ent.category.LabelCap; } curY += ent.Draw(8f, curY, viewRect.width - 8f, selectedEntry == ent, delegate { SelectEntry(ent); }, delegate { mousedOverEntry = ent; }, scrollPosition, rect2); } listHeight = curY + 100f; Widgets.EndScrollView(); Rect rect4 = rect3.ContractedBy(10f); GUI.BeginGroup(rect4); StatDrawEntry statDrawEntry = selectedEntry ?? mousedOverEntry ?? cachedDrawEntries.FirstOrDefault(); if (statDrawEntry != null) { StatRequest optionalReq = statDrawEntry.hasOptionalReq ? statDrawEntry.optionalReq : ((optionalThing == null) ? StatRequest.ForEmpty() : StatRequest.For(optionalThing)); string explanationText = statDrawEntry.GetExplanationText(optionalReq); Rect rect5 = rect4.AtZero(); Widgets.Label(rect5, explanationText); } GUI.EndGroup(); }
private static void DrawStatsWorker(Rect rect, Thing optionalThing, WorldObject optionalWorldObject) { Rect rect2 = new Rect(rect); rect2.width *= 0.5f; Rect rect3 = new Rect(rect); rect3.x = rect2.xMax; rect3.width = rect.xMax - rect3.x; Text.Font = GameFont.Small; Rect viewRect = new Rect(0f, 0f, rect2.width - 16f, listHeight); Widgets.BeginScrollView(rect2, ref scrollPosition, viewRect); float curY = 0f; string b = null; mousedOverEntry = null; for (int i = 0; i < cachedDrawEntries.Count; i++) { StatDrawEntry ent = cachedDrawEntries[i]; if ((string)ent.category.LabelCap != b) { Widgets.ListSeparator(ref curY, viewRect.width, ent.category.LabelCap); b = ent.category.LabelCap; } curY += ent.Draw(8f, curY, viewRect.width - 8f, selectedEntry == ent, delegate { SelectEntry(ent); }, delegate { mousedOverEntry = ent; }, scrollPosition, rect2); } listHeight = curY + 100f; Widgets.EndScrollView(); Rect outRect = rect3.ContractedBy(10f); StatDrawEntry statDrawEntry = selectedEntry ?? mousedOverEntry ?? cachedDrawEntries.FirstOrDefault(); if (statDrawEntry != null) { Rect rect4 = new Rect(0f, 0f, outRect.width - 16f, rightPanelHeight); StatRequest statRequest = statDrawEntry.hasOptionalReq ? statDrawEntry.optionalReq : ((optionalThing == null) ? StatRequest.ForEmpty() : StatRequest.For(optionalThing)); string explanationText = statDrawEntry.GetExplanationText(statRequest); float num = 0f; Widgets.BeginScrollView(outRect, ref scrollPositionRightPanel, rect4); Rect rect5 = rect4; rect5.width -= 4f; Widgets.Label(rect5, explanationText); float num2 = Text.CalcHeight(explanationText, rect5.width) + 10f; num += num2; IEnumerable <Dialog_InfoCard.Hyperlink> hyperlinks = statDrawEntry.GetHyperlinks(statRequest); if (hyperlinks != null) { Rect rect6 = new Rect(rect5.x, rect5.y + num2, rect5.width, rect5.height - num2); Color color = GUI.color; GUI.color = Widgets.NormalOptionColor; foreach (Dialog_InfoCard.Hyperlink item in hyperlinks) { float num3 = Text.CalcHeight(item.Label, rect6.width); Widgets.HyperlinkWithIcon(new Rect(rect6.x, rect6.y, rect6.width, num3), item, "ViewHyperlink".Translate(item.Label)); rect6.y += num3; rect6.height -= num3; num += num3; } GUI.color = color; } rightPanelHeight = num; Widgets.EndScrollView(); } }
private static void DrawStatsWorker(Rect rect, Thing optionalThing, WorldObject optionalWorldObject) { Rect rect2 = new Rect(rect); rect2.width *= 0.5f; Rect rect3 = new Rect(rect); rect3.x = rect2.xMax; rect3.width = rect.xMax - rect3.x; Text.Font = GameFont.Small; Rect viewRect = new Rect(0f, 0f, rect2.width - 16f, StatsReportUtility.listHeight); Widgets.BeginScrollView(rect2, ref StatsReportUtility.scrollPosition, viewRect, true); float num = 0f; string b = null; StatsReportUtility.mousedOverEntry = null; for (int i = 0; i < StatsReportUtility.cachedDrawEntries.Count; i++) { StatDrawEntry ent = StatsReportUtility.cachedDrawEntries[i]; if (ent.category.LabelCap != b) { Widgets.ListSeparator(ref num, viewRect.width, ent.category.LabelCap); b = ent.category.LabelCap; } num += ent.Draw(8f, num, viewRect.width - 8f, StatsReportUtility.selectedEntry == ent, delegate { StatsReportUtility.SelectEntry(ent, true); }, delegate { StatsReportUtility.mousedOverEntry = ent; }, StatsReportUtility.scrollPosition, rect2); } StatsReportUtility.listHeight = num + 100f; Widgets.EndScrollView(); Rect rect4 = rect3.ContractedBy(10f); GUI.BeginGroup(rect4); StatDrawEntry statDrawEntry; if ((statDrawEntry = StatsReportUtility.selectedEntry) == null) { statDrawEntry = (StatsReportUtility.mousedOverEntry ?? StatsReportUtility.cachedDrawEntries.FirstOrDefault <StatDrawEntry>()); } StatDrawEntry statDrawEntry2 = statDrawEntry; if (statDrawEntry2 != null) { StatRequest optionalReq; if (statDrawEntry2.hasOptionalReq) { optionalReq = statDrawEntry2.optionalReq; } else if (optionalThing != null) { optionalReq = StatRequest.For(optionalThing); } else { optionalReq = StatRequest.ForEmpty(); } string explanationText = statDrawEntry2.GetExplanationText(optionalReq); Rect rect5 = rect4.AtZero(); Widgets.Label(rect5, explanationText); } GUI.EndGroup(); }