示例#1
0
        //GenDate
        public static void DateReadoutStringAt_PostFix(long absTicks, Vector2 location, ref string __result)
        {
            var num   = GenDate.DayOfSeason(absTicks, location.x) + 1;
            var value = Find.ActiveLanguageWorker.OrdinalNumber(num, Gender.None);

            __result = "TTA_DateReadout".Translate(value, GenDate.Quadrum(absTicks, location.x).Label(), GenDate.Year(absTicks, location.x), num);
        }
示例#2
0
        private void CalculateNextRunTickAdvanced(int ticksNowAbs)
        {
            //If Settings have not been parsed do that now.
            if (this.m_ScreenshotHours == null || this.m_ScreenshotDays == null)
            {
                this.CalculateDaysAndHoursToRunOn();
            }

            int _CurrentHour = GenDate.HourOfDay(ticksNowAbs, this.SettingAdvancedTimeZoneLongitude);
            int _CurrentDay  = GenDate.DayOfSeason(ticksNowAbs, this.SettingAdvancedTimeZoneLongitude) + 1; //Convert from 0-14 to 1-15 as seen by user.

            Log.Message("CalculateNextRunTick Day:" + _CurrentDay.ToString() + " Hour " + _CurrentHour.ToString());

            int _NextHour = this.m_ScreenshotHours.Where(item => item > _CurrentHour).FirstOrDefault();
            int _NextDay  = this.m_ScreenshotDays.Where(item => item > _CurrentDay).FirstOrDefault();

            Log.Message("Next Hour is: " + _NextHour.ToString() + " Next Day: " + _NextDay.ToString());

            int _TicksThroughDay   = (int)((ticksNowAbs + this.LocalTicksOffsetFromLongitude((int)this.SettingAdvancedTimeZoneLongitude)) % 60000L);
            int _TicksAtStartOfDay = ticksNowAbs - _TicksThroughDay;

            Log.Message("_TicksAtStartOfDay: " + _TicksAtStartOfDay.ToString() + " _TicksThroughDay: " + _TicksThroughDay.ToString());

            int _DayOffset = 0;

            if (int.Equals(0, _NextHour))
            {
                _NextHour  = this.m_ScreenshotHours.FirstOrDefault();
                _DayOffset = _NextDay - _CurrentDay;
                Log.Message("Day offset: " + _DayOffset.ToString());
            }

            this.m_NextRunTicks = _TicksAtStartOfDay + _NextHour * GenDate.TicksPerHour + _DayOffset * GenDate.TicksPerDay;
            Log.Message("Running at: " + this.m_NextRunTicks);
        }
示例#3
0
        private void SetDateInfo()
        {
            //RimWorld.DateReadout.DateOnGUI
            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 gameTicks = Find.TickManager.gameStartAbsTick == 0 ? Find.TickManager.TicksGame : Find.TickManager.TicksAbs;             //Find.TickManager.TicksAbs errors if gameStartAbsTick is 0

            //RimWorld.GenDate.DateReadoutStringAt
            this.dateDayofSeason = GenDate.DayOfSeason(gameTicks, location.x) + 1;
            this.dateQuadrum     = GenDate.Quadrum(gameTicks, location.x);
            this.dateYear        = GenDate.Year(gameTicks, location.x);
        }
        // Token: 0x0600001A RID: 26 RVA: 0x00002714 File Offset: 0x00000914
        public override void MapComponentTick()
        {
            base.MapComponentTick();
            if (Find.TickManager.TicksGame % 30000 != 0)
            {
                return;
            }

            if (lastPartyYear == GenDate.YearsPassed)
            {
                //Log.Message(lastPartyYear.ToString());
                return;
            }

            once = true;

            if (!map.listerBuildings.AllBuildingsColonistOfDef(ThingDef.Named("ChristmasTreeBase")).Any() &&
                !map.listerBuildings.AllBuildingsColonistOfDef(ThingDef.Named("ChristmasTreeB")).Any() &&
                !map.listerBuildings.AllBuildingsColonistOfDef(ThingDef.Named("ChristmasTreeC")).Any() &&
                !map.listerBuildings.AllBuildingsColonistOfDef(ThingDef.Named("ChristmasTreeD")).Any())
            {
                //Log.Message("no tree");
                return;
            }

            var season     = GenDate.Season(GenTicks.TicksAbs, Find.WorldGrid.LongLatOf(map.Tile));
            var doTheThing = false;

            if (season == Season.PermanentSummer || season == Season.PermanentWinter)
            {
                //Log.Message("permanent season");
                if (GenDate.Quadrum(GenTicks.TicksAbs, Find.WorldGrid.LongLatOf(map.Tile).x) != Quadrum.Decembary)
                {
                    //Log.Message("not december");
                    return;
                }

                doTheThing = true;
            }

            if (!doTheThing && (season != Season.Winter ||
                                GenDate.DayOfSeason(GenTicks.TicksAbs, Find.WorldGrid.LongLatOf(map.Tile).x) < 2) ||
                !once)
            {
                //Log.Message("not winter");
                return;
            }

            //Log.Message("party");
            once = false;
            ExposeData();
            var incidentParms = StorytellerUtility.DefaultParmsNow(IncidentCategoryDefOf.Misc, map);

            incidentParms.forced = true;
            incidentParms.target = map;
            Find.Storyteller.incidentQueue.Add(XDefOf.PresentDrop, Find.TickManager.TicksGame, incidentParms, 240000);
            TryStartParty();
            lastPartyYear = GenDate.YearsPassed;
        }
