コード例 #1
0
 public override void GenerateWithoutWorldData(string seed)
 {
     Rand.PushState();
     Rand.Seed = GenText.StableStringHash(seed);
     GenerateRoadNetwork();
     Rand.PopState();
 }
コード例 #2
0
        public override string ExplanationPart(StatRequest req)
        {
            if (!Genes.EffectsThing(req.Thing))
            {
                return(null);
            }

            Pawn pawn = req.Thing as Pawn;

            if (!Settings.Core.omniscientMode && pawn.Faction != Faction.OfPlayer)
            {
                return(null);
            }

            var statRecord = pawn.AnimalGenetics().GeneRecords[_StatDef];

            if (statRecord == null)
            {
                return(null);
            }

            string postfix = "";

            if (statRecord.Parent != GeneRecord.Source.None)
            {
                string icon = statRecord.Parent == GeneRecord.Source.Mother ? "♀" : "♂";
                postfix = " (x" + GenText.ToStringPercent(statRecord.ParentValue) + icon + ")";
            }

            return("AG.Genetics".Translate() + ": x" + GenText.ToStringPercent(statRecord.Value) + postfix);
        }
コード例 #3
0
        public override string GetInspectString()
        {
            StringBuilder             stringBuilder = new StringBuilder();
            List <ResearchProjectDef> researches    = new List <ResearchProjectDef>();

            foreach (var data in PurpleIvyData.BioStudy)
            {
                foreach (var research in data.Value)
                {
                    if (!researches.Contains(research))
                    {
                        researches.Add(research);
                    }
                }
            }
            foreach (var research in researches)
            {
                if (research.TechprintsApplied == 0)
                {
                    string researchData = research.label + " - "
                                          + "Prerequisites: " + (research.PrerequisitesCompleted ? "Yes" : "No") +
                                          " - No techprints: " + (this.Map.listerThings.ThingsOfDef
                                                                      (ThingDef.Named("Techprint_" + research.defName)).Count == 0 ? "Yes" : "No") + "\n";
                    stringBuilder.Append(researchData);
                }
                else
                {
                    stringBuilder.Append(research.label + " completed\n");
                }
            }
            return(base.GetInspectString() + "\n" + GenText.TrimEndNewlines(stringBuilder.ToString()));
        }
