コード例 #1
0
ファイル: Root.cs プロジェクト: aihhr1832/RimWorld-Decompile
 private static void CheckGlobalInit()
 {
     if (!Root.globalInitDone)
     {
         UnityDataInitializer.CopyUnityData();
         SteamManager.InitIfNeeded();
         string[] commandLineArgs = Environment.GetCommandLineArgs();
         if (commandLineArgs != null && commandLineArgs.Length > 1)
         {
             Log.Message("Command line arguments: " + GenText.ToSpaceList(commandLineArgs.Skip(1)), false);
         }
         VersionControl.LogVersionNumber();
         Application.targetFrameRate = 60;
         Prefs.Init();
         if (Prefs.DevMode)
         {
             StaticConstructorOnStartupUtility.ReportProbablyMissingAttributes();
         }
         if (Root.< > f__mg$cache0 == null)
         {
             Root.< > f__mg$cache0 = new Action(StaticConstructorOnStartupUtility.CallAll);
         }
         LongEventHandler.QueueLongEvent(Root.< > f__mg$cache0, null, false, null);
         Root.globalInitDone = true;
     }
 }
コード例 #2
0
        private static void GiveShortHash(Def def, Type defType)
        {
            if (def.shortHash != 0)
            {
                Log.Error(string.Concat(def, " already has short hash."));
                return;
            }
            if (!takenHashesPerDeftype.TryGetValue(defType, out var value))
            {
                value = new HashSet <ushort>();
                takenHashesPerDeftype.Add(defType, value);
            }
            ushort num  = (ushort)(GenText.StableStringHash(def.defName) % 65535);
            int    num2 = 0;

            while (num == 0 || value.Contains(num))
            {
                num = (ushort)(num + 1);
                num2++;
                if (num2 > 5000)
                {
                    Log.Message("Short hashes are saturated. There are probably too many Defs.");
                }
            }
            def.shortHash = num;
            value.Add(num);
        }
コード例 #3
0
 private static void CheckGlobalInit()
 {
     if (!Root.globalInitDone)
     {
         CultureInfo currentCulture = Thread.CurrentThread.CurrentCulture;
         if (currentCulture.Name != "en-US")
         {
             Log.Warning("Unexpected culture: " + currentCulture + ". Resetting to en-US.");
             Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");
         }
         SteamManager.InitIfNeeded();
         string[] commandLineArgs = Environment.GetCommandLineArgs();
         if (commandLineArgs != null && commandLineArgs.Length > 1)
         {
             Log.Message("Command line arguments: " + GenText.ToSpaceList(commandLineArgs.Skip(1)));
         }
         UnityData.CopyUnityData();
         VersionControl.LogVersionNumber();
         Application.targetFrameRate = 60;
         Prefs.Init();
         if (Prefs.DevMode)
         {
             StaticConstructorOnStartupUtility.ReportProbablyMissingAttributes();
         }
         LongEventHandler.QueueLongEvent(StaticConstructorOnStartupUtility.CallAll, null, false, null);
         Root.globalInitDone = true;
     }
 }
