Example #1
0
        private void DrawColonistMouseAttachment(int index, Vector2 dragStartPos, int entryGroup)
        {
            Pawn    pawn   = null;
            Vector2 vector = default(Vector2);
            int     num    = 0;

            for (int i = 0; i < this.cachedEntries.Count; i++)
            {
                if (this.cachedEntries[i].group == entryGroup && this.cachedEntries[i].pawn != null)
                {
                    if (num == index)
                    {
                        pawn   = this.cachedEntries[i].pawn;
                        vector = this.cachedDrawLocs[i];
                        break;
                    }
                    num++;
                }
            }
            if (pawn != null)
            {
                RenderTexture renderTexture   = PortraitsCache.Get(pawn, ColonistBarColonistDrawer.PawnTextureSize, ColonistBarColonistDrawer.PawnTextureCameraOffset, 1.28205f);
                Rect          rect            = new Rect(vector.x, vector.y, this.Size.x, this.Size.y);
                Rect          pawnTextureRect = this.drawer.GetPawnTextureRect(rect.position);
                pawnTextureRect.position += Event.current.mousePosition - dragStartPos;
                RenderTexture iconTex    = renderTexture;
                Rect?         customRect = new Rect?(pawnTextureRect);
                GenUI.DrawMouseAttachment(iconTex, string.Empty, 0f, default(Vector2), customRect);
            }
        }
 protected override bool CanDoNext()
 {
     if (!base.CanDoNext())
     {
         return(false);
     }
     if (TutorSystem.TutorialMode)
     {
         WorkTypeDef workTypeDef = StartingPawnUtility.RequiredWorkTypesDisabledForEveryone().FirstOrDefault();
         if (workTypeDef != null)
         {
             Messages.Message("RequiredWorkTypeDisabledForEveryone".Translate() + ": " + workTypeDef.gerundLabel.CapitalizeFirst() + ".", MessageTypeDefOf.RejectInput, historical: false);
             return(false);
         }
     }
     foreach (Pawn startingAndOptionalPawn in Find.GameInitData.startingAndOptionalPawns)
     {
         if (!startingAndOptionalPawn.Name.IsValid)
         {
             Messages.Message("EveryoneNeedsValidName".Translate(), MessageTypeDefOf.RejectInput, historical: false);
             return(false);
         }
     }
     PortraitsCache.Clear();
     return(true);
 }
        public void DrawColonistMouseAttachment(int index, Vector2 dragStartPos, int entryGroup)
        {
            Pawn    pawn   = null;
            Vector2 vector = default(Vector2);
            int     num    = 0;

            for (int i = 0; i < cachedEntries.Count; i++)
            {
                if (cachedEntries[i].group == entryGroup && cachedEntries[i].pawn != null)
                {
                    if (num == index)
                    {
                        pawn   = cachedEntries[i].pawn;
                        vector = cachedDrawLocs[i];
                        break;
                    }
                    num++;
                }
            }
            if (pawn != null)
            {
                RenderTexture iconTex         = PortraitsCache.Get(pawn, ColonistBarColonistDrawer.PawnTextureSize, ColonistBarColonistDrawer.PawnTextureCameraOffset, 1.28205f);
                Rect          rect            = new Rect(vector.x, vector.y, Size.x, Size.y);
                Rect          pawnTextureRect = drawer.GetPawnTextureRect(rect.position);
                pawnTextureRect.position += Event.current.mousePosition - dragStartPos;
                GenUI.DrawMouseAttachment(iconTex, "", 0f, default(Vector2), pawnTextureRect);
            }
        }
        public static RenderTexture Get(Pawn pawn, Vector2 size, Vector3 cameraOffset = default(Vector3), float cameraZoom = 1f)
        {
            Dictionary <Pawn, CachedPortrait> dictionary = PortraitsCache.GetOrCreateCachedPortraitsWithParams(size, cameraOffset, cameraZoom).CachedPortraits;
            CachedPortrait cachedPortrait = default(CachedPortrait);

            if (dictionary.TryGetValue(pawn, out cachedPortrait))
            {
                if (!cachedPortrait.RenderTexture.IsCreated())
                {
                    cachedPortrait.RenderTexture.Create();
                    PortraitsCache.RenderPortrait(pawn, cachedPortrait.RenderTexture, cameraOffset, cameraZoom);
                }
                else if (cachedPortrait.Dirty)
                {
                    PortraitsCache.RenderPortrait(pawn, cachedPortrait.RenderTexture, cameraOffset, cameraZoom);
                }
                dictionary.Remove(pawn);
                dictionary.Add(pawn, new CachedPortrait(cachedPortrait.RenderTexture, false, Time.time));
                return(cachedPortrait.RenderTexture);
            }
            RenderTexture renderTexture = PortraitsCache.NewRenderTexture(size);

            PortraitsCache.RenderPortrait(pawn, renderTexture, cameraOffset, cameraZoom);
            dictionary.Add(pawn, new CachedPortrait(renderTexture, false, Time.time));
            return(renderTexture);
        }
 private void ApparelChanged()
 {
     LongEventHandler.ExecuteWhenFinished(delegate
     {
         this.pawn.Drawer.renderer.graphics.ResolveApparelGraphics();
         PortraitsCache.SetDirty(this.pawn);
     });
 }
        public void DrawColonist(Rect rect, Pawn colonist, Map pawnMap, bool highlight, bool reordering)
        {
            float num = this.ColonistBar.GetEntryRectAlpha(rect);

            this.ApplyEntryInAnotherMapAlphaFactor(pawnMap, ref num);
            if (reordering)
            {
                num *= 0.5f;
            }
            Color color = new Color(1f, 1f, 1f, num);

            GUI.color = color;
            GUI.DrawTexture(rect, ColonistBar.BGTex);
            if (colonist.needs != null && colonist.needs.mood != null)
            {
                Rect  position = rect.ContractedBy(2f);
                float num2     = position.height * colonist.needs.mood.CurLevelPercentage;
                position.yMin   = position.yMax - num2;
                position.height = num2;
                GUI.DrawTexture(position, ColonistBarColonistDrawer.MoodBGTex);
            }
            if (highlight)
            {
                int thickness = (rect.width > 22f) ? 3 : 2;
                GUI.color = Color.white;
                Widgets.DrawBox(rect, thickness);
                GUI.color = color;
            }
            Rect rect2 = rect.ContractedBy(-2f * this.ColonistBar.Scale);
            bool flag  = (!colonist.Dead) ? Find.Selector.SelectedObjects.Contains(colonist) : Find.Selector.SelectedObjects.Contains(colonist.Corpse);

            if (flag && !WorldRendererUtility.WorldRenderedNow)
            {
                this.DrawSelectionOverlayOnGUI(colonist, rect2);
            }
            else if (WorldRendererUtility.WorldRenderedNow && colonist.IsCaravanMember() && Find.WorldSelector.IsSelected(colonist.GetCaravan()))
            {
                this.DrawCaravanSelectionOverlayOnGUI(colonist.GetCaravan(), rect2);
            }
            GUI.DrawTexture(this.GetPawnTextureRect(rect.position), PortraitsCache.Get(colonist, ColonistBarColonistDrawer.PawnTextureSize, ColonistBarColonistDrawer.PawnTextureCameraOffset, 1.28205f));
            GUI.color = new Color(1f, 1f, 1f, num * 0.8f);
            this.DrawIcons(rect, colonist);
            GUI.color = color;
            if (colonist.Dead)
            {
                GUI.DrawTexture(rect, ColonistBarColonistDrawer.DeadColonistTex);
            }
            float   num3 = 4f * this.ColonistBar.Scale;
            Vector2 pos  = new Vector2(rect.center.x, rect.yMax - num3);

            GenMapUI.DrawPawnLabel(colonist, pos, num, rect.width + this.ColonistBar.SpaceBetweenColonistsHorizontal - 2f, this.pawnLabelsCache, GameFont.Tiny, true, true);
            Text.Font = GameFont.Small;
            GUI.color = Color.white;
        }
Example #7
0
        public void DrawColonist(Rect rect, Pawn colonist, Map pawnMap, bool highlight, bool reordering)
        {
            float alpha = ColonistBar.GetEntryRectAlpha(rect);

            ApplyEntryInAnotherMapAlphaFactor(pawnMap, ref alpha);
            if (reordering)
            {
                alpha *= 0.5f;
            }
            Color color2 = (GUI.color = new Color(1f, 1f, 1f, alpha));

            GUI.DrawTexture(rect, ColonistBar.BGTex);
            if (colonist.needs != null && colonist.needs.mood != null)
            {
                Rect  position = rect.ContractedBy(2f);
                float num      = position.height * colonist.needs.mood.CurLevelPercentage;
                position.yMin   = position.yMax - num;
                position.height = num;
                GUI.DrawTexture(position, MoodBGTex);
            }
            if (highlight)
            {
                int thickness = ((rect.width <= 22f) ? 2 : 3);
                GUI.color = Color.white;
                Widgets.DrawBox(rect, thickness);
                GUI.color = color2;
            }
            Rect rect2 = rect.ContractedBy(-2f * ColonistBar.Scale);

            if ((colonist.Dead ? Find.Selector.SelectedObjects.Contains(colonist.Corpse) : Find.Selector.SelectedObjects.Contains(colonist)) && !WorldRendererUtility.WorldRenderedNow)
            {
                DrawSelectionOverlayOnGUI(colonist, rect2);
            }
            else if (WorldRendererUtility.WorldRenderedNow && colonist.IsCaravanMember() && Find.WorldSelector.IsSelected(colonist.GetCaravan()))
            {
                DrawCaravanSelectionOverlayOnGUI(colonist.GetCaravan(), rect2);
            }
            GUI.DrawTexture(GetPawnTextureRect(rect.position), PortraitsCache.Get(colonist, PawnTextureSize, PawnTextureCameraOffset, 1.28205f));
            GUI.color = new Color(1f, 1f, 1f, alpha * 0.8f);
            DrawIcons(rect, colonist);
            GUI.color = color2;
            if (colonist.Dead)
            {
                GUI.DrawTexture(rect, DeadColonistTex);
            }
            float   num2 = 4f * ColonistBar.Scale;
            Vector2 pos  = new Vector2(rect.center.x, rect.yMax - num2);

            GenMapUI.DrawPawnLabel(colonist, pos, alpha, rect.width + ColonistBar.SpaceBetweenColonistsHorizontal - 2f, pawnLabelsCache);
            Text.Font = GameFont.Small;
            GUI.color = Color.white;
        }
 public static void Clear()
 {
     for (int i = 0; i < PortraitsCache.cachedPortraits.Count; i++)
     {
         foreach (KeyValuePair <Pawn, CachedPortrait> cachedPortrait in PortraitsCache.cachedPortraits[i].CachedPortraits)
         {
             PortraitsCache.DestroyRenderTexture(cachedPortrait.Value.RenderTexture);
         }
     }
     PortraitsCache.cachedPortraits.Clear();
     for (int j = 0; j < PortraitsCache.renderTexturesPool.Count; j++)
     {
         PortraitsCache.DestroyRenderTexture(PortraitsCache.renderTexturesPool[j]);
     }
     PortraitsCache.renderTexturesPool.Clear();
 }