コード例 #4
0
        // Token: 0x06000007 RID: 7 RVA: 0x0000212C File Offset: 0x0000032C
        public override string GetInspectString()
        {
            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.AppendLine(base.GetInspectString());
            CompTemperatureRuinable comp = base.GetComp <CompTemperatureRuinable>();
            bool flag = comp != null;

            if (flag)
            {
                float num   = (float)typeof(CompTemperatureRuinable).GetField("ruinedPercent", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(comp);
                bool  flag2 = num > 0f;
                if (flag2)
                {
                    stringBuilder.AppendLine("(" + GenText.ToStringPercent(num) + ") " + (this.Extension.temperatureManagement.hasTemperatureManagement ? "AVInspect_BadTempManaged".AdvancedTranslate(this.Extension) : "AVInspect_BadTempUnmanaged".AdvancedTranslate(this.Extension)));
                }
            }
            stringBuilder.AppendLine(this.GetStringIngredients());
            bool flag3 = !GenCollection.Any <Building_AutomatedVat._ThingCountClass>(this.localRecord, (Building_AutomatedVat._ThingCountClass t) => t.count > 0);

            if (flag3)
            {
                stringBuilder.AppendLine(this.GetStringWorking());
            }
            return(GenText.TrimEndNewlines(stringBuilder.ToString()));
        }
コード例 #5
0
        public override string GetInspectString()
        {
            StringBuilder stringBuilder = new StringBuilder();
            string        inspectString = base.GetInspectString();
            bool          flag          = GenText.NullOrEmpty(inspectString);

            if (flag)
            {
                stringBuilder.Append("...");
            }
            else
            {
                stringBuilder.Append(base.GetInspectString());
            }
            bool flag2 = this.robot != null && this.robot.Spawned;

            if (flag2)
            {
                stringBuilder.AppendLine().Append(Translator.Translate("AIRobot_RobotIs") + " " + this.robot.LabelShort);
            }
            else
            {
                bool flag3 = this.robotIsDestroyed;
                if (flag3)
                {
                    stringBuilder.AppendLine().Append(Translator.Translate("AIRobot_RobotIsDestroyed"));
                }
            }
            return(stringBuilder.ToString());
        }
コード例 #6
0
        static void Postfix(Dialog_DebugOptionLister __instance, string label, Action toolAction, Container <DebugTool>?__state)
        {
            // New tool chosen
            if (__state != null && DebugTools.curTool != __state?.Inner)
            {
                var originalAction = (toolAction.Target as DebugListerContext)?.originalAction ?? toolAction;
                int hash           = Gen.HashCombineInt(GenText.StableStringHash(originalAction.Method.MethodDesc()), GenText.StableStringHash(label));

                if (__instance is Dialog_DebugActionsMenu)
                {
                    var source = MpDebugTools.ListingSource();
                    if (source == DebugSource.None)
                    {
                        return;
                    }

                    Map map = source == DebugSource.ListingMap ? Find.CurrentMap : null;

                    MpDebugTools.SendCmd(source, hash, map);
                    DebugTools.curTool = null;
                }

                if (__instance is Dialog_DebugOptionListLister lister)
                {
                    var context = (DebugListerContext)toolAction.Target;
                    MpDebugTools.SendCmd(DebugSource.Lister, hash, context.map);
                    DebugTools.curTool = null;
                }
            }
        }
コード例 #7
0
ファイル: WorldPawnGCOptimized.cs プロジェクト: asky74/RimMod
        static public string PawnGCDebugResults(WorldPawnGC __instance)
        {
            Dictionary <Pawn, string> dictionary = new Dictionary <Pawn, string>();

            AccumulatePawnGCData(__instance, dictionary).ExecuteEnumerable();
            Dictionary <string, int> countReasons = new Dictionary <string, int>();

            foreach (Pawn current in Find.WorldPawns.AllPawnsAlive)
            {
                string reason;
                if (!dictionary.TryGetValue(current, out reason))
                {
                    reason = "Discarded";
                }
                int counter;
                if (!countReasons.TryGetValue(reason, out counter))
                {
                    counter = 0;
                }
                countReasons[reason] = ++counter;
            }
            return(GenText.ToLineList(from kvp in countReasons
                                      orderby kvp.Value descending
                                      select string.Format("{0}: {1}", kvp.Value, kvp.Key)));
        }
コード例 #8
0
ファイル: Site.cs プロジェクト: sachdevs/RW-Decompile
        public override string GetInspectString()
        {
            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.Append(base.GetInspectString());
            if (this.writeSiteParts)
            {
                if (stringBuilder.Length != 0)
                {
                    stringBuilder.AppendLine();
                }
                if (this.parts.Count == 0)
                {
                    stringBuilder.Append("KnownSiteThreatsNone".Translate());
                }
                else if (this.parts.Count == 1)
                {
                    stringBuilder.Append("KnownSiteThreat".Translate(new object[]
                    {
                        this.parts[0].LabelCap
                    }));
                }
                else
                {
                    StringBuilder arg_D9_0 = stringBuilder;
                    string        arg_D4_0 = "KnownSiteThreats";
                    object[]      expr_A3  = new object[1];
                    expr_A3[0] = GenText.ToCommaList(from x in this.parts
                                                     select x.LabelCap, true);
                    arg_D9_0.Append(arg_D4_0.Translate(expr_A3));
                }
            }
            return(stringBuilder.ToString());
        }
コード例 #9
0
 private static void OnItemSubmitted(SubmitItemUpdateResult_t result, bool IOFailure)
 {
     if (IOFailure || result.m_eResult != EResult.k_EResultOK)
     {
         Workshop.uploadingHook = null;
         Dialog_WorkshopOperationInProgress.CloseAll();
         Log.Error("Workshop: OnItemSubmitted failure. Result: " + result.m_eResult.GetLabel(), false);
         Find.WindowStack.Add(new Dialog_MessageBox("WorkshopSubmissionFailed".Translate(new object[]
         {
             GenText.SplitCamelCase(result.m_eResult.GetLabel())
         }), null, null, null, null, null, false, null, null));
     }
     else
     {
         SteamUtility.OpenWorkshopPage(Workshop.uploadingHook.PublishedFileId);
         Messages.Message("WorkshopUploadSucceeded".Translate(new object[]
         {
             Workshop.uploadingHook.Name
         }), MessageTypeDefOf.TaskCompletion, false);
         if (Prefs.LogVerbose)
         {
             Log.Message("Workshop: Item submit result: " + result.m_eResult, false);
         }
     }
     Workshop.curStage     = WorkshopInteractStage.None;
     Workshop.submitResult = null;
 }
コード例 #10
0
        protected void DrawFooter(Rect inRect)
        {
            GUI.BeginGroup(inRect);
            bool  flag = Event.current.type == EventType.KeyDown && Event.current.keyCode == KeyCode.Return;
            float top  = inRect.height - 52;

            Text.Font   = GameFont.Small;
            Text.Anchor = TextAnchor.MiddleLeft;
            GUI.SetNextControlName("ColonistNameField");
            Rect   rect = new Rect(5, top, 400, 35);
            string text = Widgets.TextField(rect, Filename);

            if (GenText.IsValidFilename(text))
            {
                Filename = text;
                var matchingIndex = RandomSettings.pawnFilterList.FindIndex(i => i.name == Filename);
                if (matchingIndex >= 0)
                {
                    selectedIndex = matchingIndex;
                }
                else
                {
                    selectedIndex = -1;
                }
            }
            if (!this.focusedColonistNameArea)
            {
                GUI.FocusControl("ColonistNameField");
                this.focusedColonistNameArea = true;
            }


            Rect butRect = new Rect(420, top, inRect.width - 400 - 20, 35);

            GUI.SetNextControlName("SaveButton");
            string buttonName = selectedIndex >= 0 ? "RandomPlus.SaveLoadDialog.OverwriteButton".Translate() : "RandomPlus.SaveLoadDialog.SaveButton".Translate();

            if (Widgets.ButtonText(butRect, buttonName, true, false, true) || flag)
            {
                if (Filename.Length == 0)
                {
                    Messages.Message("NeedAName".Translate(), MessageTypeDefOf.RejectInput);
                }
                else if (selectedIndex >= 0)
                {
                    RandomSettings.PawnFilter.name = text;
                    SaveLoader.SaveOverwrite(selectedIndex, RandomSettings.PawnFilter);
                    Close(true);
                }
                else
                {
                    RandomSettings.PawnFilter.name = text;
                    SaveLoader.Save(RandomSettings.PawnFilter);
                    Close(true);
                }
            }

            Text.Anchor = TextAnchor.UpperLeft;
            GUI.EndGroup();
        }
コード例 #11
0
ファイル: PawnUtility.cs プロジェクト: sachdevs/RW-Decompile
 public static string PawnKindsToCommaList(List <Pawn> pawns)
 {
     PawnUtility.tmpPawns.Clear();
     PawnUtility.tmpPawns.AddRange(pawns);
     PawnUtility.tmpPawns.SortBy((Pawn x) => !x.RaceProps.Humanlike, (Pawn x) => x.GetKindLabelPlural(-1));
     PawnUtility.tmpAddedPawnKinds.Clear();
     PawnUtility.tmpPawnKinds.Clear();
     for (int i = 0; i < PawnUtility.tmpPawns.Count; i++)
     {
         if (!PawnUtility.tmpAddedPawnKinds.Contains(PawnUtility.tmpPawns[i].kindDef))
         {
             PawnUtility.tmpAddedPawnKinds.Add(PawnUtility.tmpPawns[i].kindDef);
             int num = 0;
             for (int j = 0; j < PawnUtility.tmpPawns.Count; j++)
             {
                 if (PawnUtility.tmpPawns[j].kindDef == PawnUtility.tmpPawns[i].kindDef)
                 {
                     num++;
                 }
             }
             if (num == 1)
             {
                 PawnUtility.tmpPawnKinds.Add("1 " + PawnUtility.tmpPawns[i].KindLabel);
             }
             else
             {
                 PawnUtility.tmpPawnKinds.Add(num + " " + PawnUtility.tmpPawns[i].GetKindLabelPlural(num));
             }
         }
     }
     return(GenText.ToCommaList(PawnUtility.tmpPawnKinds, true));
 }
コード例 #12
0
        private static void OnItemCreated(CreateItemResult_t result, bool IOFailure)
        {
            if (IOFailure || result.m_eResult != EResult.k_EResultOK)
            {
                Workshop.uploadingHook = null;
                Dialog_WorkshopOperationInProgress.CloseAll();
                Log.Error("Workshop: OnItemCreated failure. Result: " + result.m_eResult.GetLabel());
                Find.WindowStack.Add(new Dialog_MessageBox("WorkshopSubmissionFailed".Translate(new object[]
                {
                    GenText.SplitCamelCase(result.m_eResult.GetLabel())
                }), null, null, null, null, null, false));
                return;
            }
            Workshop.uploadingHook.PublishedFileId = result.m_nPublishedFileId;
            if (Prefs.LogVerbose)
            {
                Log.Message("Workshop: Item created. PublishedFileId: " + Workshop.uploadingHook.PublishedFileId);
            }
            Workshop.curUpdateHandle = SteamUGC.StartItemUpdate(SteamUtils.GetAppID(), Workshop.uploadingHook.PublishedFileId);
            Workshop.SetWorkshopItemDataFrom(Workshop.curUpdateHandle, Workshop.uploadingHook, true);
            Workshop.curStage = WorkshopInteractStage.SubmittingItem;
            if (Prefs.LogVerbose)
            {
                Log.Message("Workshop: Submitting item.");
            }
            SteamAPICall_t hAPICall = SteamUGC.SubmitItemUpdate(Workshop.curUpdateHandle, "[Auto-generated text]: Initial upload.");

            Workshop.submitResult = CallResult <SubmitItemUpdateResult_t> .Create(new CallResult <SubmitItemUpdateResult_t> .APIDispatchDelegate(Workshop.OnItemSubmitted));

            Workshop.submitResult.Set(hAPICall, null);
            Workshop.createResult = null;
        }
        public override void DoWindowContents(Rect inRect)
        {
            Workshop.GetUpdateStatus(out var updateStatus, out var progPercent);
            WorkshopInteractStage curStage = Workshop.CurStage;

            if (curStage == WorkshopInteractStage.None && updateStatus == EItemUpdateStatus.k_EItemUpdateStatusInvalid)
            {
                Close();
                return;
            }
            string text = "";

            if (curStage != 0)
            {
                text += curStage.GetLabel();
                text += "\n\n";
            }
            if (updateStatus != 0)
            {
                text += updateStatus.GetLabel();
                if (progPercent > 0f)
                {
                    text = text + " (" + progPercent.ToStringPercent() + ")";
                }
                text += GenText.MarchingEllipsis();
            }
            Widgets.Label(inRect, text);
        }
コード例 #14
0
ファイル: DTMPatching.cs プロジェクト: keenkrozzy/DontTemptMe
        public static bool PreFLoadGameFromSaveFile(string fileName)
        {
            string str = GenText.ToCommaList(from mod in LoadedModManager.RunningMods
                                             select mod.ToString(), true);

            Log.Message("Loading game from file " + fileName + " with mods " + str);
            DeepProfiler.Start("Loading game from file " + fileName);
            Current.Game = new Game();
            DeepProfiler.Start("InitLoading (read file)");
            Scribe.loader.InitLoading(GenFilePaths.FilePathForSavedGame(fileName));
            DeepProfiler.End();
            ScribeMetaHeaderUtility.LoadGameDataHeader(ScribeMetaHeaderUtility.ScribeHeaderMode.Map, true);
            bool flag = !Scribe.EnterNode("Κgame");
            bool result;

            if (flag)
            {
                Log.Error("Could not find DTMG XML node.");
                Scribe.ForceStop();
                GenScene.GoToMainMenu();
                Messages.Message("Game MUST be created with 'Don't Tempt Me!' loaded. Please select a 'Don't Tempt Me!' save game file.", MessageTypeDefOf.RejectInput);
                result = false;
            }
            else
            {
                Current.Game = new Game();
                Current.Game.LoadGame();
                PermadeathModeUtility.CheckUpdatePermadeathModeUniqueNameOnGameLoad(fileName);
                DeepProfiler.End();
                result = false;
            }
            return(result);
        }
コード例 #15
0
        public override string GetInspectString()
        {
            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.Append(base.GetInspectString());
            if (this.writeSiteParts)
            {
                if (stringBuilder.Length != 0)
                {
                    stringBuilder.AppendLine();
                }
                if (this.parts.Count == 0)
                {
                    stringBuilder.Append("KnownSiteThreatsNone".Translate());
                }
                else if (this.parts.Count == 1)
                {
                    stringBuilder.Append("KnownSiteThreat".Translate(this.parts[0].LabelCap));
                }
                else
                {
                    stringBuilder.Append("KnownSiteThreats".Translate(GenText.ToCommaList(from x in this.parts
                                                                                          select x.LabelCap, true)));
                }
            }
            return(stringBuilder.ToString());
        }
コード例 #16
0
        protected virtual void DoTypeInField(Rect rect)
        {
            GUI.BeginGroup(rect);
            bool  flag = Event.current.type == EventType.KeyDown && Event.current.keyCode == KeyCode.Return;
            float y    = rect.height - 52f;

            Text.Font   = GameFont.Small;
            Text.Anchor = TextAnchor.MiddleLeft;
            GUI.SetNextControlName("MapNameField");
            string str = Widgets.TextField(new Rect(5f, y, 400f, 35f), typingName);

            if (GenText.IsValidFilename(str))
            {
                typingName = str;
            }
            if (!focusedNameArea)
            {
                UI.FocusControl("MapNameField", this);
                focusedNameArea = true;
            }
            if (Widgets.ButtonText(new Rect(420f, y, rect.width - 400f - 20f, 35f), "SaveGameButton".Translate()) | flag)
            {
                if (typingName.NullOrEmpty())
                {
                    Messages.Message("NeedAName".Translate(), MessageTypeDefOf.RejectInput, historical: false);
                }
                else
                {
                    DoFileInteraction(typingName);
                }
            }
            Text.Anchor = TextAnchor.UpperLeft;
            GUI.EndGroup();
        }
コード例 #17
0
        static bool Prefix(Dialog_DebugOptionLister __instance, string label, Action toolAction, ref Container <DebugTool>?__state)
        {
            if (Multiplayer.Client == null)
            {
                return(true);
            }
            if (Current.ProgramState == ProgramState.Playing && !Multiplayer.WorldComp.debugMode)
            {
                return(true);
            }

            if (Multiplayer.ExecutingCmds)
            {
                int hash = Gen.HashCombineInt(GenText.StableStringHash(toolAction.Method.MethodDesc()), GenText.StableStringHash(label));
                if (hash == MpDebugTools.currentHash)
                {
                    DebugTools.curTool = new DebugTool(label, toolAction);
                }

                return(false);
            }

            __state = DebugTools.curTool;

            return(true);
        }
コード例 #18
0
 public void Reset()
 {
     this.seedString     = GenText.RandomSeedString();
     this.planetCoverage = (float)((Prefs.DevMode && UnityData.isEditor) ? 0.05000000074505806 : 0.30000001192092896);
     this.rainfall       = OverallRainfall.Normal;
     this.temperature    = OverallTemperature.Normal;
 }
コード例 #19
0
 private void FinalizeTick()
 {
     jobsGivenRecentTicks.Add(jobsGivenThisTick);
     jobsGivenRecentTicksTextual.Add(jobsGivenThisTickTextual);
     while (jobsGivenRecentTicks.Count > RecentJobQueueMaxLength)
     {
         jobsGivenRecentTicks.RemoveAt(0);
         jobsGivenRecentTicksTextual.RemoveAt(0);
     }
     if (jobsGivenThisTick != 0)
     {
         var num = 0;
         for (var i = 0; i < jobsGivenRecentTicks.Count; i++)
         {
             num += jobsGivenRecentTicks[i];
         }
         if (num >= MaxRecentJobs)
         {
             var text = GenText.ToCommaList(jobsGivenRecentTicksTextual, true);
             jobsGivenRecentTicks.Clear();
             jobsGivenRecentTicksTextual.Clear();
             StartErrorRecoverJob($"{caravan} started {MaxRecentJobs} jobs in {RecentJobQueueMaxLength} ticks. List: {text}");
         }
     }
 }
コード例 #20
0
        public static void DrawLogs(Rect rect)
        {
            Widgets.DrawMenuSection(rect);

            if (!GUIController.CurrentEntry?.isPatched ?? true)
            {
                DubGUI.Heading(rect, $"Loading{GenText.MarchingEllipsis(0f)}");
                return;
            }

            var columnsR = rect.TopPartPixels(50f);

            DrawColumns(columnsR);

            columns[(int)SortBy.Average].total = 0;

            rect.AdjustVerticallyBy(columnsR.height + 4);
            rect.height -= 2f;
            rect.width  -= 2;

            Rect innerRect = rect.AtZero();

            innerRect.height = listing.curY;
            if (innerRect.height > rect.height)
            {
                innerRect.width -= 17f;
            }

            viewFrustum    = rect.AtZero();    // Our view frustum starts at 0,0 from the rect we are given
            viewFrustum.y += ScrollPosition.y; // adjust our view frustum vertically based on the scroll position

            {                                  // Begin scope for Scroll View
                Widgets.BeginScrollView(rect, ref ScrollPosition, innerRect);
                GUI.BeginGroup(innerRect);
                listing.Begin(innerRect);

                Text.Anchor = TextAnchor.MiddleCenter;
                Text.Font   = GameFont.Tiny;


                float currentListHeight = BOX_HEIGHT;

                Text.Anchor = TextAnchor.MiddleLeft;

                lock (Analyzer.LogicLock)
                {
                    foreach (ProfileLog log in Analyzer.Logs)
                    {
                        DrawLog(log, ref currentListHeight);
                    }
                }

                listing.End();
                GUI.EndGroup();
                Widgets.EndScrollView();
            }


            DubGUI.ResetFont();
        }
コード例 #21
0
 public void Reset()
 {
     this.seedString     = GenText.RandomSeedString();
     this.planetCoverage = ((Prefs.DevMode && UnityData.isEditor) ? 0.05f : 0.3f);
     this.rainfall       = OverallRainfall.Normal;
     this.temperature    = OverallTemperature.Normal;
 }
コード例 #22
0
ファイル: DebugTools.cs プロジェクト: rwmt/Multiplayer
        static void Postfix(Dialog_DebugOptionLister __instance, string label, Action toolAction, Container <DebugTool>?__state)
        {
            // New tool chosen
            if (!__state.HasValue || DebugTools.curTool == __state?.Inner)
            {
                return;
            }

            int hash = Gen.HashCombineInt(GenText.StableStringHash(toolAction.Method.MethodDesc()), GenText.StableStringHash(label));

            if (__instance is Dialog_DebugActionsMenu)
            {
                var source = MpDebugTools.ListingSource();
                if (source == DebugSource.None)
                {
                    return;
                }

                Map map = source == DebugSource.ListingMap ? Find.CurrentMap : null;

                MpDebugTools.SendCmd(source, hash, map);
                DebugTools.curTool = null;
            }

            else if (__instance is Dialog_DebugOptionListLister lister)
            {
                Map map = MpDebugTools.CurrentPlayerState.Map;
                if (ListingMapMarker.drawing)
                {
                    map = Find.CurrentMap;
                }
                MpDebugTools.SendCmd(DebugSource.Lister, hash, map);
                DebugTools.curTool = null;
            }
        }
コード例 #23
0
        private void Button_SpawnBot()
        {
            bool flag = this.robot != null || this.robotIsDestroyed;

            if (!flag)
            {
                bool flag2 = GenText.NullOrEmpty(this.spawnThingDef);
                if (flag2)
                {
                    Log.Error("Robot Recharge Station: Wanted to spawn robot, but spawnThingDef is null or empty!");
                }
                else
                {
                    bool         flag3 = !this.IsRobotInContainer();
                    ArcBaseRobot bot;
                    if (flag3)
                    {
                        bot = Building_BaseRobotCreator.CreateRobot(this.spawnThingDef, base.Position, base.Map, Faction.OfPlayer);
                    }
                    else
                    {
                        bot = this.container [0];
                        this.container.Remove(bot);
                        bot = (GenSpawn.Spawn(bot, base.Position, base.Map) as ArcBaseRobot);
                    }
                    this.robot = bot;
                    this.robot.rechargeStation   = this;
                    this.robotSpawnedOnce        = true;
                    this.SpawnRobotAfterRecharge = true;
                }
            }
        }
コード例 #24
0
 // Token: 0x06000009 RID: 9 RVA: 0x000022DC File Offset: 0x000004DC
 public virtual string GetStringWorking()
 {
     return("AVInspect_WorkLeft".AdvancedTranslate(this.Extension, new object[]
     {
         GenText.ToStringWorkAmount((float)this.workLeft)
     }));
 }
コード例 #25
0
        private bool IsRobotInContainer()
        {
            bool flag = this.container == null;
            bool result;

            if (flag)
            {
                this.ClearContainer();
                result = false;
            }
            else
            {
                bool flag2 = GenText.NullOrEmpty(this.spawnThingDef);
                if (flag2)
                {
                    result = false;
                }
                else
                {
                    bool flag3 = this.thingDefSpawn == null;
                    if (flag3)
                    {
                        this.thingDefSpawn = DefDatabase <ThingDef> .GetNamedSilentFail(this.spawnThingDef);
                    }
                    bool flag4 = this.thingDefSpawn == null || this.NumContained(this.container, this.thingDefSpawn) == 0;
                    result = !flag4;
                }
            }
            return(result);
        }
        public override void DoWindowContents(Rect inRect)
        {
            EItemUpdateStatus eitemUpdateStatus;
            float             num;

            Workshop.GetUpdateStatus(out eitemUpdateStatus, out num);
            WorkshopInteractStage curStage = Workshop.CurStage;

            if (curStage == WorkshopInteractStage.None && eitemUpdateStatus == EItemUpdateStatus.k_EItemUpdateStatusInvalid)
            {
                this.Close(true);
            }
            else
            {
                string text = "";
                if (curStage != WorkshopInteractStage.None)
                {
                    text += curStage.GetLabel();
                    text += "\n\n";
                }
                if (eitemUpdateStatus != EItemUpdateStatus.k_EItemUpdateStatusInvalid)
                {
                    text += eitemUpdateStatus.GetLabel();
                    if (num > 0f)
                    {
                        text = text + " (" + num.ToStringPercent() + ")";
                    }
                    text += GenText.MarchingEllipsis(0f);
                }
                Widgets.Label(inRect, text);
            }
        }
コード例 #27
0
 private void FinalizeTick()
 {
     jobsGivenRecentTicks.Add(jobsGivenThisTick);
     jobsGivenRecentTicksTextual.Add(jobsGivenThisTickTextual);
     while (jobsGivenRecentTicks.Count > 10)
     {
         jobsGivenRecentTicks.RemoveAt(0);
         jobsGivenRecentTicksTextual.RemoveAt(0);
     }
     if (jobsGivenThisTick != 0)
     {
         var num = 0;
         for (var i = 0; i < jobsGivenRecentTicks.Count; i++)
         {
             num += jobsGivenRecentTicks[i];
         }
         if (num >= 10)
         {
             var text = GenText.ToCommaList(jobsGivenRecentTicksTextual, true);
             jobsGivenRecentTicks.Clear();
             jobsGivenRecentTicksTextual.Clear();
             StartErrorRecoverJob(string.Concat(caravan, " started ", 10, " jobs in ", 10, " ticks. List: ",
                                                text));
         }
     }
 }
コード例 #28
0
ファイル: IO.cs プロジェクト: theDeus/ModManager
        private static string NewSettingsFilePath(string source, Regex mask, string targetIdentifier)
        {
            var match = mask.Match(source);

            return(Path.Combine(GenFilePaths.ConfigFolderPath,
                                GenText.SanitizeFilename($"Mod_{targetIdentifier}_{match.Groups[1].Value}.xml")));
        }
コード例 #29
0
        public override void DrawGUIOverlay()
        {
            if (DisplayEnabled)
            {
                var text = GenText.ToStringTemperature(lastDetectedTemperature);
                Text.Font = GameFont.Tiny;
                float halfHeight = Text.CalcSize(text).y * 0.25f;

                var ranges   = Modes[TemperatureMode];
                var normal   = RangeLerp(lastDetectedTemperature, ranges.Item1, ranges.Item2);
                var position = DrawPos.MapToUIPosition();
                position.y -= halfHeight;

                if (!isBlocked)
                {
                    var labelColor = Color.Lerp(ColdColour, HotColour, normal);
                    labelColor.r += 0.5f; // Brighten
                    labelColor.g += 0.5f; // Brighten
                    labelColor.b += 0.5f; // Brighten
                    GenMapUI.DrawThingLabel(position, text, labelColor);
                }
                else
                {
                    GenMapUI.DrawThingLabel(position, "Blocked!", Color.white);
                }
            }
        }
コード例 #30
0
ファイル: StatPart.cs プロジェクト: Vulnoxx/AnimalGenetics
        public override string ExplanationPart(StatRequest req)
        {
            if (!Genes.EffectsThing(req.Thing))
            {
                return(null);
            }

            Pawn pawn = req.Thing as Pawn;

            if (!Controller.Settings.omniscientMode && pawn.Faction != Faction.OfPlayer)
            {
                return(null);
            }

            var statRecord = Find.World.GetComponent <AnimalGenetics>().GetFactor(pawn, _StatDef);

            if (statRecord == null)
            {
                return(null);
            }

            string postfix = "";

            if (statRecord.Parent != StatRecord.Source.None)
            {
                string icon = statRecord.Parent == StatRecord.Source.Mother ? "♀" : "♂";
                postfix = " (x" + GenText.ToStringPercent(statRecord.ParentValue) + icon + ")";
            }

            return("AG.Genetics".Translate() + ": x" + GenText.ToStringPercent(statRecord.Value) + postfix);
        }