コード例 #4
0
 public Dialog_DebugOutputMenu()
 {
     forcePause = true;
     foreach (Type item in GenTypes.AllTypesWithAttribute <HasDebugOutputAttribute>())
     {
         MethodInfo[] methods = item.GetMethods(BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
         foreach (MethodInfo mi in methods)
         {
             if (mi.TryGetAttribute(out DebugOutputAttribute _))
             {
                 string label  = GenText.SplitCamelCase(mi.Name);
                 Action action = delegate
                 {
                     mi.Invoke(null, null);
                 };
                 CategoryAttribute customAttribute2 = null;
                 string            category         = (!mi.TryGetAttribute(out customAttribute2)) ? "General" : customAttribute2.name;
                 debugOutputs.Add(new DebugOutputOption
                 {
                     label    = label,
                     category = category,
                     action   = action
                 });
             }
         }
     }
     debugOutputs = (from r in debugOutputs
                     orderby r.category, r.label
                     select r).ToList();
 }
コード例 #5
0
 public static string SanitizeFilename(string str)
 {
     return(string.Join("_", str.Split(GenText.GetInvalidFilenameCharacters().ToArray <char>(), StringSplitOptions.RemoveEmptyEntries)).TrimEnd(new char[]
     {
         '.'
     }));
 }
コード例 #6
0
        private static void DoTableInternalApparel(ThingDef stuff)
        {
            IEnumerable <ThingDef> arg_1D1_0 = from d in DefDatabase <ThingDef> .AllDefs
                                               where d.IsApparel && (stuff == null || (d.MadeFromStuff && stuff.stuffProps.CanMake(d)))
                                               select d;

            TableDataGetter <ThingDef>[] expr_2A = new TableDataGetter <ThingDef> [14];
            expr_2A[0] = new TableDataGetter <ThingDef>("defName", (ThingDef d) => d.defName);
            expr_2A[1] = new TableDataGetter <ThingDef>("bodyParts", (ThingDef d) => GenText.ToSpaceList(from bp in d.apparel.bodyPartGroups
                                                                                                         select bp.defName));
            expr_2A[2] = new TableDataGetter <ThingDef>("layers", (ThingDef d) => GenText.ToSpaceList(from l in d.apparel.layers
                                                                                                      select l.ToString()));
            expr_2A[3] = new TableDataGetter <ThingDef>("tags", (ThingDef d) => GenText.ToSpaceList(from t in d.apparel.tags
                                                                                                    select t.ToString()));
            expr_2A[4]  = new TableDataGetter <ThingDef>("work", (ThingDef d) => d.GetStatValueAbstract(StatDefOf.WorkToMake, stuff).ToString("F0"));
            expr_2A[5]  = new TableDataGetter <ThingDef>("mktval", (ThingDef d) => d.GetStatValueAbstract(StatDefOf.MarketValue, stuff).ToString("F0"));
            expr_2A[6]  = new TableDataGetter <ThingDef>("insCold", (ThingDef d) => d.GetStatValueAbstract(StatDefOf.Insulation_Cold, stuff).ToString("F1"));
            expr_2A[7]  = new TableDataGetter <ThingDef>("insHeat", (ThingDef d) => d.GetStatValueAbstract(StatDefOf.Insulation_Heat, stuff).ToString("F1"));
            expr_2A[8]  = new TableDataGetter <ThingDef>("blunt", (ThingDef d) => d.GetStatValueAbstract(StatDefOf.ArmorRating_Blunt, stuff).ToString("F2"));
            expr_2A[9]  = new TableDataGetter <ThingDef>("sharp", (ThingDef d) => d.GetStatValueAbstract(StatDefOf.ArmorRating_Sharp, stuff).ToString("F2"));
            expr_2A[10] = new TableDataGetter <ThingDef>("SEMultArmor", (ThingDef d) => d.GetStatValueAbstract(StatDefOf.StuffEffectMultiplierArmor, stuff).ToString("F2"));
            expr_2A[11] = new TableDataGetter <ThingDef>("SEMultInsuCold", (ThingDef d) => d.GetStatValueAbstract(StatDefOf.StuffEffectMultiplierInsulation_Cold, stuff).ToString("F2"));
            expr_2A[12] = new TableDataGetter <ThingDef>("SEMultInsuHeat", (ThingDef d) => d.GetStatValueAbstract(StatDefOf.StuffEffectMultiplierInsulation_Heat, stuff).ToString("F2"));
            expr_2A[13] = new TableDataGetter <ThingDef>("equipTime", (ThingDef d) => d.GetStatValueAbstract(StatDefOf.EquipDelay, stuff).ToString("F1"));
            DebugTables.MakeTablesDialog <ThingDef>(arg_1D1_0, expr_2A);
        }
コード例 #7
0
        private static void GiveShortHash(Def def, Type defType)
        {
            if (def.shortHash != 0)
            {
                Log.Error(def + " already has short hash.");
                return;
            }
            HashSet <ushort> hashSet;

            if (!ShortHashGiver.takenHashesPerDeftype.TryGetValue(defType, out hashSet))
            {
                hashSet = new HashSet <ushort>();
                ShortHashGiver.takenHashesPerDeftype.Add(defType, hashSet);
            }
            ushort num  = (ushort)(GenText.StableStringHash(def.defName) % 65535);
            int    num2 = 0;

            while (num == 0 || hashSet.Contains(num))
            {
                num += 1;
                num2++;
                if (num2 > 5000)
                {
                    Log.Message("Short hashes are saturated. There are probably too many Defs.");
                }
            }
            def.shortHash = num;
            hashSet.Add(num);
        }
コード例 #8
0
        public static void LoadGameFromSaveFile(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);
            if (Scribe.EnterNode("game"))
            {
                Current.Game = new Game();
                Current.Game.LoadGame();
                PermadeathModeUtility.CheckUpdatePermadeathModeUniqueNameOnGameLoad(fileName);
                DeepProfiler.End();
            }
            else
            {
                Log.Error("Could not find game XML node.");
                Scribe.ForceStop();
            }
        }