Example #9
0
 protected override bool CanDoNext()
 {
     if (!base.CanDoNext())
     {
         return(false);
     }
     foreach (Pawn startingPawn in Find.GameInitData.startingPawns)
     {
         if (!startingPawn.Name.IsValid)
         {
             Messages.Message("EveryoneNeedsValidName".Translate(), MessageTypeDefOf.RejectInput);
             return(false);
         }
     }
     PortraitsCache.Clear();
     return(true);
 }
        public void DrawColonist(Rect rect, Pawn colonist, Map pawnMap)
        {
            float entryRectAlpha = this.ColonistBar.GetEntryRectAlpha(rect);

            this.ApplyEntryInAnotherMapAlphaFactor(pawnMap, ref entryRectAlpha);
            bool  flag   = (!colonist.Dead) ? Find.Selector.SelectedObjects.Contains(colonist) : Find.Selector.SelectedObjects.Contains(colonist.Corpse);
            Color color2 = GUI.color = new Color(1f, 1f, 1f, entryRectAlpha);

            GUI.DrawTexture(rect, ColonistBar.BGTex);
            if (colonist.needs != null && colonist.needs.mood != null)
            {
                Rect  position = rect.ContractedBy(2f);
                float num      = position.height * colonist.needs.mood.CurLevelPercentage;
                position.yMin   = position.yMax - num;
                position.height = num;
                GUI.DrawTexture(position, ColonistBarColonistDrawer.MoodBGTex);
            }
            Rect rect2 = rect.ContractedBy((float)(-2.0 * this.ColonistBar.Scale));

            if (flag && !WorldRendererUtility.WorldRenderedNow)
            {
                this.DrawSelectionOverlayOnGUI(colonist, rect2);
            }
            else if (WorldRendererUtility.WorldRenderedNow && colonist.IsCaravanMember() && Find.WorldSelector.IsSelected(colonist.GetCaravan()))
            {
                this.DrawCaravanSelectionOverlayOnGUI(colonist.GetCaravan(), rect2);
            }
            GUI.DrawTexture(this.GetPawnTextureRect(rect.x, rect.y), PortraitsCache.Get(colonist, ColonistBarColonistDrawer.PawnTextureSize, ColonistBarColonistDrawer.PawnTextureCameraOffset, 1.28205f));
            GUI.color = new Color(1f, 1f, 1f, (float)(entryRectAlpha * 0.800000011920929));
            this.DrawIcons(rect, colonist);
            GUI.color = color2;
            if (colonist.Dead)
            {
                GUI.DrawTexture(rect, ColonistBarColonistDrawer.DeadColonistTex);
            }
            float   num2   = (float)(4.0 * this.ColonistBar.Scale);
            Vector2 center = rect.center;
            Vector2 pos    = new Vector2(center.x, rect.yMax - num2);

            GenMapUI.DrawPawnLabel(colonist, pos, entryRectAlpha, (float)(rect.width + this.ColonistBar.SpaceBetweenColonistsHorizontal - 2.0), this.pawnLabelsCache, GameFont.Tiny, true, true);
            Text.Font = GameFont.Small;
            GUI.color = Color.white;
        }
Example #11
0
        private void DrawColonistMouseAttachment(int index, Vector2 dragStartPos, int entryGroup)
        {
            Pawn    pawn   = null;
            Vector2 vector = default(Vector2);
            int     num    = 0;

            for (int i = 0; i < cachedEntries.Count; i++)
            {
                Entry entry = cachedEntries[i];
                if (entry.group == entryGroup)
                {
                    Entry entry2 = cachedEntries[i];
                    if (entry2.pawn != null)
                    {
                        if (num == index)
                        {
                            Entry entry3 = cachedEntries[i];
                            pawn   = entry3.pawn;
                            vector = cachedDrawLocs[i];
                            break;
                        }
                        num++;
                    }
                }
            }
            if (pawn != null)
            {
                RenderTexture renderTexture   = PortraitsCache.Get(pawn, ColonistBarColonistDrawer.PawnTextureSize, ColonistBarColonistDrawer.PawnTextureCameraOffset, 1.28205f);
                float         x               = vector.x;
                float         y               = vector.y;
                Vector2       size            = Size;
                float         x2              = size.x;
                Vector2       size2           = Size;
                Rect          rect            = new Rect(x, y, x2, size2.y);
                Rect          pawnTextureRect = drawer.GetPawnTextureRect(rect.position);
                pawnTextureRect.position += Event.current.mousePosition - dragStartPos;
                RenderTexture iconTex    = renderTexture;
                Rect?         customRect = pawnTextureRect;
                GenUI.DrawMouseAttachment(iconTex, string.Empty, 0f, default(Vector2), customRect);
            }
        }
 private static void SetAnimatedPortraitsDirty()
 {
     for (int i = 0; i < PortraitsCache.cachedPortraits.Count; i++)
     {
         Dictionary <Pawn, CachedPortrait> dictionary = PortraitsCache.cachedPortraits[i].CachedPortraits;
         PortraitsCache.toSetDirty.Clear();
         foreach (KeyValuePair <Pawn, CachedPortrait> item in dictionary)
         {
             if (PortraitsCache.IsAnimated(item.Key) && !item.Value.Dirty)
             {
                 PortraitsCache.toSetDirty.Add(item.Key);
             }
         }
         for (int j = 0; j < PortraitsCache.toSetDirty.Count; j++)
         {
             CachedPortrait cachedPortrait = dictionary[PortraitsCache.toSetDirty[j]];
             dictionary.Remove(PortraitsCache.toSetDirty[j]);
             dictionary.Add(PortraitsCache.toSetDirty[j], new CachedPortrait(cachedPortrait.RenderTexture, true, cachedPortrait.LastUseTime));
         }
         PortraitsCache.toSetDirty.Clear();
     }
 }
Example #13
0
        public void RenderOverBody(Vector3 drawLoc, Mesh bodyMesh, Quaternion quat, bool forPortrait)
        {
            int           num     = 0;
            List <Hediff> hediffs = pawn.health.hediffSet.hediffs;

            for (int i = 0; i < hediffs.Count; i++)
            {
                if (hediffs[i].def.displayWound)
                {
                    Hediff_Injury hediff_Injury = hediffs[i] as Hediff_Injury;
                    if (hediff_Injury == null || !hediff_Injury.IsPermanent())
                    {
                        num++;
                    }
                }
            }
            int num2 = Mathf.CeilToInt((float)num / 2f);

            if (num2 > MaxDisplayWounds)
            {
                num2 = MaxDisplayWounds;
            }
            while (wounds.Count < num2)
            {
                wounds.Add(new Wound(pawn));
                PortraitsCache.SetDirty(pawn);
            }
            while (wounds.Count > num2)
            {
                wounds.Remove(wounds.RandomElement());
                PortraitsCache.SetDirty(pawn);
            }
            for (int j = 0; j < wounds.Count; j++)
            {
                wounds[j].DrawWound(drawLoc, quat, pawn.Rotation, forPortrait);
            }
        }
        private void DrawPortraitArea(Rect rect)
        {
            Widgets.DrawMenuSection(rect);
            rect = rect.ContractedBy(17f);
            Vector2 center            = rect.center;
            float   x                 = center.x;
            Vector2 pawnPortraitSize  = PawnPortraitSize;
            float   x2                = x - pawnPortraitSize.x / 2f;
            float   y                 = rect.yMin - 20f;
            Vector2 pawnPortraitSize2 = PawnPortraitSize;
            float   x3                = pawnPortraitSize2.x;
            Vector2 pawnPortraitSize3 = PawnPortraitSize;

            GUI.DrawTexture(new Rect(x2, y, x3, pawnPortraitSize3.y), PortraitsCache.Get(curPawn, PawnPortraitSize));
            Rect rect2 = rect;

            rect2.width = 500f;
            CharacterCardUtility.DrawCharacterCard(rect2, curPawn, RandomizeCurPawn, rect);
            Rect rect3 = rect;

            rect3.yMin  += 100f;
            rect3.xMin   = rect2.xMax + 5f;
            rect3.height = 200f;
            Text.Font    = GameFont.Medium;
            Widgets.Label(rect3, "Health".Translate());
            Text.Font   = GameFont.Small;
            rect3.yMin += 35f;
            HealthCardUtility.DrawHediffListing(rect3, curPawn, showBloodLoss: true);
            Rect rect4 = new Rect(rect3.x, rect3.yMax, rect3.width, 200f);

            Text.Font = GameFont.Medium;
            Widgets.Label(rect4, "Relations".Translate());
            Text.Font   = GameFont.Small;
            rect4.yMin += 35f;
            SocialCardUtility.DrawRelationsAndOpinions(rect4, curPawn);
        }
