private void UpdateAbsoluteFieldsFromTicks(int ticksToUse)
        {
            var tileCoords = RemindersGameComponent.VectorForTime;

            if (!tileCoords.HasValue)
            {
                return;
            }
            var absTicks = GenDate.TickGameToAbs(ticksToUse);
            var coords   = tileCoords.Value;

            yearValue  = GenDate.Year(absTicks, coords.x);
            yearBuffer = yearValue.ToString();

            quadrumValue = GenDate.Quadrum(absTicks, coords.x);

            dayValue  = GenDate.DayOfQuadrum(absTicks, coords.x) + 1;
            dayBuffer = dayValue.ToString();

            hourValue  = GenDate.HourOfDay(absTicks, coords.x);
            hourBuffer = hourValue.ToString();

            Log.Debug($"Set defaults to {dayBuffer} {quadrumValue}, {yearBuffer} at {hourBuffer}.");
            Log.Debug($"Should have set to {GenDate.DateFullStringWithHourAt(absTicks, coords)}.");
        }
        private static string DateString(int ticks)
        {
            if (!VectorForTime.HasValue)
            {
                return("1st of January, 1970, 0h");
            }                                                                   // Kappa

            return(GenDate.DateFullStringWithHourAt(GenDate.TickGameToAbs(ticks), VectorForTime.GetValueOrDefault()));
        }
        public override void GameComponentTick()
        {
            base.GameComponentTick();

            if (Game.tickManager.TicksGame == ticksOnLoad + DelayToSendOnLoadLetters)
            {
                SendOnLoadLetters();
            }

            if (Game.tickManager.TicksGame % GenDate.TicksPerHour != 0)
            {
                return;
            }
            if (!VectorForTime.HasValue)
            {
                return;
            }
            if (ReminderQueue.Count == 0)
            {
                return;
            }

            Log.Debug(GenDate.DateFullStringWithHourAt(Game.tickManager.TicksAbs, VectorForTime.GetValueOrDefault()));
            while (ReminderQueue.Peek().FireOnTick <= GenTicks.TicksGame)
            {
                var reminder = ReminderQueue.Pop();
                SendLetter(reminder);
                if (reminder.RecurEvery.HasValue)
                {
                    ReminderQueue.Push(Reminder.Recur(reminder));
                }
                if (ReminderQueue.Count == 0)
                {
                    break;
                }
            }
        }
示例#4
0
 public static string DateFullStringWithHourAtHome(long tick) =>
     GenDate.DateFullStringWithHourAt(tick, Find.WorldGrid.LongLatOf(Find.AnyPlayerHomeMap.Tile));
示例#5
0
 private string GetDateTimeString(DataPoint point, Vector2 latLong)
 {
     return(GenDate.DateFullStringWithHourAt(GenDate.TickGameToAbs(point.TimeStampGameTicks), latLong));
 }