コード例 #9
0
 private void GenerateCacheForMethod(MethodInfo method, DebugActionAttribute attribute)
 {
     if (attribute.IsAllowedInCurrentGameState)
     {
         string text = string.IsNullOrEmpty(attribute.name) ? GenText.SplitCamelCase(method.Name) : attribute.name;
         if (attribute.actionType == DebugActionType.ToolMap || attribute.actionType == DebugActionType.ToolMapForPawns || attribute.actionType == DebugActionType.ToolWorld)
         {
             text = "T: " + text;
         }
         string            category          = attribute.category;
         DebugActionOption debugActionOption = default(DebugActionOption);
         debugActionOption.label      = text;
         debugActionOption.category   = category;
         debugActionOption.actionType = attribute.actionType;
         DebugActionOption item = debugActionOption;
         if (attribute.actionType == DebugActionType.ToolMapForPawns)
         {
             item.pawnAction = (Delegate.CreateDelegate(typeof(Action <Pawn>), method) as Action <Pawn>);
         }
         else
         {
             item.action = (Delegate.CreateDelegate(typeof(Action), method) as Action);
         }
         debugActions.Add(item);
     }
 }
コード例 #10
0
 public Dialog_DebugLogMenu()
 {
     base.forcePause = true;
     MethodInfo[] methods = typeof(DataAnalysisLogger).GetMethods(BindingFlags.Static | BindingFlags.Public);
     foreach (MethodInfo mi in methods)
     {
         if (Current.ProgramState == ProgramState.Playing || !mi.HasAttribute <ModeRestrictionPlay>())
         {
             string name = mi.Name;
             if (name.StartsWith("DoLog_"))
             {
                 string title  = GenText.SplitCamelCase(name.Substring(6));
                 Action action = delegate
                 {
                     mi.Invoke(null, null);
                 };
                 string   text     = "Logs";
                 Category category = null;
                 if (((MemberInfo)mi).TryGetAttribute <Category>(out category))
                 {
                     text = text + " - " + category.name;
                 }
                 this.dataAnalyzerLogs.Add(new ListItem
                 {
                     title    = title,
                     category = text,
                     action   = action
                 });
             }
         }
     }
     this.dataAnalyzerLogs.Sort((ListItem lhs, ListItem rhs) => lhs.category.CompareTo(rhs.category));
 }
コード例 #11
0
ファイル: GenText.cs プロジェクト: sachdevs/RW-Decompile
 public static string WithoutVowelsIfLong(string s)
 {
     if (s.NullOrEmpty() || s.Length <= 5)
     {
         return(s);
     }
     return(s.Substring(0, 2) + GenText.WithoutVowels(s.Substring(2)));
 }
