public static string ConvertToDateTimeString(int tick, int tile) { Vector2 vector = Find.WorldGrid.LongLatOf(tile); string hourString = GenDate.HourInteger((long)tick, vector.x) + "LetterHour".Translate(); return("ColonistHistory.DateString".Translate(GenDate.DateReadoutStringAt((long)tick, vector), hourString)); }
public static void CanInteractWithAnimal_Postfix(Pawn pawn, ref bool __result) { int hourInteger = GenDate.HourInteger(Find.TickManager.TicksAbs, Find.WorldGrid.LongLatOf(pawn.MapHeld.Tile).x); if (hourInteger >= MeMiMoSettings.animalInteractionHourLimit && __result) { JobFailReason.Is("M4_CantInteractAnimalWillFallAsleepSoon".Translate()); __result = false; } }
private string CreateImageNameDateTime() { int tick = Find.TickManager.TicksAbs; float longitude = Find.WorldGrid.LongLatOf(map.Tile).x; int year = GenDate.Year(tick, longitude); int quadrum = MoreGenDate.QuadrumInteger(tick, longitude); int day = GenDate.DayOfQuadrum(tick, longitude) + 1; int hour = GenDate.HourInteger(tick, longitude); return("rimworld-" + Find.World.info.seedString + "-" + map.Tile + "-" + year + "-" + quadrum + "-" + ((day < 10) ? "0" : "") + day + "-" + ((hour < 10) ? "0" : "") + hour); }
static void LabelTimePart(Rect rect, string message, Vector2 location) { int accuracy = accuracyInt = GetAccuracyForMap(Find.VisibleMap); if (accuracy >= 0) { int minute = (int)Math.Floor((decimal)(Find.TickManager.TicksAbs) / 2500 * 60) % 60; int second = (int)Math.Floor((decimal)(Find.TickManager.TicksAbs) / 2500 * 3600) % 60; int hour = GenDate.HourInteger(Find.TickManager.TicksAbs, location.x); int hourFinal = hour; bool pm = hour > 11; if (hourFinal == 0) { hourFinal = 12; } else if (hourFinal > 12) { hourFinal %= 12; } message = (pm ? "pmannotation" : "amannotation").Translate($"{hour.ToString("00")}:{minute.ToString("00")}{(accuracy > 0 ? $":{second.ToString("00")}" : "")}"); } Widgets.Label(rect, message); }
public static int HourMinuteReadout(long absTicks, float longitude) { Log.Message("moo"); return(GenDate.HourInteger(absTicks, longitude)); }
private void DoArchivableRow(Rect rect, IArchivable archivable, int index) { if (index % 2 == 1) { Widgets.DrawLightHighlight(rect); } Widgets.DrawHighlightIfMouseover(rect); Text.Font = GameFont.Small; Text.Anchor = TextAnchor.MiddleLeft; Text.WordWrap = false; Rect rect2 = rect; Rect rect3 = rect2; rect3.width = 30f; rect2.xMin += 40f; float num = Find.Archive.IsPinned(archivable) ? 1f : ((!Mouse.IsOver(rect3)) ? 0f : 0.25f); if (num > 0f) { GUI.color = new Color(1f, 1f, 1f, num); GUI.DrawTexture(new Rect(rect3.x + (rect3.width - 22f) / 2f, rect3.y + (rect3.height - 22f) / 2f, 22f, 22f).Rounded(), PinTex); GUI.color = Color.white; } Rect rect4 = rect2; Rect outerRect = rect2; outerRect.width = 30f; rect2.xMin += 40f; Texture archivedIcon = archivable.ArchivedIcon; if (archivedIcon != null) { GUI.color = archivable.ArchivedIconColor; Widgets.DrawTextureFitted(outerRect, archivedIcon, 0.8f); GUI.color = Color.white; } Rect rect5 = rect2; rect5.width = 200f; rect2.xMin += 210f; Vector2 location = (Find.CurrentMap == null) ? default(Vector2) : Find.WorldGrid.LongLatOf(Find.CurrentMap.Tile); GUI.color = new Color(0.75f, 0.75f, 0.75f); int num2 = GenDate.TickGameToAbs(archivable.CreatedTicksGame); string str = GenDate.DateFullStringAt(num2, location) + ", " + GenDate.HourInteger(num2, location.x) + "LetterHour".Translate(); Widgets.Label(rect5, str.Truncate(rect5.width)); GUI.color = Color.white; Rect rect6 = rect2; Widgets.Label(rect6, archivable.ArchivedLabel.Truncate(rect6.width)); GenUI.ResetLabelAlign(); Text.WordWrap = true; TooltipHandler.TipRegion(rect3, "PinArchivableTip".Translate(200)); if (Mouse.IsOver(rect4)) { TooltipHandler.TipRegion(rect4, archivable.ArchivedTooltip); } if (Widgets.ButtonInvisible(rect3)) { if (Find.Archive.IsPinned(archivable)) { Find.Archive.Unpin(archivable); SoundDefOf.Checkbox_TurnedOff.PlayOneShotOnCamera(); } else { Find.Archive.Pin(archivable); SoundDefOf.Checkbox_TurnedOn.PlayOneShotOnCamera(); } } if (Widgets.ButtonInvisible(rect4)) { if (Event.current.button == 1) { LookTargets lookTargets = archivable.LookTargets; if (CameraJumper.CanJump(lookTargets.TryGetPrimaryTarget())) { CameraJumper.TryJumpAndSelect(lookTargets.TryGetPrimaryTarget()); Find.MainTabsRoot.EscapeCurrentTab(); } } else { archivable.OpenArchived(); } } }
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); }