Example #15
0
        private void DrawPortraitArea(Rect rect)
        {
            Widgets.DrawMenuSection(rect);
            rect = rect.ContractedBy(17f);
            Vector2 center            = rect.center;
            float   x                 = center.x;
            Vector2 pawnPortraitSize  = Page_ConfigureStartingPawns.PawnPortraitSize;
            double  x2                = x - pawnPortraitSize.x / 2.0;
            double  y                 = rect.yMin - 20.0;
            Vector2 pawnPortraitSize2 = Page_ConfigureStartingPawns.PawnPortraitSize;
            float   x3                = pawnPortraitSize2.x;
            Vector2 pawnPortraitSize3 = Page_ConfigureStartingPawns.PawnPortraitSize;

            GUI.DrawTexture(new Rect((float)x2, (float)y, x3, pawnPortraitSize3.y), PortraitsCache.Get(this.curPawn, Page_ConfigureStartingPawns.PawnPortraitSize, default(Vector3), 1f));
            Rect rect2 = rect;

            rect2.width = 500f;
            CharacterCardUtility.DrawCharacterCard(rect2, this.curPawn, this.RandomizeCurPawn, rect);
            Rect rect3 = rect;

            rect3.yMin  += 100f;
            rect3.xMin   = (float)(rect2.xMax + 5.0);
            rect3.height = 200f;
            Text.Font    = GameFont.Medium;
            Widgets.Label(rect3, "Health".Translate());
            Text.Font   = GameFont.Small;
            rect3.yMin += 35f;
            HealthCardUtility.DrawHediffListing(rect3, this.curPawn, true);
            Rect rect4 = new Rect(rect3.x, rect3.yMax, rect3.width, 200f);

            Text.Font = GameFont.Medium;
            Widgets.Label(rect4, "Relations".Translate());
            Text.Font   = GameFont.Small;
            rect4.yMin += 35f;
            SocialCardUtility.DrawRelationsAndOpinions(rect4, this.curPawn);
        }
Example #16
0
        public override void DoWindowContents(Rect inRect)
        {
            Rect rect = inRect.AtZero();

            rect.yMax -= 45f;
            Listing_Standard listing_Standard = new Listing_Standard();

            listing_Standard.ColumnWidth = (rect.width - 34f) / 3f;
            listing_Standard.Begin(rect);
            Text.Font = GameFont.Medium;
            listing_Standard.Label("Audiovisuals".Translate(), -1f);
            Text.Font = GameFont.Small;
            listing_Standard.Gap(12f);
            listing_Standard.Gap(12f);
            listing_Standard.Label("GameVolume".Translate(), -1f);
            Prefs.VolumeGame = listing_Standard.Slider(Prefs.VolumeGame, 0f, 1f);
            listing_Standard.Label("MusicVolume".Translate(), -1f);
            Prefs.VolumeMusic = listing_Standard.Slider(Prefs.VolumeMusic, 0f, 1f);
            listing_Standard.Label("AmbientVolume".Translate(), -1f);
            Prefs.VolumeAmbient = listing_Standard.Slider(Prefs.VolumeAmbient, 0f, 1f);
            if (listing_Standard.ButtonTextLabeled("Resolution".Translate(), Dialog_Options.ResToString(Screen.width, Screen.height)))
            {
                Find.WindowStack.Add(new Dialog_ResolutionPicker());
            }
            bool customCursorEnabled = Prefs.CustomCursorEnabled;

            listing_Standard.CheckboxLabeled("CustomCursor".Translate(), ref customCursorEnabled, null);
            Prefs.CustomCursorEnabled = customCursorEnabled;
            bool fullScreen = Screen.fullScreen;
            bool flag       = fullScreen;

            listing_Standard.CheckboxLabeled("Fullscreen".Translate(), ref fullScreen, null);
            if (fullScreen != flag)
            {
                ResolutionUtility.SafeSetFullscreen(fullScreen);
            }
            listing_Standard.Label("UIScale".Translate(), -1f);
            float[] uIScales = Dialog_Options.UIScales;
            for (int i = 0; i < uIScales.Length; i++)
            {
                float num = uIScales[i];
                if (listing_Standard.RadioButton(num.ToString() + "x", Prefs.UIScale == num, 8f))
                {
                    if (!ResolutionUtility.UIScaleSafeWithResolution(num, Screen.width, Screen.height))
                    {
                        Messages.Message("MessageScreenResTooSmallForUIScale".Translate(), MessageTypeDefOf.RejectInput);
                    }
                    else
                    {
                        ResolutionUtility.SafeSetUIScale(num);
                    }
                }
            }
            listing_Standard.Gap(12f);
            bool hatsOnlyOnMap = Prefs.HatsOnlyOnMap;

            listing_Standard.CheckboxLabeled("HatsShownOnlyOnMap".Translate(), ref hatsOnlyOnMap, null);
            if (hatsOnlyOnMap != Prefs.HatsOnlyOnMap)
            {
                PortraitsCache.Clear();
            }
            Prefs.HatsOnlyOnMap = hatsOnlyOnMap;
            listing_Standard.NewColumn();
            Text.Font = GameFont.Medium;
            listing_Standard.Label("Gameplay".Translate(), -1f);
            Text.Font = GameFont.Small;
            listing_Standard.Gap(12f);
            listing_Standard.Gap(12f);
            if (listing_Standard.ButtonText("KeyboardConfig".Translate(), null))
            {
                Find.WindowStack.Add(new Dialog_KeyBindings());
            }
            if (listing_Standard.ButtonText("ChooseLanguage".Translate(), null))
            {
                if (Current.ProgramState == ProgramState.Playing)
                {
                    Messages.Message("ChangeLanguageFromMainMenu".Translate(), MessageTypeDefOf.RejectInput);
                }
                else
                {
                    List <FloatMenuOption> list = new List <FloatMenuOption>();
                    foreach (LoadedLanguage current in LanguageDatabase.AllLoadedLanguages)
                    {
                        LoadedLanguage localLang = current;
                        list.Add(new FloatMenuOption(localLang.FriendlyNameNative, delegate
                        {
                            LanguageDatabase.SelectLanguage(localLang);
                        }, MenuOptionPriority.Default, null, null, 0f, null, null));
                    }
                    Find.WindowStack.Add(new FloatMenu(list));
                }
            }
            if ((Application.platform == RuntimePlatform.WindowsPlayer || Application.platform == RuntimePlatform.WindowsEditor) && listing_Standard.ButtonText("OpenSaveGameDataFolder".Translate(), null))
            {
                Application.OpenURL(GenFilePaths.SaveDataFolderPath);
            }
            bool adaptiveTrainingEnabled = Prefs.AdaptiveTrainingEnabled;

            listing_Standard.CheckboxLabeled("LearningHelper".Translate(), ref adaptiveTrainingEnabled, null);
            Prefs.AdaptiveTrainingEnabled = adaptiveTrainingEnabled;
            if (listing_Standard.ButtonText("ResetAdaptiveTutor".Translate(), null))
            {
                Messages.Message("AdaptiveTutorIsReset".Translate(), MessageTypeDefOf.TaskCompletion);
                PlayerKnowledgeDatabase.ResetPersistent();
            }
            bool runInBackground = Prefs.RunInBackground;

            listing_Standard.CheckboxLabeled("RunInBackground".Translate(), ref runInBackground, null);
            Prefs.RunInBackground = runInBackground;
            bool edgeScreenScroll = Prefs.EdgeScreenScroll;

            listing_Standard.CheckboxLabeled("EdgeScreenScroll".Translate(), ref edgeScreenScroll, null);
            Prefs.EdgeScreenScroll = edgeScreenScroll;
            bool pauseOnLoad = Prefs.PauseOnLoad;

            listing_Standard.CheckboxLabeled("PauseOnLoad".Translate(), ref pauseOnLoad, null);
            Prefs.PauseOnLoad = pauseOnLoad;
            bool pauseOnUrgentLetter = Prefs.PauseOnUrgentLetter;

            listing_Standard.CheckboxLabeled("PauseOnUrgentLetter".Translate(), ref pauseOnUrgentLetter, null);
            Prefs.PauseOnUrgentLetter = pauseOnUrgentLetter;
            bool showRealtimeClock = Prefs.ShowRealtimeClock;

            listing_Standard.CheckboxLabeled("ShowRealtimeClock".Translate(), ref showRealtimeClock, null);
            Prefs.ShowRealtimeClock = showRealtimeClock;
            bool plantWindSway = Prefs.PlantWindSway;

            listing_Standard.CheckboxLabeled("PlantWindSway".Translate(), ref plantWindSway, null);
            Prefs.PlantWindSway = plantWindSway;
            int maxNumberOfPlayerHomes = Prefs.MaxNumberOfPlayerHomes;

            listing_Standard.Label("MaxNumberOfPlayerHomes".Translate(new object[]
            {
                maxNumberOfPlayerHomes
            }), -1f);
            int num2 = Mathf.RoundToInt(listing_Standard.Slider((float)maxNumberOfPlayerHomes, 1f, 5f));

            Prefs.MaxNumberOfPlayerHomes = num2;
            if (maxNumberOfPlayerHomes != num2 && num2 > 1)
            {
                TutorUtility.DoModalDialogIfNotKnown(ConceptDefOf.MaxNumberOfPlayerHomes);
            }
            if (listing_Standard.ButtonTextLabeled("TemperatureMode".Translate(), Prefs.TemperatureMode.ToStringHuman()))
            {
                List <FloatMenuOption> list2 = new List <FloatMenuOption>();
                foreach (TemperatureDisplayMode localTmode2 in Enum.GetValues(typeof(TemperatureDisplayMode)))
                {
                    TemperatureDisplayMode localTmode = localTmode2;
                    list2.Add(new FloatMenuOption(localTmode.ToString(), delegate
                    {
                        Prefs.TemperatureMode = localTmode;
                    }, MenuOptionPriority.Default, null, null, 0f, null, null));
                }
                Find.WindowStack.Add(new FloatMenu(list2));
            }
            float  autosaveIntervalDays = Prefs.AutosaveIntervalDays;
            string text  = "Days".Translate();
            string text2 = "Day".Translate().ToLower();

            if (listing_Standard.ButtonTextLabeled("AutosaveInterval".Translate(), autosaveIntervalDays + " " + ((autosaveIntervalDays != 1f) ? text : text2)))
            {
                List <FloatMenuOption> list3 = new List <FloatMenuOption>();
                if (Prefs.DevMode)
                {
                    list3.Add(new FloatMenuOption("0.125 " + text + "(debug)", delegate
                    {
                        Prefs.AutosaveIntervalDays = 0.125f;
                    }, MenuOptionPriority.Default, null, null, 0f, null, null));
                    list3.Add(new FloatMenuOption("0.25 " + text + "(debug)", delegate
                    {
                        Prefs.AutosaveIntervalDays = 0.25f;
                    }, MenuOptionPriority.Default, null, null, 0f, null, null));
                }
                list3.Add(new FloatMenuOption("0.5 " + text + string.Empty, delegate
                {
                    Prefs.AutosaveIntervalDays = 0.5f;
                }, MenuOptionPriority.Default, null, null, 0f, null, null));
                list3.Add(new FloatMenuOption(1.ToString() + " " + text2, delegate
                {
                    Prefs.AutosaveIntervalDays = 1f;
                }, MenuOptionPriority.Default, null, null, 0f, null, null));
                list3.Add(new FloatMenuOption(3.ToString() + " " + text, delegate
                {
                    Prefs.AutosaveIntervalDays = 3f;
                }, MenuOptionPriority.Default, null, null, 0f, null, null));
                list3.Add(new FloatMenuOption(7.ToString() + " " + text, delegate
                {
                    Prefs.AutosaveIntervalDays = 7f;
                }, MenuOptionPriority.Default, null, null, 0f, null, null));
                list3.Add(new FloatMenuOption(14.ToString() + " " + text, delegate
                {
                    Prefs.AutosaveIntervalDays = 14f;
                }, MenuOptionPriority.Default, null, null, 0f, null, null));
                Find.WindowStack.Add(new FloatMenu(list3));
            }
            if (Current.ProgramState == ProgramState.Playing && Current.Game.Info.permadeathMode && Prefs.AutosaveIntervalDays > 1f)
            {
                GUI.color = Color.red;
                listing_Standard.Label("MaxPermadeathAutosaveIntervalInfo".Translate(new object[]
                {
                    1f
                }), -1f);
                GUI.color = Color.white;
            }
            if (Current.ProgramState == ProgramState.Playing && listing_Standard.ButtonText("ChangeStoryteller".Translate(), "OptionsButton-ChooseStoryteller") && TutorSystem.AllowAction("ChooseStoryteller"))
            {
                Find.WindowStack.Add(new Page_SelectStorytellerInGame());
            }
            if (listing_Standard.ButtonTextLabeled("ShowAnimalNames".Translate(), Prefs.AnimalNameMode.ToStringHuman()))
            {
                List <FloatMenuOption> list4 = new List <FloatMenuOption>();
                foreach (AnimalNameDisplayMode localMode2 in Enum.GetValues(typeof(AnimalNameDisplayMode)))
                {
                    AnimalNameDisplayMode localMode = localMode2;
                    list4.Add(new FloatMenuOption(localMode.ToStringHuman(), delegate
                    {
                        Prefs.AnimalNameMode = localMode;
                    }, MenuOptionPriority.Default, null, null, 0f, null, null));
                }
                Find.WindowStack.Add(new FloatMenu(list4));
            }
            bool devMode = Prefs.DevMode;

            listing_Standard.CheckboxLabeled("DevelopmentMode".Translate(), ref devMode, null);
            Prefs.DevMode = devMode;
            if (Prefs.DevMode)
            {
                bool resetModsConfigOnCrash = Prefs.ResetModsConfigOnCrash;
                listing_Standard.CheckboxLabeled("ResetModsConfigOnCrash".Translate(), ref resetModsConfigOnCrash, null);
                Prefs.ResetModsConfigOnCrash = resetModsConfigOnCrash;
                bool logVerbose = Prefs.LogVerbose;
                listing_Standard.CheckboxLabeled("LogVerbose".Translate(), ref logVerbose, null);
                Prefs.LogVerbose = logVerbose;
            }
            listing_Standard.NewColumn();
            Text.Font = GameFont.Medium;
            listing_Standard.Label(string.Empty, -1f);
            Text.Font = GameFont.Small;
            listing_Standard.Gap(12f);
            listing_Standard.Gap(12f);
            if (listing_Standard.ButtonText("ModSettings".Translate(), null))
            {
                Find.WindowStack.Add(new Dialog_ModSettings());
            }
            listing_Standard.Label(string.Empty, -1f);
            listing_Standard.Label("NamesYouWantToSee".Translate(), -1f);
            Prefs.PreferredNames.RemoveAll(new Predicate <string>(GenText.NullOrEmpty));
            for (int j = 0; j < Prefs.PreferredNames.Count; j++)
            {
                string  name    = Prefs.PreferredNames[j];
                PawnBio pawnBio = (from b in SolidBioDatabase.allBios
                                   where b.name.ToString() == name
                                   select b).FirstOrDefault <PawnBio>();
                if (pawnBio == null)
                {
                    name += " [N]";
                }
                else
                {
                    PawnBioType bioType = pawnBio.BioType;
                    if (bioType != PawnBioType.BackstoryInGame)
                    {
                        if (bioType == PawnBioType.PirateKing)
                        {
                            name += " [PK]";
                        }
                    }
                    else
                    {
                        name += " [B]";
                    }
                }
                Rect rect2 = listing_Standard.GetRect(24f);
                Widgets.Label(rect2, name);
                Rect butRect = new Rect(rect2.xMax - 24f, rect2.y, 24f, 24f);
                if (Widgets.ButtonImage(butRect, TexButton.DeleteX))
                {
                    Prefs.PreferredNames.RemoveAt(j);
                    SoundDefOf.TickLow.PlayOneShotOnCamera(null);
                }
            }
            if (Prefs.PreferredNames.Count < 6 && listing_Standard.ButtonText("AddName".Translate() + "...", null))
            {
                Find.WindowStack.Add(new Dialog_AddPreferredName());
            }
            listing_Standard.End();
        }
 public static void PortraitsCacheUpdate()
 {
     PortraitsCache.RemoveExpiredCachedPortraits();
     PortraitsCache.SetAnimatedPortraitsDirty();
 }