コード例 #12
0
        public override string ToString()
        {
            string text = GenText.ToCommaList(from r in this.regions
                                              where r != null
                                              select r.id.ToString(), true);
            string text2 = "span=" + this.span.ToString() + " hash=" + this.UniqueHashCode();

            return("(" + text2 + ", regions=" + text + ")");
        }
コード例 #13
0
ファイル: GenFile.cs プロジェクト: sachdevs/RW-Decompile
        public static IEnumerable <string> LinesFromFile(string filePath)
        {
            string rawText = GenFile.TextFromResourceFile(filePath);

            foreach (string line in GenText.LinesFromString(rawText))
            {
                yield return(line);
            }
        }
コード例 #14
0
ファイル: GenFile.cs プロジェクト: KraigXu/GameProject
        public static IEnumerable <string> LinesFromFile(string filePath)
        {
            string text = TextFromResourceFile(filePath);

            foreach (string item in GenText.LinesFromString(text))
            {
                yield return(item);
            }
        }
コード例 #15
0
        public static bool IsValidFilename(string str)
        {
            if (str.Length > 40)
            {
                return(false);
            }
            Regex regex = new Regex("[" + Regex.Escape(GenText.GetInvalidFilenameCharacters()) + "]");

            return(!regex.IsMatch(str));
        }
コード例 #16
0
 public override void ResolveReferences()
 {
     this.thinkRoot.ResolveSubnodesAndRecur();
     foreach (ThinkNode current in this.thinkRoot.ThisAndChildrenRecursive)
     {
         current.ResolveReferences();
     }
     ThinkTreeKeyAssigner.AssignKeys(this.thinkRoot, GenText.StableStringHash(this.defName));
     this.ResolveParentNodes(this.thinkRoot);
 }
コード例 #17
0
 private static void SetupForQuickTestPlay()
 {
     Current.ProgramState  = ProgramState.Entry;
     Current.Game          = new Game();
     Current.Game.InitData = new GameInitData();
     Current.Game.Scenario = ScenarioDefOf.Crashlanded.scenario;
     Find.Scenario.PreConfigure();
     Current.Game.storyteller = new Storyteller(StorytellerDefOf.Cassandra, DifficultyDefOf.Rough);
     Current.Game.World       = WorldGenerator.GenerateWorld(0.05f, GenText.RandomSeedString(), OverallRainfall.Normal, OverallTemperature.Normal, OverallPopulation.Normal);
     Find.GameInitData.ChooseRandomStartingTile();
     Find.GameInitData.mapSize = 150;
     Find.GameInitData.PrepForMapGen();
     Find.Scenario.PreMapGenerate();
 }
コード例 #18
0
 private void DoField(FieldInfo fi)
 {
     if (!fi.IsLiteral)
     {
         string label   = GenText.SplitCamelCase(fi.Name).CapitalizeFirst();
         bool   checkOn = (bool)fi.GetValue(null);
         bool   flag    = checkOn;
         CheckboxLabeledDebug(label, ref checkOn);
         if (checkOn != flag)
         {
             fi.SetValue(null, checkOn);
             fi.DeclaringType.GetMethod(fi.Name + "Toggled", BindingFlags.Static | BindingFlags.Public)?.Invoke(null, null);
         }
     }
 }
コード例 #19
0
        private static int NextUnusedKeyFor(ThinkNode node)
        {
            int num = 0;

            while (node != null)
            {
                num  = Gen.HashCombineInt(num, GenText.StableStringHash(node.GetType().Name));
                node = node.parent;
            }
            while (ThinkTreeKeyAssigner.assignedKeys.Contains(num))
            {
                num ^= Rand.Int;
            }
            ThinkTreeKeyAssigner.assignedKeys.Add(num);
            return(num);
        }
