Example #1
0
        private void GeneralSettings(Rect rect)
        {
            Listing_Standard list = new Listing_Standard();

            list.Begin(rect);

            Text.Font = GameFont.Small;
            list.Label("Faction Discovery");
            if (Current.Game != null)
            {
                FactionCanBeAddedCount = DefDatabase <FactionDef> .AllDefs.Where(ValidatorAnyFactionLeft).Count();

                list.Label("CanAddXFaction".Translate(FactionCanBeAddedCount));
                if (FactionCanBeAddedCount > 0 && list.ButtonText("AskForPopUp".Translate(), "AskForPopUpExplained".Translate()))
                {
                    Current.Game.World.GetComponent <NewFactionSpawningState>().ignoredFactions.Clear();
                    IEnumerator <FactionDef> factionEnumerator = DefDatabase <FactionDef> .AllDefs.Where(Patch_GameComponentUtility.LoadedGame.Validator).GetEnumerator();

                    if (factionEnumerator.MoveNext())
                    {
                        // Only one dialog can be stacked at a time, so give it the list of all factions
                        Dialog_NewFactionSpawning.OpenDialog(factionEnumerator);
                    }
                }
            }
            else
            {
                Text.Anchor = TextAnchor.MiddleCenter;
                list.Label("NeedToBeInGame".Translate());
                Text.Anchor = TextAnchor.UpperLeft;
            }
            list.GapLine(12);

            // KCSG
            list.Gap(12);
            list.Label("Custom Structure Generation :");
            list.Gap(5);
            list.CheckboxLabeled("Verbose logging", ref settings.enableVerboseLogging);
            list.GapLine(12);

            // Texture Variations
            list.Gap(12);
            list.Label("Texture Variations:");
            list.Gap(5);
            list.CheckboxLabeled("VFE_RandomOrSequentially".Translate(), ref settings.isRandomGraphic, null);
            list.Gap(5);
            list.CheckboxLabeled("VFE_HideRandomizeButton".Translate(), ref settings.hideRandomizeButton, null);
            list.GapLine(12);

            // General
            list.Gap(12);
            list.CheckboxLabeled("Disable Texture Caching", ref settings.disableCaching, "Warning: Enabling this might cause performance issues.");

            list.End();
        }
            private static void OnGameLoaded()
            {
                if (Current.Game == null)
                {
                    return;
                }

                var factionEnumerator = DefDatabase <FactionDef> .AllDefs.Where(Validator).GetEnumerator();

                if (factionEnumerator.MoveNext())
                {
                    // Only one dialog can be stacked at a time, so give it the list of all factions
                    Dialog_NewFactionSpawning.OpenDialog(factionEnumerator);
                }
            }