Example #18
0
        public override void DoWindowContents(Rect inRect)
        {
            Rect rect = inRect.AtZero();

            rect.yMax -= 35f;
            Listing_Standard listing_Standard = new Listing_Standard();

            listing_Standard.ColumnWidth = (rect.width - 34f) / 3f;
            listing_Standard.Begin(rect);
            Text.Font = GameFont.Medium;
            listing_Standard.Label("Audiovisuals".Translate());
            Text.Font = GameFont.Small;
            listing_Standard.Gap();
            listing_Standard.Gap();
            listing_Standard.Label("GameVolume".Translate());
            Prefs.VolumeGame = listing_Standard.Slider(Prefs.VolumeGame, 0f, 1f);
            listing_Standard.Label("MusicVolume".Translate());
            Prefs.VolumeMusic = listing_Standard.Slider(Prefs.VolumeMusic, 0f, 1f);
            listing_Standard.Label("AmbientVolume".Translate());
            Prefs.VolumeAmbient = listing_Standard.Slider(Prefs.VolumeAmbient, 0f, 1f);
            if (listing_Standard.ButtonTextLabeled("Resolution".Translate(), ResToString(Screen.width, Screen.height)))
            {
                List <FloatMenuOption> list = new List <FloatMenuOption>();
                foreach (Resolution res in from x in UnityGUIBugsFixer.ScreenResolutionsWithoutDuplicates
                         where x.width >= 1024 && x.height >= 768
                         orderby x.width, x.height
                         select x)
                {
                    list.Add(new FloatMenuOption(ResToString(res.width, res.height), delegate
                    {
                        if (!ResolutionUtility.UIScaleSafeWithResolution(Prefs.UIScale, res.width, res.height))
                        {
                            Messages.Message("MessageScreenResTooSmallForUIScale".Translate(), MessageTypeDefOf.RejectInput, historical: false);
                        }
                        else
                        {
                            ResolutionUtility.SafeSetResolution(res);
                        }
                    }));
                }
                if (!list.Any())
                {
                    list.Add(new FloatMenuOption("NoneBrackets".Translate(), null));
                }
                Find.WindowStack.Add(new FloatMenu(list));
            }
            if (listing_Standard.ButtonTextLabeled("UIScale".Translate(), Prefs.UIScale + "x"))
            {
                List <FloatMenuOption> list2 = new List <FloatMenuOption>();
                for (int i = 0; i < UIScales.Length; i++)
                {
                    float scale = UIScales[i];
                    list2.Add(new FloatMenuOption(UIScales[i] + "x", delegate
                    {
                        if (scale != 1f && !ResolutionUtility.UIScaleSafeWithResolution(scale, Screen.width, Screen.height))
                        {
                            Messages.Message("MessageScreenResTooSmallForUIScale".Translate(), MessageTypeDefOf.RejectInput, historical: false);
                        }
                        else
                        {
                            ResolutionUtility.SafeSetUIScale(scale);
                        }
                    }));
                }
                Find.WindowStack.Add(new FloatMenu(list2));
            }
            bool checkOn = Prefs.CustomCursorEnabled;

            listing_Standard.CheckboxLabeled("CustomCursor".Translate(), ref checkOn);
            Prefs.CustomCursorEnabled = checkOn;
            bool checkOn2 = Screen.fullScreen;
            bool flag     = checkOn2;

            listing_Standard.CheckboxLabeled("Fullscreen".Translate(), ref checkOn2);
            if (checkOn2 != flag)
            {
                ResolutionUtility.SafeSetFullscreen(checkOn2);
            }
            listing_Standard.Gap();
            bool checkOn3 = Prefs.HatsOnlyOnMap;

            listing_Standard.CheckboxLabeled("HatsShownOnlyOnMap".Translate(), ref checkOn3);
            if (checkOn3 != Prefs.HatsOnlyOnMap)
            {
                PortraitsCache.Clear();
            }
            Prefs.HatsOnlyOnMap = checkOn3;
            bool checkOn4 = Prefs.PlantWindSway;

            listing_Standard.CheckboxLabeled("PlantWindSway".Translate(), ref checkOn4);
            Prefs.PlantWindSway = checkOn4;
            bool checkOn5 = Prefs.ShowRealtimeClock;

            listing_Standard.CheckboxLabeled("ShowRealtimeClock".Translate(), ref checkOn5);
            Prefs.ShowRealtimeClock = checkOn5;
            if (listing_Standard.ButtonTextLabeled("ShowAnimalNames".Translate(), Prefs.AnimalNameMode.ToStringHuman()))
            {
                List <FloatMenuOption> list3 = new List <FloatMenuOption>();
                foreach (AnimalNameDisplayMode value in Enum.GetValues(typeof(AnimalNameDisplayMode)))
                {
                    AnimalNameDisplayMode localMode = value;
                    list3.Add(new FloatMenuOption(localMode.ToStringHuman(), delegate
                    {
                        Prefs.AnimalNameMode = localMode;
                    }));
                }
                Find.WindowStack.Add(new FloatMenu(list3));
            }
            listing_Standard.NewColumn();
            Text.Font = GameFont.Medium;
            listing_Standard.Label("Gameplay".Translate());
            Text.Font = GameFont.Small;
            listing_Standard.Gap();
            listing_Standard.Gap();
            if (listing_Standard.ButtonText("KeyboardConfig".Translate()))
            {
                Find.WindowStack.Add(new Dialog_KeyBindings());
            }
            if (listing_Standard.ButtonText("ChooseLanguage".Translate()))
            {
                if (Current.ProgramState == ProgramState.Playing)
                {
                    Messages.Message("ChangeLanguageFromMainMenu".Translate(), MessageTypeDefOf.RejectInput, historical: false);
                    SoundDefOf.Click.PlayOneShotOnCamera();
                }
                else
                {
                    List <FloatMenuOption> list4 = new List <FloatMenuOption>();
                    foreach (LoadedLanguage allLoadedLanguage in LanguageDatabase.AllLoadedLanguages)
                    {
                        LoadedLanguage localLang = allLoadedLanguage;
                        list4.Add(new FloatMenuOption(localLang.DisplayName, delegate
                        {
                            LanguageDatabase.SelectLanguage(localLang);
                        }));
                    }
                    Find.WindowStack.Add(new FloatMenu(list4));
                }
            }
            if (Application.platform == RuntimePlatform.WindowsPlayer || Application.platform == RuntimePlatform.WindowsEditor)
            {
                if (listing_Standard.ButtonText("OpenSaveGameDataFolder".Translate()))
                {
                    Application.OpenURL(GenFilePaths.SaveDataFolderPath);
                    SoundDefOf.Click.PlayOneShotOnCamera();
                }
                if (listing_Standard.ButtonText("OpenLogFileFolder".Translate()))
                {
                    Application.OpenURL(Application.persistentDataPath);
                    SoundDefOf.Click.PlayOneShotOnCamera();
                }
            }
            else
            {
                if (listing_Standard.ButtonText("ShowSaveGameDataLocation".Translate()))
                {
                    Find.WindowStack.Add(new Dialog_MessageBox(Path.GetFullPath(GenFilePaths.SaveDataFolderPath)));
                }
                if (listing_Standard.ButtonText("ShowLogFileLocation".Translate()))
                {
                    Find.WindowStack.Add(new Dialog_MessageBox(Path.GetFullPath(Application.persistentDataPath)));
                }
            }
            if (listing_Standard.ButtonText("ResetAdaptiveTutor".Translate()))
            {
                Messages.Message("AdaptiveTutorIsReset".Translate(), MessageTypeDefOf.TaskCompletion, historical: false);
                PlayerKnowledgeDatabase.ResetPersistent();
                SoundDefOf.Click.PlayOneShotOnCamera();
            }
            bool checkOn6 = Prefs.AdaptiveTrainingEnabled;

            listing_Standard.CheckboxLabeled("LearningHelper".Translate(), ref checkOn6);
            Prefs.AdaptiveTrainingEnabled = checkOn6;
            bool checkOn7 = Prefs.RunInBackground;

            listing_Standard.CheckboxLabeled("RunInBackground".Translate(), ref checkOn7);
            Prefs.RunInBackground = checkOn7;
            bool checkOn8 = Prefs.EdgeScreenScroll;

            listing_Standard.CheckboxLabeled("EdgeScreenScroll".Translate(), ref checkOn8);
            Prefs.EdgeScreenScroll = checkOn8;
            float mapDragSensitivity = Prefs.MapDragSensitivity;

            listing_Standard.Label("MapDragSensitivity".Translate() + ": " + mapDragSensitivity.ToStringPercent("F0"));
            Prefs.MapDragSensitivity = (float)Math.Round(listing_Standard.Slider(mapDragSensitivity, 0.8f, 2.5f), 2);
            bool checkOn9 = Prefs.PauseOnLoad;

            listing_Standard.CheckboxLabeled("PauseOnLoad".Translate(), ref checkOn9);
            Prefs.PauseOnLoad = checkOn9;
            AutomaticPauseMode automaticPauseMode = Prefs.AutomaticPauseMode;

            if (listing_Standard.ButtonTextLabeled("AutomaticPauseModeSetting".Translate(), Prefs.AutomaticPauseMode.ToStringHuman()))
            {
                List <FloatMenuOption> list5 = new List <FloatMenuOption>();
                foreach (AutomaticPauseMode value2 in Enum.GetValues(typeof(AutomaticPauseMode)))
                {
                    AutomaticPauseMode localPmode = value2;
                    list5.Add(new FloatMenuOption(localPmode.ToStringHuman(), delegate
                    {
                        Prefs.AutomaticPauseMode = localPmode;
                    }));
                }
                Find.WindowStack.Add(new FloatMenu(list5));
            }
            Prefs.AutomaticPauseMode = automaticPauseMode;
            int maxNumberOfPlayerSettlements = Prefs.MaxNumberOfPlayerSettlements;

            listing_Standard.Label("MaxNumberOfPlayerSettlements".Translate(maxNumberOfPlayerSettlements));
            int num2 = (Prefs.MaxNumberOfPlayerSettlements = Mathf.RoundToInt(listing_Standard.Slider(maxNumberOfPlayerSettlements, 1f, 5f)));

            if (maxNumberOfPlayerSettlements != num2 && num2 > 1)
            {
                TutorUtility.DoModalDialogIfNotKnown(ConceptDefOf.MaxNumberOfPlayerSettlements);
            }
            if (listing_Standard.ButtonTextLabeled("TemperatureMode".Translate(), Prefs.TemperatureMode.ToStringHuman()))
            {
                List <FloatMenuOption> list6 = new List <FloatMenuOption>();
                foreach (TemperatureDisplayMode value3 in Enum.GetValues(typeof(TemperatureDisplayMode)))
                {
                    TemperatureDisplayMode localTmode = value3;
                    list6.Add(new FloatMenuOption(localTmode.ToStringHuman(), delegate
                    {
                        Prefs.TemperatureMode = localTmode;
                    }));
                }
                Find.WindowStack.Add(new FloatMenu(list6));
            }
            float  autosaveIntervalDays = Prefs.AutosaveIntervalDays;
            string text  = "Days".Translate();
            string text2 = "Day".Translate().ToLower();

            if (listing_Standard.ButtonTextLabeled("AutosaveInterval".Translate(), autosaveIntervalDays + " " + ((autosaveIntervalDays == 1f) ? text2 : text)))
            {
                List <FloatMenuOption> list7 = new List <FloatMenuOption>();
                if (Prefs.DevMode)
                {
                    list7.Add(new FloatMenuOption("0.125 " + text + "(debug)", delegate
                    {
                        Prefs.AutosaveIntervalDays = 0.125f;
                    }));
                    list7.Add(new FloatMenuOption("0.25 " + text + "(debug)", delegate
                    {
                        Prefs.AutosaveIntervalDays = 0.25f;
                    }));
                }
                list7.Add(new FloatMenuOption(("0.5 " + text) ?? "", delegate
                {
                    Prefs.AutosaveIntervalDays = 0.5f;
                }));
                list7.Add(new FloatMenuOption(1 + " " + text2, delegate
                {
                    Prefs.AutosaveIntervalDays = 1f;
                }));
                list7.Add(new FloatMenuOption(3 + " " + text, delegate
                {
                    Prefs.AutosaveIntervalDays = 3f;
                }));
                list7.Add(new FloatMenuOption(7 + " " + text, delegate
                {
                    Prefs.AutosaveIntervalDays = 7f;
                }));
                list7.Add(new FloatMenuOption(14 + " " + text, delegate
                {
                    Prefs.AutosaveIntervalDays = 14f;
                }));
                Find.WindowStack.Add(new FloatMenu(list7));
            }
            if (Current.ProgramState == ProgramState.Playing && Current.Game.Info.permadeathMode && Prefs.AutosaveIntervalDays > 1f)
            {
                GUI.color = Color.red;
                listing_Standard.Label("MaxPermadeathAutosaveIntervalInfo".Translate(1f));
                GUI.color = Color.white;
            }
            if (Current.ProgramState == ProgramState.Playing && listing_Standard.ButtonText("ChangeStoryteller".Translate(), "OptionsButton-ChooseStoryteller") && TutorSystem.AllowAction("ChooseStoryteller"))
            {
                Find.WindowStack.Add(new Page_SelectStorytellerInGame());
            }
            if (!DevModePermanentlyDisabledUtility.Disabled && listing_Standard.ButtonText("PermanentlyDisableDevMode".Translate()))
            {
                Find.WindowStack.Add(Dialog_MessageBox.CreateConfirmation("ConfirmPermanentlyDisableDevMode".Translate(), delegate
                {
                    DevModePermanentlyDisabledUtility.Disable();
                }, destructive: true));
            }
            bool checkOn10 = Prefs.TestMapSizes;

            listing_Standard.CheckboxLabeled("EnableTestMapSizes".Translate(), ref checkOn10);
            Prefs.TestMapSizes = checkOn10;
            if (!DevModePermanentlyDisabledUtility.Disabled || Prefs.DevMode)
            {
                bool checkOn11 = Prefs.DevMode;
                listing_Standard.CheckboxLabeled("DevelopmentMode".Translate(), ref checkOn11);
                Prefs.DevMode = checkOn11;
            }
            if (Prefs.DevMode)
            {
                bool checkOn12 = Prefs.ResetModsConfigOnCrash;
                listing_Standard.CheckboxLabeled("ResetModsConfigOnCrash".Translate(), ref checkOn12);
                Prefs.ResetModsConfigOnCrash = checkOn12;
                bool checkOn13 = Prefs.LogVerbose;
                listing_Standard.CheckboxLabeled("LogVerbose".Translate(), ref checkOn13);
                Prefs.LogVerbose = checkOn13;
                if (Current.ProgramState != ProgramState.Playing)
                {
                    bool checkOn14 = Prefs.SimulateNotOwningRoyalty;
                    listing_Standard.CheckboxLabeled("SimulateNotOwningRoyalty".Translate(), ref checkOn14);
                    Prefs.SimulateNotOwningRoyalty = checkOn14;
                }
            }
            listing_Standard.NewColumn();
            Text.Font = GameFont.Medium;
            listing_Standard.Label("");
            Text.Font = GameFont.Small;
            listing_Standard.Gap();
            listing_Standard.Gap();
            if (listing_Standard.ButtonText("ModSettings".Translate()))
            {
                Find.WindowStack.Add(new Dialog_ModSettings());
            }
            listing_Standard.Label("");
            listing_Standard.Label("NamesYouWantToSee".Translate());
            Prefs.PreferredNames.RemoveAll((string n) => n.NullOrEmpty());
            for (int j = 0; j < Prefs.PreferredNames.Count; j++)
            {
                string  name    = Prefs.PreferredNames[j];
                PawnBio pawnBio = SolidBioDatabase.allBios.Where((PawnBio b) => b.name.ToString() == name).FirstOrDefault();
                if (pawnBio == null)
                {
                    name += " [N]";
                }
                else
                {
                    switch (pawnBio.BioType)
                    {
                    case PawnBioType.BackstoryInGame:
                        name += " [B]";
                        break;

                    case PawnBioType.PirateKing:
                        name += " [PK]";
                        break;
                    }
                }
                Rect rect2 = listing_Standard.GetRect(24f);
                Widgets.Label(rect2, name);
                if (Widgets.ButtonImage(new Rect(rect2.xMax - 24f, rect2.y, 24f, 24f), TexButton.DeleteX, Color.white, GenUI.SubtleMouseoverColor))
                {
                    Prefs.PreferredNames.RemoveAt(j);
                    SoundDefOf.Tick_Low.PlayOneShotOnCamera();
                }
            }
            if (Prefs.PreferredNames.Count < 6 && listing_Standard.ButtonText("AddName".Translate() + "..."))
            {
                Find.WindowStack.Add(new Dialog_AddPreferredName());
            }
            listing_Standard.Label("");
            if (listing_Standard.ButtonText("RestoreToDefaultSettings".Translate()))
            {
                Find.WindowStack.Add(new Dialog_MessageBox("ResetAndRestartConfirmationDialog".Translate(), "Yes".Translate(), delegate
                {
                    RestoreToDefaultSettings();
                }, "No".Translate()));
            }
            listing_Standard.End();
        }
        private void DrawPortraitArea(Rect rect)
        {
            Widgets.DrawMenuSection(rect);
            rect = rect.ContractedBy(17f);
            GUI.DrawTexture(new Rect(rect.center.x - Page_ConfigureStartingPawns.PawnPortraitSize.x / 2f, rect.yMin - 20f, Page_ConfigureStartingPawns.PawnPortraitSize.x, Page_ConfigureStartingPawns.PawnPortraitSize.y), PortraitsCache.Get(this.curPawn, Page_ConfigureStartingPawns.PawnPortraitSize, default(Vector3), 1f));
            Rect rect2 = rect;

            rect2.width = 500f;
            CharacterCardUtility.DrawCharacterCard(rect2, this.curPawn, new Action(this.RandomizeCurPawn), rect);
            Rect rect3 = rect;

            rect3.yMin  += 100f;
            rect3.xMin   = rect2.xMax + 5f;
            rect3.height = 200f;
            Text.Font    = GameFont.Medium;
            Widgets.Label(rect3, "Health".Translate());
            Text.Font   = GameFont.Small;
            rect3.yMin += 35f;
            HealthCardUtility.DrawHediffListing(rect3, this.curPawn, true);
            Rect rect4 = new Rect(rect3.x, rect3.yMax, rect3.width, 200f);

            Text.Font = GameFont.Medium;
            Widgets.Label(rect4, "Relations".Translate());
            Text.Font   = GameFont.Small;
            rect4.yMin += 35f;
            SocialCardUtility.DrawRelationsAndOpinions(rect4, this.curPawn);
        }
        private void DrawPawnList(Rect rect)
        {
            Rect rect2 = rect;

            rect2.height = 60f;
            rect2        = rect2.ContractedBy(4f);
            int groupID = ReorderableWidget.NewGroup(delegate(int from, int to)
            {
                if (TutorSystem.AllowAction("ReorderPawn"))
                {
                    Pawn item = Find.GameInitData.startingAndOptionalPawns[from];
                    Find.GameInitData.startingAndOptionalPawns.Insert(to, item);
                    Find.GameInitData.startingAndOptionalPawns.RemoveAt((from < to) ? from : (from + 1));
                    TutorSystem.Notify_Event("ReorderPawn");
                    if (to < Find.GameInitData.startingPawnCount && from >= Find.GameInitData.startingPawnCount)
                    {
                        TutorSystem.Notify_Event("ReorderPawnOptionalToStarting");
                    }
                }
            }, ReorderableDirection.Vertical);

            rect2.y += 15f;
            DrawPawnListLabelAbove(rect2, "StartingPawnsSelected".Translate());
            for (int i = 0; i < Find.GameInitData.startingAndOptionalPawns.Count; i++)
            {
                if (i == Find.GameInitData.startingPawnCount)
                {
                    rect2.y += 30f;
                    DrawPawnListLabelAbove(rect2, "StartingPawnsLeftBehind".Translate());
                }
                Pawn pawn = Find.GameInitData.startingAndOptionalPawns[i];
                GUI.BeginGroup(rect2);
                Rect rect3 = new Rect(Vector2.zero, rect2.size);
                Widgets.DrawOptionBackground(rect3, curPawn == pawn);
                MouseoverSounds.DoRegion(rect3);
                GUI.color = new Color(1f, 1f, 1f, 0.2f);
                GUI.DrawTexture(new Rect(110f - PawnSelectorPortraitSize.x / 2f, 40f - PawnSelectorPortraitSize.y / 2f, PawnSelectorPortraitSize.x, PawnSelectorPortraitSize.y), PortraitsCache.Get(pawn, PawnSelectorPortraitSize));
                GUI.color = Color.white;
                Rect       rect4      = rect3.ContractedBy(4f).Rounded();
                NameTriple nameTriple = pawn.Name as NameTriple;
                Widgets.Label(label: (nameTriple == null) ? pawn.LabelShort : (string.IsNullOrEmpty(nameTriple.Nick) ? nameTriple.First : nameTriple.Nick), rect: rect4.TopPart(0.5f).Rounded());
                if (Text.CalcSize(pawn.story.TitleCap).x > rect4.width)
                {
                    Widgets.Label(rect4.BottomPart(0.5f).Rounded(), pawn.story.TitleShortCap);
                }
                else
                {
                    Widgets.Label(rect4.BottomPart(0.5f).Rounded(), pawn.story.TitleCap);
                }
                if (Event.current.type == EventType.MouseDown && Mouse.IsOver(rect3))
                {
                    curPawn = pawn;
                    SoundDefOf.Tick_Tiny.PlayOneShotOnCamera();
                }
                GUI.EndGroup();
                if (ReorderableWidget.Reorderable(groupID, rect2.ExpandedBy(4f)))
                {
                    Widgets.DrawRectFast(rect2, Widgets.WindowBGFillColor * new Color(1f, 1f, 1f, 0.5f));
                }
                if (Mouse.IsOver(rect2))
                {
                    TooltipHandler.TipRegion(rect2, new TipSignal("DragToReorder".Translate(), pawn.GetHashCode() * 3499));
                }
                rect2.y += 60f;
            }
        }
        public override void DoWindowContents(Rect inRect)
        {
            Rect rect = inRect.AtZero();

            rect.yMax -= 35f;
            Listing_Standard listing_Standard = new Listing_Standard();

            listing_Standard.ColumnWidth = (rect.width - 34f) / 3f;
            listing_Standard.Begin(rect);
            Text.Font = GameFont.Medium;
            listing_Standard.Label("Audiovisuals".Translate(), -1f, null);
            Text.Font = GameFont.Small;
            listing_Standard.Gap(12f);
            listing_Standard.Gap(12f);
            listing_Standard.Label("GameVolume".Translate(), -1f, null);
            Prefs.VolumeGame = listing_Standard.Slider(Prefs.VolumeGame, 0f, 1f);
            listing_Standard.Label("MusicVolume".Translate(), -1f, null);
            Prefs.VolumeMusic = listing_Standard.Slider(Prefs.VolumeMusic, 0f, 1f);
            listing_Standard.Label("AmbientVolume".Translate(), -1f, null);
            Prefs.VolumeAmbient = listing_Standard.Slider(Prefs.VolumeAmbient, 0f, 1f);
            if (listing_Standard.ButtonTextLabeled("Resolution".Translate(), Dialog_Options.ResToString(Screen.width, Screen.height)))
            {
                List <FloatMenuOption> list = new List <FloatMenuOption>();
                using (IEnumerator <Resolution> enumerator = (from x in UnityGUIBugsFixer.ScreenResolutionsWithoutDuplicates
                                                              where x.width >= 1024 && x.height >= 768
                                                              orderby x.width, x.height
                                                              select x).GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        Resolution res = enumerator.Current;
                        list.Add(new FloatMenuOption(Dialog_Options.ResToString(res.width, res.height), delegate()
                        {
                            if (!ResolutionUtility.UIScaleSafeWithResolution(Prefs.UIScale, res.width, res.height))
                            {
                                Messages.Message("MessageScreenResTooSmallForUIScale".Translate(), MessageTypeDefOf.RejectInput, false);
                            }
                            else
                            {
                                ResolutionUtility.SafeSetResolution(res);
                            }
                        }, MenuOptionPriority.Default, null, null, 0f, null, null));
                    }
                }
                if (!list.Any <FloatMenuOption>())
                {
                    list.Add(new FloatMenuOption("NoneBrackets".Translate(), null, MenuOptionPriority.Default, null, null, 0f, null, null));
                }
                Find.WindowStack.Add(new FloatMenu(list));
            }
            if (listing_Standard.ButtonTextLabeled("UIScale".Translate(), Prefs.UIScale.ToString() + "x"))
            {
                List <FloatMenuOption> list2 = new List <FloatMenuOption>();
                for (int i = 0; i < Dialog_Options.UIScales.Length; i++)
                {
                    float scale = Dialog_Options.UIScales[i];
                    list2.Add(new FloatMenuOption(Dialog_Options.UIScales[i].ToString() + "x", delegate()
                    {
                        if (scale != 1f && !ResolutionUtility.UIScaleSafeWithResolution(scale, Screen.width, Screen.height))
                        {
                            Messages.Message("MessageScreenResTooSmallForUIScale".Translate(), MessageTypeDefOf.RejectInput, false);
                        }
                        else
                        {
                            ResolutionUtility.SafeSetUIScale(scale);
                        }
                    }, MenuOptionPriority.Default, null, null, 0f, null, null));
                }
                Find.WindowStack.Add(new FloatMenu(list2));
            }
            bool customCursorEnabled = Prefs.CustomCursorEnabled;

            listing_Standard.CheckboxLabeled("CustomCursor".Translate(), ref customCursorEnabled, null);
            Prefs.CustomCursorEnabled = customCursorEnabled;
            bool fullScreen = Screen.fullScreen;
            bool flag       = fullScreen;

            listing_Standard.CheckboxLabeled("Fullscreen".Translate(), ref fullScreen, null);
            if (fullScreen != flag)
            {
                ResolutionUtility.SafeSetFullscreen(fullScreen);
            }
            listing_Standard.Gap(12f);
            bool hatsOnlyOnMap = Prefs.HatsOnlyOnMap;

            listing_Standard.CheckboxLabeled("HatsShownOnlyOnMap".Translate(), ref hatsOnlyOnMap, null);
            if (hatsOnlyOnMap != Prefs.HatsOnlyOnMap)
            {
                PortraitsCache.Clear();
            }
            Prefs.HatsOnlyOnMap = hatsOnlyOnMap;
            bool plantWindSway = Prefs.PlantWindSway;

            listing_Standard.CheckboxLabeled("PlantWindSway".Translate(), ref plantWindSway, null);
            Prefs.PlantWindSway = plantWindSway;
            bool showRealtimeClock = Prefs.ShowRealtimeClock;

            listing_Standard.CheckboxLabeled("ShowRealtimeClock".Translate(), ref showRealtimeClock, null);
            Prefs.ShowRealtimeClock = showRealtimeClock;
            if (listing_Standard.ButtonTextLabeled("ShowAnimalNames".Translate(), Prefs.AnimalNameMode.ToStringHuman()))
            {
                List <FloatMenuOption> list3       = new List <FloatMenuOption>();
                IEnumerator            enumerator2 = Enum.GetValues(typeof(AnimalNameDisplayMode)).GetEnumerator();
                try
                {
                    while (enumerator2.MoveNext())
                    {
                        object obj = enumerator2.Current;
                        AnimalNameDisplayMode localMode2 = (AnimalNameDisplayMode)obj;
                        AnimalNameDisplayMode localMode  = localMode2;
                        list3.Add(new FloatMenuOption(localMode.ToStringHuman(), delegate()
                        {
                            Prefs.AnimalNameMode = localMode;
                        }, MenuOptionPriority.Default, null, null, 0f, null, null));
                    }
                }
                finally
                {
                    IDisposable disposable;
                    if ((disposable = (enumerator2 as IDisposable)) != null)
                    {
                        disposable.Dispose();
                    }
                }
                Find.WindowStack.Add(new FloatMenu(list3));
            }
            listing_Standard.NewColumn();
            Text.Font = GameFont.Medium;
            listing_Standard.Label("Gameplay".Translate(), -1f, null);
            Text.Font = GameFont.Small;
            listing_Standard.Gap(12f);
            listing_Standard.Gap(12f);
            if (listing_Standard.ButtonText("KeyboardConfig".Translate(), null))
            {
                Find.WindowStack.Add(new Dialog_KeyBindings());
            }
            if (listing_Standard.ButtonText("ChooseLanguage".Translate(), null))
            {
                if (Current.ProgramState == ProgramState.Playing)
                {
                    Messages.Message("ChangeLanguageFromMainMenu".Translate(), MessageTypeDefOf.RejectInput, false);
                }
                else
                {
                    List <FloatMenuOption> list4 = new List <FloatMenuOption>();
                    foreach (LoadedLanguage localLang2 in LanguageDatabase.AllLoadedLanguages)
                    {
                        LoadedLanguage localLang = localLang2;
                        list4.Add(new FloatMenuOption(localLang.FriendlyNameNative, delegate()
                        {
                            LanguageDatabase.SelectLanguage(localLang);
                        }, MenuOptionPriority.Default, null, null, 0f, null, null));
                    }
                    Find.WindowStack.Add(new FloatMenu(list4));
                }
            }
            if (Application.platform == RuntimePlatform.WindowsPlayer || Application.platform == RuntimePlatform.WindowsEditor)
            {
                if (listing_Standard.ButtonText("OpenSaveGameDataFolder".Translate(), null))
                {
                    Application.OpenURL(GenFilePaths.SaveDataFolderPath);
                }
            }
            else if (listing_Standard.ButtonText("ShowSaveGameDataLocation".Translate(), null))
            {
                Find.WindowStack.Add(new Dialog_MessageBox(Path.GetFullPath(GenFilePaths.SaveDataFolderPath), null, null, null, null, null, false, null, null));
            }
            if (listing_Standard.ButtonText("ResetAdaptiveTutor".Translate(), null))
            {
                Messages.Message("AdaptiveTutorIsReset".Translate(), MessageTypeDefOf.TaskCompletion, false);
                PlayerKnowledgeDatabase.ResetPersistent();
            }
            bool adaptiveTrainingEnabled = Prefs.AdaptiveTrainingEnabled;

            listing_Standard.CheckboxLabeled("LearningHelper".Translate(), ref adaptiveTrainingEnabled, null);
            Prefs.AdaptiveTrainingEnabled = adaptiveTrainingEnabled;
            bool runInBackground = Prefs.RunInBackground;

            listing_Standard.CheckboxLabeled("RunInBackground".Translate(), ref runInBackground, null);
            Prefs.RunInBackground = runInBackground;
            bool edgeScreenScroll = Prefs.EdgeScreenScroll;

            listing_Standard.CheckboxLabeled("EdgeScreenScroll".Translate(), ref edgeScreenScroll, null);
            Prefs.EdgeScreenScroll = edgeScreenScroll;
            bool pauseOnLoad = Prefs.PauseOnLoad;

            listing_Standard.CheckboxLabeled("PauseOnLoad".Translate(), ref pauseOnLoad, null);
            Prefs.PauseOnLoad = pauseOnLoad;
            bool pauseOnUrgentLetter = Prefs.PauseOnUrgentLetter;

            listing_Standard.CheckboxLabeled("PauseOnUrgentLetter".Translate(), ref pauseOnUrgentLetter, null);
            Prefs.PauseOnUrgentLetter = pauseOnUrgentLetter;
            int maxNumberOfPlayerSettlements = Prefs.MaxNumberOfPlayerSettlements;

            listing_Standard.Label("MaxNumberOfPlayerSettlements".Translate(new object[]
            {
                maxNumberOfPlayerSettlements
            }), -1f, null);
            int num = Mathf.RoundToInt(listing_Standard.Slider((float)maxNumberOfPlayerSettlements, 1f, 5f));

            Prefs.MaxNumberOfPlayerSettlements = num;
            if (maxNumberOfPlayerSettlements != num && num > 1)
            {
                TutorUtility.DoModalDialogIfNotKnown(ConceptDefOf.MaxNumberOfPlayerSettlements);
            }
            if (listing_Standard.ButtonTextLabeled("TemperatureMode".Translate(), Prefs.TemperatureMode.ToStringHuman()))
            {
                List <FloatMenuOption> list5       = new List <FloatMenuOption>();
                IEnumerator            enumerator4 = Enum.GetValues(typeof(TemperatureDisplayMode)).GetEnumerator();
                try
                {
                    while (enumerator4.MoveNext())
                    {
                        object obj2 = enumerator4.Current;
                        TemperatureDisplayMode localTmode2 = (TemperatureDisplayMode)obj2;
                        TemperatureDisplayMode localTmode  = localTmode2;
                        list5.Add(new FloatMenuOption(localTmode.ToString(), delegate()
                        {
                            Prefs.TemperatureMode = localTmode;
                        }, MenuOptionPriority.Default, null, null, 0f, null, null));
                    }
                }
                finally
                {
                    IDisposable disposable2;
                    if ((disposable2 = (enumerator4 as IDisposable)) != null)
                    {
                        disposable2.Dispose();
                    }
                }
                Find.WindowStack.Add(new FloatMenu(list5));
            }
            float  autosaveIntervalDays = Prefs.AutosaveIntervalDays;
            string text  = "Days".Translate();
            string text2 = "Day".Translate().ToLower();

            if (listing_Standard.ButtonTextLabeled("AutosaveInterval".Translate(), autosaveIntervalDays + " " + ((autosaveIntervalDays != 1f) ? text : text2)))
            {
                List <FloatMenuOption> list6 = new List <FloatMenuOption>();
                if (Prefs.DevMode)
                {
                    list6.Add(new FloatMenuOption("0.125 " + text + "(debug)", delegate()
                    {
                        Prefs.AutosaveIntervalDays = 0.125f;
                    }, MenuOptionPriority.Default, null, null, 0f, null, null));
                    list6.Add(new FloatMenuOption("0.25 " + text + "(debug)", delegate()
                    {
                        Prefs.AutosaveIntervalDays = 0.25f;
                    }, MenuOptionPriority.Default, null, null, 0f, null, null));
                }
                list6.Add(new FloatMenuOption("0.5 " + text + string.Empty, delegate()
                {
                    Prefs.AutosaveIntervalDays = 0.5f;
                }, MenuOptionPriority.Default, null, null, 0f, null, null));
                list6.Add(new FloatMenuOption(1.ToString() + " " + text2, delegate()
                {
                    Prefs.AutosaveIntervalDays = 1f;
                }, MenuOptionPriority.Default, null, null, 0f, null, null));
                list6.Add(new FloatMenuOption(3.ToString() + " " + text, delegate()
                {
                    Prefs.AutosaveIntervalDays = 3f;
                }, MenuOptionPriority.Default, null, null, 0f, null, null));
                list6.Add(new FloatMenuOption(7.ToString() + " " + text, delegate()
                {
                    Prefs.AutosaveIntervalDays = 7f;
                }, MenuOptionPriority.Default, null, null, 0f, null, null));
                list6.Add(new FloatMenuOption(14.ToString() + " " + text, delegate()
                {
                    Prefs.AutosaveIntervalDays = 14f;
                }, MenuOptionPriority.Default, null, null, 0f, null, null));
                Find.WindowStack.Add(new FloatMenu(list6));
            }
            if (Current.ProgramState == ProgramState.Playing && Current.Game.Info.permadeathMode && Prefs.AutosaveIntervalDays > 1f)
            {
                GUI.color = Color.red;
                listing_Standard.Label("MaxPermadeathAutosaveIntervalInfo".Translate(new object[]
                {
                    1f
                }), -1f, null);
                GUI.color = Color.white;
            }
            if (Current.ProgramState == ProgramState.Playing && listing_Standard.ButtonText("ChangeStoryteller".Translate(), "OptionsButton-ChooseStoryteller") && TutorSystem.AllowAction("ChooseStoryteller"))
            {
                Find.WindowStack.Add(new Page_SelectStorytellerInGame());
            }
            if (!DevModePermanentlyDisabledUtility.Disabled && listing_Standard.ButtonText("PermanentlyDisableDevMode".Translate(), null))
            {
                Find.WindowStack.Add(Dialog_MessageBox.CreateConfirmation("ConfirmPermanentlyDisableDevMode".Translate(), delegate
                {
                    DevModePermanentlyDisabledUtility.Disable();
                }, true, null));
            }
            if (!DevModePermanentlyDisabledUtility.Disabled || Prefs.DevMode)
            {
                bool devMode = Prefs.DevMode;
                listing_Standard.CheckboxLabeled("DevelopmentMode".Translate(), ref devMode, null);
                Prefs.DevMode = devMode;
            }
            bool testMapSizes = Prefs.TestMapSizes;

            listing_Standard.CheckboxLabeled("EnableTestMapSizes".Translate(), ref testMapSizes, null);
            Prefs.TestMapSizes = testMapSizes;
            if (Prefs.DevMode)
            {
                bool resetModsConfigOnCrash = Prefs.ResetModsConfigOnCrash;
                listing_Standard.CheckboxLabeled("ResetModsConfigOnCrash".Translate(), ref resetModsConfigOnCrash, null);
                Prefs.ResetModsConfigOnCrash = resetModsConfigOnCrash;
                bool logVerbose = Prefs.LogVerbose;
                listing_Standard.CheckboxLabeled("LogVerbose".Translate(), ref logVerbose, null);
                Prefs.LogVerbose = logVerbose;
            }
            listing_Standard.NewColumn();
            Text.Font = GameFont.Medium;
            listing_Standard.Label(string.Empty, -1f, null);
            Text.Font = GameFont.Small;
            listing_Standard.Gap(12f);
            listing_Standard.Gap(12f);
            if (listing_Standard.ButtonText("ModSettings".Translate(), null))
            {
                Find.WindowStack.Add(new Dialog_ModSettings());
            }
            listing_Standard.Label(string.Empty, -1f, null);
            listing_Standard.Label("NamesYouWantToSee".Translate(), -1f, null);
            List <string> preferredNames = Prefs.PreferredNames;

            if (Dialog_Options.< > f__mg$cache0 == null)
            {
                Dialog_Options.< > f__mg$cache0 = new Predicate <string>(GenText.NullOrEmpty);
            }
            preferredNames.RemoveAll(Dialog_Options.< > f__mg$cache0);
            for (int j = 0; j < Prefs.PreferredNames.Count; j++)
            {
                string  name    = Prefs.PreferredNames[j];
                PawnBio pawnBio = (from b in SolidBioDatabase.allBios
                                   where b.name.ToString() == name
                                   select b).FirstOrDefault <PawnBio>();
                if (pawnBio == null)
                {
                    name += " [N]";
                }
                else
                {
                    PawnBioType bioType = pawnBio.BioType;
                    if (bioType != PawnBioType.BackstoryInGame)
                    {
                        if (bioType == PawnBioType.PirateKing)
                        {
                            name += " [PK]";
                        }
                    }
                    else
                    {
                        name += " [B]";
                    }
                }
                Rect rect2 = listing_Standard.GetRect(24f);
                Widgets.Label(rect2, name);
                Rect butRect = new Rect(rect2.xMax - 24f, rect2.y, 24f, 24f);
                if (Widgets.ButtonImage(butRect, TexButton.DeleteX, Color.white, GenUI.SubtleMouseoverColor))
                {
                    Prefs.PreferredNames.RemoveAt(j);
                    SoundDefOf.Tick_Low.PlayOneShotOnCamera(null);
                }
            }
            if (Prefs.PreferredNames.Count < 6 && listing_Standard.ButtonText("AddName".Translate() + "...", null))
            {
                Find.WindowStack.Add(new Dialog_AddPreferredName());
            }
            listing_Standard.Label(string.Empty, -1f, null);
            if (listing_Standard.ButtonText("RestoreToDefaultSettings".Translate(), null))
            {
                this.RestoreToDefaultSettings();
            }
            listing_Standard.End();
        }