コード例 #20
0
        private void LoadFromFile_Strings(FileInfo file, DirectoryInfo stringsTopDir)
        {
            string text;

            try
            {
                text = GenFile.TextFromRawFile(file.FullName);
            }
            catch (Exception ex)
            {
                this.loadErrors.Add(string.Concat(new object[]
                {
                    "Exception loading from strings file ",
                    file,
                    ": ",
                    ex
                }));
                return;
            }
            string text2 = file.FullName;

            if (stringsTopDir != null)
            {
                text2 = text2.Substring(stringsTopDir.FullName.Length + 1);
            }
            text2 = text2.Substring(0, text2.Length - Path.GetExtension(text2).Length);
            text2 = text2.Replace('\\', '/');
            List <string> list = new List <string>();

            foreach (string current in GenText.LinesFromString(text))
            {
                list.Add(current);
            }
            List <string> list2;

            if (this.stringFiles.TryGetValue(text2, out list2))
            {
                foreach (string current2 in list)
                {
                    list2.Add(current2);
                }
            }
            else
            {
                this.stringFiles.Add(text2, list);
            }
        }
コード例 #21
0
        protected override void DoListingItems()
        {
            string b = null;

            foreach (ListItem dataAnalyzerLog in this.dataAnalyzerLogs)
            {
                ListItem current = dataAnalyzerLog;
                if (current.category != b)
                {
                    base.DoLabel(current.category);
                    b = current.category;
                }
                base.DebugAction(current.title, current.action);
            }
            base.DoGap();
            Text.Font = GameFont.Small;
            base.DoLabel("Tables");
            MethodInfo[] methods = typeof(DataAnalysisTableMaker).GetMethods(BindingFlags.Static | BindingFlags.Public);
            foreach (MethodInfo mi in methods)
            {
                string name = mi.Name;
                if (name.StartsWith("DoTable_"))
                {
                    base.DebugAction(GenText.SplitCamelCase(name.Substring(8)), delegate
                    {
                        mi.Invoke(null, null);
                    });
                }
            }
            base.DoGap();
            base.DoLabel("UI");
            base.DebugAction("Pawn column", delegate
            {
                List <DebugMenuOption> list = new List <DebugMenuOption>();
                List <PawnColumnDef> allDefsListForReading = DefDatabase <PawnColumnDef> .AllDefsListForReading;
                for (int j = 0; j < allDefsListForReading.Count; j++)
                {
                    PawnColumnDef localDef = allDefsListForReading[j];
                    list.Add(new DebugMenuOption(localDef.defName, DebugMenuOptionMode.Action, delegate
                    {
                        Find.WindowStack.Add(new Dialog_PawnTableTest(localDef));
                    }));
                }
                Find.WindowStack.Add(new Dialog_DebugOptionListLister(list));
            });
        }
コード例 #22
0
 private static void DrawLongEventWindowContents(Rect rect)
 {
     if (LongEventHandler.currentEvent != null)
     {
         if (Event.current.type == EventType.Repaint)
         {
             LongEventHandler.currentEvent.alreadyDisplayed = true;
         }
         Text.Font   = GameFont.Small;
         Text.Anchor = TextAnchor.MiddleCenter;
         float num = 0f;
         if (LongEventHandler.levelLoadOp != null)
         {
             float f = 1f;
             if (!LongEventHandler.levelLoadOp.isDone)
             {
                 f = LongEventHandler.levelLoadOp.progress;
             }
             string  text   = "LoadingAssets".Translate() + " " + f.ToStringPercent();
             Vector2 vector = Text.CalcSize(text);
             num = vector.x;
             Widgets.Label(rect, text);
         }
         else
         {
             object currentEventTextLock = LongEventHandler.CurrentEventTextLock;
             Monitor.Enter(currentEventTextLock);
             try
             {
                 Vector2 vector2 = Text.CalcSize(LongEventHandler.currentEvent.eventText);
                 num = vector2.x;
                 Widgets.Label(rect, LongEventHandler.currentEvent.eventText);
             }
             finally
             {
                 Monitor.Exit(currentEventTextLock);
             }
         }
         Text.Anchor = TextAnchor.MiddleLeft;
         Vector2 center = rect.center;
         rect.xMin = (float)(center.x + num / 2.0);
         Widgets.Label(rect, LongEventHandler.currentEvent.UseAnimatedDots ? GenText.MarchingEllipsis(0f) : "...");
         Text.Anchor = TextAnchor.UpperLeft;
     }
 }