示例#5
0
        private void ExecureOperation(int ticksNowAbs)
        {
            if (this.SettingAutoPause)
            {
                if (!Find.TickManager.Paused)
                {
                    Find.TickManager.TogglePaused();
                }
            }

            if (this.SettingDisplayMessage)
            {
                Letter _Letter = new Letter(this.SettingMessageLabel, this.SettingMessageContent, LetterType.Good);
                Find.LetterStack.ReceiveLetter(_Letter, "PhotoDay Letter");
            }

            if (this.SettingAutoScreenshot)
            {
                string _ScreenshotFolderPath = GenFilePaths.ScreenshotFolderPath;

                string _FullFilePath = _ScreenshotFolderPath;
                // _FullFilePath = _FullFilePath + (object)Path.DirectorySeparatorChar + GenDate.DaysPassedFloat.ToString() + ".jpg";
                if (this.SettingAdvancedMode)
                {
                    _FullFilePath = _FullFilePath + (object)Path.DirectorySeparatorChar +
                                    GenDate.Year(ticksNowAbs, this.SettingAdvancedTimeZoneLongitude) + "-" +
                                    GenDate.Season(ticksNowAbs, this.SettingAdvancedTimeZoneLongitude) + "-" +
                                    (GenDate.DayOfSeason(ticksNowAbs, this.SettingAdvancedTimeZoneLongitude) + 1).ToString().PadLeft(2, '0') + "-" +
                                    GenDate.HourOfDay(ticksNowAbs, this.SettingAdvancedTimeZoneLongitude).ToString().PadLeft(2, '0') + ".jpg";
                }
                else
                {
                    _FullFilePath = _FullFilePath + (object)Path.DirectorySeparatorChar +
                                    "Screenshot" + "-" +
                                    ticksNowAbs.ToString() + ".jpg";
                }

                Log.Message(_FullFilePath);
                Application.CaptureScreenshot(_FullFilePath);
            }
        }
示例#6
0
        public static int CurrentDay()
        {
            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(0);
                }
                vector = Find.WorldGrid.LongLatOf(Find.CurrentMap.Tile);
            }
            int num = (Find.TickManager.gameStartAbsTick == 0) ? Find.TickManager.TicksGame : Find.TickManager.TicksAbs;

            return(GenDate.DayOfSeason((long)num, vector.x) + 1);
        }
示例#7
0
        public static Date CurrentDate()
        {
            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(null);
                }
                vector = Find.WorldGrid.LongLatOf(Find.CurrentMap.Tile);
            }
            int num = (Find.TickManager.gameStartAbsTick == 0) ? Find.TickManager.TicksGame : Find.TickManager.TicksAbs;
            int day = GenDate.DayOfSeason((long)num, vector.x) + 1;


            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(null);
                }
                vector = Find.WorldGrid.LongLatOf(Find.CurrentMap.Tile);
            }
            int     num2    = (Find.TickManager.gameStartAbsTick == 0) ? Find.TickManager.TicksGame : Find.TickManager.TicksAbs;
            Quadrum quadrum = GenDate.Quadrum((long)num2, vector.x);

            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(null);
                }
                vector = Find.WorldGrid.LongLatOf(Find.CurrentMap.Tile);
            }
            int num3 = (Find.TickManager.gameStartAbsTick == 0) ? Find.TickManager.TicksGame : Find.TickManager.TicksAbs;

            int year = GenDate.Year((long)num3, vector.x);


            return(new Date(day, quadrum, year));
        }
示例#8
0
        protected override string GetIconTip(Pawn pawn)
        {
            Tenant tenantComp = pawn.GetTenantComponent();

            if (tenantComp != null && !tenantComp.IsTenant)
            {
                return(string.Empty);
            }
            string value = "FullDate".Translate(Find.ActiveLanguageWorker.OrdinalNumber(GenDate.DayOfSeason(tenantComp.ContractEndDate, 0f)), QuadrumUtility.Label(GenDate.Quadrum(tenantComp.ContractEndDate, 0f)), GenDate.Year(tenantComp.ContractEndDate, 0f));
            string a     = "ContractEndDate".Translate(value);
            string b     = "ContractPayment".Translate(tenantComp.Payment * tenantComp.ContractLength / 60000);
            string c     = "ContractLength".Translate(tenantComp.ContractLength / 60000);
            string d     = "ContractDaily".Translate(tenantComp.Payment);

            return(a + " \n " + b + " \n " + c + " \n " + d);
        }