Example #22
0
        private void DrawPawnList(Rect rect)
        {
            Rect rect2 = rect;

            rect2.height = 60f;
            rect2        = rect2.ContractedBy(4f);
            int groupID = ReorderableWidget.NewGroup(delegate(int from, int to)
            {
                if (TutorSystem.AllowAction("ReorderPawn"))
                {
                    Pawn item = Find.GameInitData.startingPawns[from];
                    Find.GameInitData.startingPawns.RemoveAt(from);
                    Find.GameInitData.startingPawns.Insert(to, item);
                    TutorSystem.Notify_Event("ReorderPawn");
                }
            });

            rect2.y += 15f;
            this.DrawPawnListLabelAbove(rect2, "StartingPawnsSelected".Translate());
            for (int i = 0; i < Find.GameInitData.startingPawns.Count; i++)
            {
                if (i == Find.GameInitData.startingPawnCount)
                {
                    rect2.y += 30f;
                    this.DrawPawnListLabelAbove(rect2, "StartingPawnsLeftBehind".Translate());
                }
                Pawn pawn = Find.GameInitData.startingPawns[i];
                GUI.BeginGroup(rect2);
                Rect rect3 = new Rect(Vector2.zero, rect2.size);
                Widgets.DrawOptionBackground(rect3, this.curPawn == pawn);
                MouseoverSounds.DoRegion(rect3);
                GUI.color = new Color(1f, 1f, 1f, 0.2f);
                Vector2 pawnSelectorPortraitSize = Page_ConfigureStartingPawns.PawnSelectorPortraitSize;
                double  x = 110.0 - pawnSelectorPortraitSize.x / 2.0;
                Vector2 pawnSelectorPortraitSize2 = Page_ConfigureStartingPawns.PawnSelectorPortraitSize;
                double  y = 40.0 - pawnSelectorPortraitSize2.y / 2.0;
                Vector2 pawnSelectorPortraitSize3 = Page_ConfigureStartingPawns.PawnSelectorPortraitSize;
                float   x2 = pawnSelectorPortraitSize3.x;
                Vector2 pawnSelectorPortraitSize4 = Page_ConfigureStartingPawns.PawnSelectorPortraitSize;
                GUI.DrawTexture(new Rect((float)x, (float)y, x2, pawnSelectorPortraitSize4.y), PortraitsCache.Get(pawn, Page_ConfigureStartingPawns.PawnSelectorPortraitSize, default(Vector3), 1f));
                GUI.color = Color.white;
                Rect       rect4      = rect3.ContractedBy(4f).Rounded();
                NameTriple nameTriple = pawn.Name as NameTriple;
                string     label      = (nameTriple == null) ? pawn.LabelShort : ((!string.IsNullOrEmpty(nameTriple.Nick)) ? nameTriple.Nick : nameTriple.First);
                Widgets.Label(rect4.TopPart(0.5f).Rounded(), label);
                Vector2 vector = Text.CalcSize(pawn.story.Title);
                if (vector.x > rect4.width)
                {
                    Widgets.Label(rect4.BottomPart(0.5f).Rounded(), pawn.story.TitleShort);
                }
                else
                {
                    Widgets.Label(rect4.BottomPart(0.5f).Rounded(), pawn.story.Title);
                }
                if (Event.current.type == EventType.MouseDown && Mouse.IsOver(rect3))
                {
                    this.curPawn = pawn;
                    SoundDefOf.TickTiny.PlayOneShotOnCamera(null);
                }
                GUI.EndGroup();
                if (ReorderableWidget.Reorderable(groupID, rect2.ExpandedBy(4f)))
                {
                    Widgets.DrawRectFast(rect2, Widgets.WindowBGFillColor * new Color(1f, 1f, 1f, 0.5f), null);
                }
                TooltipHandler.TipRegion(rect2, new TipSignal("DragToReorder".Translate(), pawn.GetHashCode() * 3499));
                rect2.y += 60f;
            }
        }
 private void <ApparelChanged> m__1()
 {
     this.pawn.Drawer.renderer.graphics.ResolveApparelGraphics();
     PortraitsCache.SetDirty(this.pawn);
 }