コード例 #23
0
        public static IEnumerable <string> LinesFromFile(string filePath)
        {
            string rawText = GenFile.TextFromResourceFile(filePath);

            using (IEnumerator <string> enumerator = GenText.LinesFromString(rawText).GetEnumerator())
            {
                if (enumerator.MoveNext())
                {
                    string line = enumerator.Current;
                    yield return(line);

                    /*Error: Unable to find new state assignment for yield return*/;
                }
            }
            yield break;
IL_00ca:
            /*Error near IL_00cb: Unexpected return in MoveNext()*/;
        }
コード例 #24
0
 private void DoField(FieldInfo fi)
 {
     if (!fi.IsLiteral)
     {
         string label = GenText.SplitCamelCase(fi.Name).CapitalizeFirst();
         bool   flag  = (bool)fi.GetValue(null);
         bool   flag2 = flag;
         base.CheckboxLabeledDebug(label, ref flag);
         if (flag != flag2)
         {
             fi.SetValue(null, flag);
             MethodInfo method = fi.DeclaringType.GetMethod(fi.Name + "Toggled", BindingFlags.Static | BindingFlags.Public);
             if (method != null)
             {
                 method.Invoke(null, null);
             }
         }
     }
 }
コード例 #25
0
 private void GenerateCacheForMethod(MethodInfo method, DebugOutputAttribute attribute)
 {
     if (!attribute.onlyWhenPlaying || Current.ProgramState == ProgramState.Playing)
     {
         string label  = attribute.name ?? GenText.SplitCamelCase(method.Name);
         Action action = Delegate.CreateDelegate(typeof(Action), method) as Action;
         string text   = attribute.category;
         if (text == null)
         {
             text = "General";
         }
         debugOutputs.Add(new DebugOutputOption
         {
             label    = label,
             category = text,
             action   = action
         });
     }
 }
コード例 #26
0
        private void LoadFromFile_Strings(FileInfo file, DirectoryInfo stringsTopDir)
        {
            string text;

            try
            {
                text = GenFile.TextFromRawFile(file.FullName);
            }
            catch (Exception ex)
            {
                Log.Warning("Exception loading from strings file " + file + ": " + ex);
                return;
            }
            string text2 = file.FullName;

            if (stringsTopDir != null)
            {
                text2 = text2.Substring(stringsTopDir.FullName.Length + 1);
            }
            text2 = text2.Substring(0, text2.Length - Path.GetExtension(text2).Length);
            text2 = text2.Replace('\\', '/');
            List <string> list = new List <string>();

            foreach (string item in GenText.LinesFromString(text))
            {
                list.Add(item);
            }
            List <string> list2 = default(List <string>);

            if (this.stringFiles.TryGetValue(text2, out list2))
            {
                foreach (string item2 in list)
                {
                    list2.Add(item2);
                }
            }
            else
            {
                this.stringFiles.Add(text2, list);
            }
        }
コード例 #27
0
        private void DoField_NewTmp(FieldInfo fi, bool highlight)
        {
            if (fi.IsLiteral)
            {
                return;
            }
            string label   = GenText.SplitCamelCase(fi.Name).CapitalizeFirst();
            bool   checkOn = (bool)fi.GetValue(null);
            bool   flag    = checkOn;

            CheckboxLabeledDebug_NewTmp(label, ref checkOn, highlight);
            if (checkOn != flag)
            {
                fi.SetValue(null, checkOn);
                MethodInfo method = fi.DeclaringType.GetMethod(fi.Name + "Toggled", BindingFlags.Static | BindingFlags.Public);
                if (method != null)
                {
                    method.Invoke(null, null);
                }
            }
        }
