internal string <> m__0() { StringBuilder stringBuilder = new StringBuilder(); for (int i = 0; i < 4; i++) { Quadrum quadrum = (Quadrum)i; stringBuilder.AppendLine(quadrum.Label() + " - " + quadrum.GetSeason(this.location.y).LabelCap()); } return("DateReadoutTip".Translate(new object[] { GenDate.DaysPassed, 15, this.season.LabelCap(), 15, GenDate.Quadrum((long)GenTicks.TicksAbs, this.location.x).Label(), stringBuilder.ToString() })); }
public static void DateOnGUI(Rect dateRect) { Vector2 location; if (WorldRendererUtility.WorldRenderedNow && Find.WorldSelector.selectedTile >= 0) { location = Find.WorldGrid.LongLatOf(Find.WorldSelector.selectedTile); } else if (WorldRendererUtility.WorldRenderedNow && Find.WorldSelector.NumSelectedObjects > 0) { location = Find.WorldGrid.LongLatOf(Find.WorldSelector.FirstSelectedObject.Tile); } else { if (Find.VisibleMap == null) { return; } location = Find.WorldGrid.LongLatOf(Find.VisibleMap.Tile); } int index = GenDate.HourInteger(Find.TickManager.TicksAbs, location.x); int num = GenDate.DayOfTwelfth(Find.TickManager.TicksAbs, location.x); Season season = GenDate.Season(Find.TickManager.TicksAbs, location); Quadrum quadrum = GenDate.Quadrum(Find.TickManager.TicksAbs, location.x); int num2 = GenDate.Year(Find.TickManager.TicksAbs, location.x); string text = (!DateReadout.SeasonLabelVisible) ? string.Empty : season.LabelCap(); if (num != DateReadout.dateStringDay || season != DateReadout.dateStringSeason || quadrum != DateReadout.dateStringQuadrum || num2 != DateReadout.dateStringYear) { DateReadout.dateString = GenDate.DateReadoutStringAt(Find.TickManager.TicksAbs, location); DateReadout.dateStringDay = num; DateReadout.dateStringSeason = season; DateReadout.dateStringQuadrum = quadrum; DateReadout.dateStringYear = num2; } Text.Font = GameFont.Small; Vector2 vector = Text.CalcSize(DateReadout.fastHourStrings[index]); float x = vector.x; Vector2 vector2 = Text.CalcSize(DateReadout.dateString); float a = Mathf.Max(x, (float)(vector2.x + 7.0)); Vector2 vector3 = Text.CalcSize(text); float num3 = Mathf.Max(a, vector3.x); dateRect.xMin = dateRect.xMax - num3; if (Mouse.IsOver(dateRect)) { Widgets.DrawHighlight(dateRect); } GUI.BeginGroup(dateRect); Text.Font = GameFont.Small; Text.Anchor = TextAnchor.UpperRight; Rect rect = dateRect.AtZero(); rect.xMax -= 7f; Widgets.Label(rect, DateReadout.fastHourStrings[index]); rect.yMin += 26f; Widgets.Label(rect, DateReadout.dateString); rect.yMin += 26f; if (!text.NullOrEmpty()) { Widgets.Label(rect, text); } Text.Anchor = TextAnchor.UpperLeft; GUI.EndGroup(); TooltipHandler.TipRegion(dateRect, new TipSignal(delegate { StringBuilder stringBuilder = new StringBuilder(); for (int i = 0; i < 4; i++) { Quadrum quadrum2 = (Quadrum)i; stringBuilder.AppendLine(quadrum2.Label() + " - " + quadrum2.GetSeason(location.y).LabelCap()); } return("DateReadoutTip".Translate(GenDate.DaysPassed, 15, season.LabelCap(), 15, GenDate.Quadrum(GenTicks.TicksAbs, location.x).Label(), stringBuilder.ToString())); }, 86423)); }
public static bool Prefix(Rect dateRect) { //-------------------------------------------- if (GetClocks(Find.VisibleMap).Count() == 0) { return(true); //use original method } if (clockAccuracy < 0) { Log.Warning("Found clock but clockAccuracy not set. Setting to Analog."); clockAccuracy = 0; } // //Vector2 location; //In event of transpiler just get local variable at end if (WorldRendererUtility.WorldRenderedNow && Find.WorldSelector.selectedTile >= 0) { location = Find.WorldGrid.LongLatOf(Find.WorldSelector.selectedTile); } else if (WorldRendererUtility.WorldRenderedNow && Find.WorldSelector.NumSelectedObjects > 0) { location = Find.WorldGrid.LongLatOf(Find.WorldSelector.FirstSelectedObject.Tile); } else { if (Find.VisibleMap == null) { return(false); } location = Find.WorldGrid.LongLatOf(Find.VisibleMap.Tile); } index = GenDate.HourInteger(Find.TickManager.TicksAbs, location.x); int num = GenDate.DayOfTwelfth(Find.TickManager.TicksAbs, location.x); Season season = GenDate.Season(Find.TickManager.TicksAbs, location); Quadrum quadrum = GenDate.Quadrum(Find.TickManager.TicksAbs, location.x); int num2 = GenDate.Year(Find.TickManager.TicksAbs, location.x); if (num != dateStringDay || season != dateStringSeason || quadrum != dateStringQuadrum || num2 != dateStringYear) { dateString = GenDate.DateReadoutStringAt(Find.TickManager.TicksAbs, location); dateStringDay = num; dateStringSeason = season; dateStringQuadrum = quadrum; dateStringYear = num2; } Text.Font = GameFont.Small; float num3 = Mathf.Max(Text.CalcSize(fastHourStrings[index]).x, Text.CalcSize(dateString).x + 7f); dateRect.xMin = dateRect.xMax - num3; if (Mouse.IsOver(dateRect)) { Widgets.DrawHighlight(dateRect); } GUI.BeginGroup(dateRect); Text.Font = GameFont.Small; Text.Anchor = TextAnchor.UpperRight; Rect rect = dateRect.AtZero(); rect.xMax -= 7f; //----------------------------------------------------- hrtime = (index < 12) ? "amannotation".Translate(fastHourStrings[index].ToString() + currentMin) : "pmannotation".Translate(fastHourStrings[index].ToString() + currentMin); Widgets.Label(rect, hrtime); // //Widgets.Label(rect, fastHourStrings[index]); REPLACED rect.yMin += 26f; Widgets.Label(rect, dateString); Text.Anchor = TextAnchor.UpperLeft; GUI.EndGroup(); //Remember - this delegate in itself is its own local method (m_XXX) //IL code: ldftn instance string RimWorld.DateReadout/'<DateOnGUI>c__AnonStorey449'::'<>m__64B'() TooltipHandler.TipRegion(dateRect, new TipSignal(delegate { StringBuilder stringBuilder = new StringBuilder(); for (int i = 0; i < 4; i++) { Quadrum quadrum2 = (Quadrum)i; stringBuilder.AppendLine(quadrum2.Label() + " - " + quadrum2.GetSeason(location.y).LabelCap()); } return("DateReadoutTip".Translate(new object[] { GenDate.DaysPassed, 15, season.LabelCap(), 15, GenDate.Quadrum((long)GenTicks.TicksAbs, location.x).Label(), stringBuilder.ToString() }) //------------------------------------------- + (clockAccuracy > 0 ? "TicksAbsOnGUI".Translate(Find.TickManager.TicksGame) : string.Empty) // ); }, 86423)); return(false); }
public static void DateOnGUI(Rect dateRect) { Vector2 vector; if (WorldRendererUtility.WorldRenderedNow && Find.WorldSelector.selectedTile >= 0) { vector = Find.WorldGrid.LongLatOf(Find.WorldSelector.selectedTile); } else if (WorldRendererUtility.WorldRenderedNow && Find.WorldSelector.NumSelectedObjects > 0) { vector = Find.WorldGrid.LongLatOf(Find.WorldSelector.FirstSelectedObject.Tile); } else { if (Find.CurrentMap == null) { return; } vector = Find.WorldGrid.LongLatOf(Find.CurrentMap.Tile); } int index = GenDate.HourInteger(Find.TickManager.TicksAbs, vector.x); int num = GenDate.DayOfTwelfth(Find.TickManager.TicksAbs, vector.x); Season season = GenDate.Season(Find.TickManager.TicksAbs, vector); Quadrum quadrum = GenDate.Quadrum(Find.TickManager.TicksAbs, vector.x); int num2 = GenDate.Year(Find.TickManager.TicksAbs, vector.x); string text = (SeasonLabelVisible ? seasonsCached[(int)season] : ""); if (num != dateStringDay || season != dateStringSeason || quadrum != dateStringQuadrum || num2 != dateStringYear) { dateString = GenDate.DateReadoutStringAt(Find.TickManager.TicksAbs, vector); dateStringDay = num; dateStringSeason = season; dateStringQuadrum = quadrum; dateStringYear = num2; } Text.Font = GameFont.Small; float num3 = Mathf.Max(Mathf.Max(Text.CalcSize(fastHourStrings[index]).x, Text.CalcSize(dateString).x), Text.CalcSize(text).x) + 7f; dateRect.xMin = dateRect.xMax - num3; if (Mouse.IsOver(dateRect)) { Widgets.DrawHighlight(dateRect); } GUI.BeginGroup(dateRect); Text.Font = GameFont.Small; Text.Anchor = TextAnchor.UpperRight; Rect rect = dateRect.AtZero(); rect.xMax -= 7f; Widgets.Label(rect, fastHourStrings[index]); rect.yMin += 26f; Widgets.Label(rect, dateString); rect.yMin += 26f; if (!text.NullOrEmpty()) { Widgets.Label(rect, text); } Text.Anchor = TextAnchor.UpperLeft; GUI.EndGroup(); if (Mouse.IsOver(dateRect)) { StringBuilder stringBuilder = new StringBuilder(); for (int i = 0; i < 4; i++) { Quadrum quadrum2 = (Quadrum)i; stringBuilder.AppendLine(quadrum2.Label() + " - " + quadrum2.GetSeason(vector.y).LabelCap()); } TaggedString taggedString = "DateReadoutTip".Translate(GenDate.DaysPassed, 15, season.LabelCap(), 15, GenDate.Quadrum(GenTicks.TicksAbs, vector.x).Label(), stringBuilder.ToString()); TooltipHandler.TipRegion(dateRect, new TipSignal(taggedString, 86423)); } }