コード例 #28
0
 public Dialog_DebugOutputMenu()
 {
     this.forcePause = true;
     foreach (Type current in GenTypes.AllTypesWithAttribute <HasDebugOutputAttribute>())
     {
         MethodInfo[] methods = current.GetMethods(BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
         for (int i = 0; i < methods.Length; i++)
         {
             MethodInfo           mi = methods[i];
             DebugOutputAttribute debugOutputAttribute;
             if (mi.TryGetAttribute(out debugOutputAttribute))
             {
                 string label  = GenText.SplitCamelCase(mi.Name);
                 Action action = delegate
                 {
                     mi.Invoke(null, null);
                 };
                 CategoryAttribute categoryAttribute = null;
                 string            category;
                 if (mi.TryGetAttribute(out categoryAttribute))
                 {
                     category = categoryAttribute.name;
                 }
                 else
                 {
                     category = "General";
                 }
                 this.debugOutputs.Add(new Dialog_DebugOutputMenu.DebugOutputOption
                 {
                     label    = label,
                     category = category,
                     action   = action
                 });
             }
         }
     }
     this.debugOutputs = (from r in this.debugOutputs
                          orderby r.category, r.label
                          select r).ToList <Dialog_DebugOutputMenu.DebugOutputOption>();
 }
コード例 #29
0
ファイル: LongEventHandler.cs プロジェクト: potsh/RimWorld
 private static void DrawLongEventWindowContents(Rect rect)
 {
     if (currentEvent != null)
     {
         if (Event.current.type == EventType.Repaint)
         {
             currentEvent.alreadyDisplayed = true;
         }
         Text.Font   = GameFont.Small;
         Text.Anchor = TextAnchor.MiddleCenter;
         float num = 0f;
         if (levelLoadOp != null)
         {
             float f = 1f;
             if (!levelLoadOp.isDone)
             {
                 f = levelLoadOp.progress;
             }
             string  text   = "LoadingAssets".Translate() + " " + f.ToStringPercent();
             Vector2 vector = Text.CalcSize(text);
             num = vector.x;
             Widgets.Label(rect, text);
         }
         else
         {
             lock (CurrentEventTextLock)
             {
                 Vector2 vector2 = Text.CalcSize(currentEvent.eventText);
                 num = vector2.x;
                 Widgets.Label(rect, currentEvent.eventText);
             }
         }
         Text.Anchor = TextAnchor.MiddleLeft;
         Vector2 center = rect.center;
         rect.xMin = center.x + num / 2f;
         Widgets.Label(rect, currentEvent.UseAnimatedDots ? GenText.MarchingEllipsis() : "...");
         Text.Anchor = TextAnchor.UpperLeft;
     }
 }
コード例 #30
0
        private void LoadFromFile_Strings(VirtualFile file, VirtualDirectory stringsTopDir)
        {
            string text;

            try
            {
                text = file.ReadAllText();
            }
            catch (Exception ex)
            {
                loadErrors.Add(string.Concat("Exception loading from strings file ", file, ": ", ex));
                return;
            }
            string text2 = file.FullPath;

            if (stringsTopDir != null)
            {
                text2 = text2.Substring(stringsTopDir.FullPath.Length + 1);
            }
            text2 = text2.Substring(0, text2.Length - Path.GetExtension(text2).Length);
            text2 = text2.Replace('\\', '/');
            List <string> list = new List <string>();

            foreach (string item in GenText.LinesFromString(text))
            {
                list.Add(item);
            }
            if (stringFiles.TryGetValue(text2, out var value))
            {
                foreach (string item2 in list)
                {
                    value.Add(item2);
                }
            }
            else
            {
                stringFiles.Add(text2, list);
            }
        }