Beispiel #1
0
        internal void RegisterSettings(ModSettingsPack pack)
        {
            ShowNewsSetting = pack.GetHandle("modUpdateNews", "HugsLib_setting_showNews_label".Translate(), "HugsLib_setting_showNews_desc".Translate(), true);
            var allNewsHandle = pack.GetHandle("showAllNews", "HugsLib_setting_allNews_label".Translate(), "HugsLib_setting_allNews_desc".Translate(), false);

            allNewsHandle.Unsaved      = true;
            allNewsHandle.CustomDrawer = rect => {
                if (Widgets.ButtonText(rect, "HugsLib_setting_allNews_button".Translate()))
                {
                    if (!TryShowDialog(true))
                    {
                        Find.WindowStack.Add(new Dialog_MessageBox("HugsLib_setting_allNews_fail".Translate()));
                    }
                }
                return(false);
            };
            IgnoredNewsProvidersSetting = pack.GetHandle <IgnoredNewsIds>("ignoredUpdateNews", null, null);
            if (IgnoredNewsProvidersSetting.Value == null)
            {
                IgnoredNewsProvidersSetting.Value             = new IgnoredNewsIds();
                IgnoredNewsProvidersSetting.HasUnsavedChanges = false;
            }
            IgnoredNewsProvidersSetting.NeverVisible = true;
            IgnoredNewsProvidersSetting.Value.Handle = IgnoredNewsProvidersSetting;
        }
 public override void DefsLoaded()
 {
     cleanTime        = Settings.GetHandle <int>("cleanTime", "CleaningStation_settings_cleanTime_label".Translate(), "CleaningStation_settings_cleanTime_desc".Translate(), 1200, Validators.IntRangeValidator(60, 3600));
     cleanRadius      = Settings.GetHandle <float>("cleanRadius", "CleaningStation_settings_cleanRadius_label".Translate(), "CleaningStation_settings_cleanRadius_desc".Translate(), 5f, Validators.FloatRangeValidator(1f, 50f));
     useDynamicPower  = Settings.GetHandle <bool>("useDynamicPower", "CleaningStation_settings_useDynamicPower_label".Translate(), "CleaningStation_settings_useDynamicPower_desc".Translate(), false);
     powerConsumption = Settings.GetHandle <float>("powerConsumption", "CleaningStation_settings_powerConsumption_label".Translate(), "CleaningStation_settings_powerConsumption_desc".Translate(), 10f, Validators.FloatRangeValidator(1f, 100f));
 }
Beispiel #3
0
        public void SetWeightReference(string race, float value)
        {
            string fullID = ModSettingsHandler.GetRaceSettingWeightID(windowContext, race);

            if (fullID != null)
            {
                SettingHandle <float> handle = windowHandles.FirstOrFallback(h => h.Name == fullID, null);
                if (handle != null)
                {
                    if (value > 1.0f)
                    {
                        value = 1.0f;
                    }
                    if (value >= 0.0f)
                    {
                        prevAdjustedRaces[race] = false;
                    }
                    else if (value < 0.0f)
                    {
                        if (race.ToLower() == "human" && windowContext == HandleContext.GENERAL)
                        {
                            value = handle.DefaultValue;
                        }
                        else
                        {
                            prevAdjustedRaces[race] = true;
                        }
                    }
                    handle.Value = value;
                }
            }
        }
Beispiel #4
0
 public Settings(ModSettingsPack settings)
 {
     droppodCargoDropPercentage = settings.GetHandle("droppodCargoDropPercentage",
                                                     "DroppodCargoDropPercentage".Translate(), "DroppodCargoDropPercentageDesc".Translate(), 30, AtLeast());
     useGameSpeed = settings.GetHandle <bool>("useGameSpeed", "RA2UseGameSpeed".Translate(),
                                              "RA2UseGameSpeedDesc".Translate());
 }
Beispiel #5
0
        public override void DefsLoaded()
        {
            // Setting to allow bionic racoons to haul to Deep Storage:
            intSetting = Settings.GetHandle("get_intelligence", "DO NOT CHANGE THIS.",
                                            "CHANGE ALL SETTINGS BY USING THE BUTTON ABOVE", Intelligence.Humanlike, null, "LWM_DS_Int_");

            #if DEBUG
            for (int i = 1; i < Utils.showDebug.Length; i++)
            {
                debugONorOFF[i] = Settings.GetHandle("turnDebugONorOFF" + (Utils.DBF)i, "Turn ON/OFF debugging: " + (Utils.DBF)i,
                                                     "Turn ON/OFF all debugging - this is a lot of trace, and only available on debug builds",
                                                     false);
            }

            /* TODO: More compatibility with StockpileForDisaster
             * var sfdType=Harmony.AccessTools.TypeByName("StockpileForDisaster.EntityListComp");
             * if (sfdType==null) {
             *  Log.Error("Didn't find type?? "+sfdType);
             * } else {
             *  Log.Error("Found type "+sfdType);
             * }
             *
             * }*/
            #endif


            AssignSettings();
        }
 public ListTypeDrawer(SettingHandle <T> handle, IEnumerable <T> options, Func <T, string> getLabelFunc, bool includeDefaultOption)
 {
     this.handle               = handle;
     this.options              = new List <T>(options);
     this.getLabelFunc         = getLabelFunc;
     this.includeDefaultOption = includeDefaultOption;
 }
Beispiel #7
0
        public override void DefsLoaded()
        {
            //--Log.Message("DefsLoaded() called");

            this.option_WildMode           = Settings.GetHandle <bool>("WildMode", "WildMode_name".Translate(), "WildMode_desc".Translate(), false);
            this.option_sexneed_decay_rate = Settings.GetHandle <int>("sexneed_decay_rate", "sexneed_decay_rate_name".Translate(), "sexneed_decay_rate_desc".Translate(), 100, Validators.IntRangeValidator(0, 1000000));
            this.option_sexneed_decay_rate.SpinnerIncrement = 25;
            this.option_nymphs_join             = Settings.GetHandle <bool>("nymphs_join", "NymphsJoin".Translate(), "NymphsJoin_desc".Translate(), true);
            this.option_STD_floor_catch         = Settings.GetHandle <bool>("STD_floor_catch", "STD_FromFloors".Translate(), "STD_FromFloors_desc".Translate(), true);
            this.option_rape_beating            = Settings.GetHandle <bool>("rape_beating", "PrisonersBeating".Translate(), "PrisonersBeating_desc".Translate(), true);
            this.option_pregnancy_weight_parent = Settings.GetHandle <int>("pregnancy_weight_parent", "OffspringLookLikeTheirMother".Translate(), "OffspringLookLikeTheirMother_desc".Translate(), 50, Validators.IntRangeValidator(0, 100));
            this.option_pregnancy_weight_parent.SpinnerIncrement = 10;
            this.option_pregnancy_weight_species = Settings.GetHandle <int>("pregnancy_weight_species", "OffspringIsHuman".Translate(), "OffspringIsHuman_desc".Translate(), 50, Validators.IntRangeValidator(0, 100));
            this.option_pregnancy_weight_species.SpinnerIncrement = 10;
            this.option_pregnancy_coefficient_human = Settings.GetHandle <int>("pregnancy_coefficient_human", "PregnantCoeffecientForHuman".Translate(), "PregnantCoeffecientForHuman_desc".Translate(), 20, Validators.IntRangeValidator(0, 300));
            this.option_pregnancy_coefficient_human.SpinnerIncrement = 10;
            this.option_pregnancy_coefficient_animals = Settings.GetHandle <int>("pregnancy_coefficient_animals", "PregnantCoeffecientForAnimals".Translate(), "PregnantCoeffecientForAnimals_desc".Translate(), 50, Validators.IntRangeValidator(0, 300));
            this.option_pregnancy_coefficient_animals.SpinnerIncrement = 10;
            this.option_pregnancy_use_parent_method           = Settings.GetHandle <bool>("pregnancy_use_parent_method", "UseParentMethod".Translate(), "UseParentMethod_desc".Translate(), true);
            this.option_sex_free_for_all_age                  = Settings.GetHandle <int>("sex_free_for_all_age", "SexFreeForAllAge".Translate(), "SexFreeForAllAge_desc".Translate(), 15, Validators.IntRangeValidator(0, 9999));
            this.option_sex_free_for_all_age.SpinnerIncrement = 1;
            this.option_sex_minimum_age = Settings.GetHandle <int>("sex_minimum_age", "SexMinimumAge".Translate(), "SexMinimumAge_desc".Translate(), 15, Validators.IntRangeValidator(0, 9999));
            this.option_sex_minimum_age.SpinnerIncrement    = 1;
            this.option_NonFutaWomenRaping_MaxVulnerability = Settings.GetHandle <int>("nonFutaWomenRaping_MaxVulnerability", "NonFutaWomenRaping_MaxVulnerability".Translate(), "NonFutaWomenRaping_MaxVulnerability_desc".Translate(), 20, Validators.IntRangeValidator(0, 300));
            this.option_NonFutaWomenRaping_MaxVulnerability.SpinnerIncrement = 10;
            this.option_Rapee_MinVulnerability_human = Settings.GetHandle <int>("rapee_MinVulnerability_human", "Rapee_MinVulnerability_human".Translate(), "Rapee_MinVulnerability_human_desc".Translate(), 50, Validators.IntRangeValidator(0, 300));
            this.option_Rapee_MinVulnerability_human.SpinnerIncrement = 10;
            this.option_Rapee_MinVulnerability_animals = Settings.GetHandle <int>("rapee_MinVulnerability_animals", "Rapee_MinVulnerability_animals".Translate(), "Rapee_MinVulnerability_animals_desc".Translate(), 40, Validators.IntRangeValidator(0, 300));
            this.option_Rapee_MinVulnerability_animals.SpinnerIncrement = 10;
            this.option_DevMode = Settings.GetHandle <bool>("DevMode", "DevMode_name".Translate(), "DevMode_desc".Translate(), false);

            this.SettingsChanged();
        }
 private void GetSettingsHandles()
 {
     settingForbidReplaced = Settings.GetHandle("forbidReplaced", "Setting_forbidReplaced_label".Translate(), "Setting_forbidReplaced_desc".Translate(), true);
     settingForbidTimeout  = Settings.GetHandle("forbidTimeout", "Setting_forbidTimeout_label".Translate(), "Setting_forbidTimeout_desc".Translate(), ForbiddenTimeoutSettingDefault, Validators.IntRangeValidator(0, 100000000));
     settingForbidTimeout.SpinnerIncrement    = ForbiddenTimeoutSettingIncrement;
     settingForbidTimeout.VisibilityPredicate = () => settingForbidReplaced.Value;
 }
Beispiel #9
0
        public override void DefsLoaded()
        {
            base.DefsLoaded();

            EnableMod         = this.Settings.GetHandle("EnableMod", "HMTB_EnableMod".Translate(), "HMTB_Tooltip_EnableMod".Translate(), true);
            OpportunisticMode = this.Settings.GetHandle("OpportunisticMode", "HMTB_OpportunisticMode".Translate(), "HMTB_Tooltip_OpportunisticMode".Translate(), OpportunityDistance.HMTB_Unrestricted, null, "");
        }
Beispiel #10
0
        private bool StartApiServices()
        {
            _server          = new WebServer();
            _server.Messager = this;
            string conUrl = System.Configuration.ConfigurationManager.AppSettings["Server.Listen"];

            if (string.IsNullOrWhiteSpace(conUrl))
            {
                if (ShowError)
                {
                    LogError("Server.Listen不能为空");
                }
                return(false);
            }



            string[] urls = conUrl.Split(';');
            _server.ListeneAddress = urls;
            SettingHandle handle = new SettingHandle();

            handle.UserMan            = _userMan;
            handle.Form               = this;
            handle.Message            = this;
            _server.OnException      += _authServices_OnException;
            _server.UrlMap["Setting"] = handle;
            _server.StartServer();
            if (ShowLog)
            {
                Log("服务启动成功,监听地址为:" + conUrl);
            }
            return(true);
        }
Beispiel #11
0
        public override void DefsLoaded()
        {
            base.DefsLoaded();
            Predicate <ThingDef>   isMech           = (ThingDef d) => d.race != null && d.race.IsMechanoid;
            Predicate <FactionDef> isHackingFaction = (FactionDef d) => !d.isPlayer && d != FactionDefOf.Mechanoid && d != FactionDefOf.Insect;

            allMechs        = (from td in DefDatabase <ThingDef> .AllDefs where isMech(td) select td).ToList();
            allFactionNames = (from td  in DefDatabase <FactionDef> .AllDefs
                               where isHackingFaction(td)
                               select td.defName).ToList();
            tabsHandler = Settings.GetHandle <String>("tabs", "WTH_FactionRestrictions_Label".Translate(), "WTH_FactionRestrictions_Description".Translate(), allFactionNames.First());
            tabsHandler.CustomDrawer         = rect => { return(false); };
            factionRestrictions              = Settings.GetHandle <Dict2DRecordHandler>("factionRestrictions", "", "", null);
            factionRestrictions.CustomDrawer = rect => { return(GUIDrawUtility.CustomDrawer_MatchingPawns_active(rect, factionRestrictions, allMechs, allFactionNames, tabsHandler, "WTH_FactionRestrictions_OK".Translate(), "WTH_FactionRestrictions_NOK".Translate())); };


            hackedMechChance    = Settings.GetHandle <int>("hackedMechChance", "WTH_HackedMechChance_Title".Translate(), "WTH_HackedMechChance_Description".Translate(), 60, Validators.IntRangeValidator(0, 100));
            maxHackedMechPoints = Settings.GetHandle <int>("maxHackedMechPoints", "WTH_MaxHackedMechPoints_Title".Translate(), "WTH_MaxHackedMechPoints_Description".Translate(), 50, Validators.IntRangeValidator(0, 500));
            minHackedMechPoints = Settings.GetHandle <int>("minHackedMechPoints", "WTH_MinHackedMechPoints_Title".Translate(), "WTH_MinHackedMechPoints_Description".Translate(), 0, Validators.IntRangeValidator(0, 500));

            failureChanceNothing              = Settings.GetHandle <int>("failureChanceNothing", "WTH_FailureChance_Nothing_Title".Translate(), "WTH_FailureChance_Nothing_Description".Translate(), 70);
            failureChanceCauseRaid            = Settings.GetHandle <int>("failureChanceCauseRaid", "WTH_FailureChance_CauseRaid_Title".Translate(), "WTH_FailureChance_CauseRaid_Description".Translate(), 5);
            failureChanceShootRandomDirection = Settings.GetHandle <int>("failureChanceShootRandomDirection", "WTH_FailureChance_ShootRandomDirection_Title".Translate(), "WTH_FailureChance_ShootRandomDirection_Description".Translate(), 10);
            failureChanceHealToStanding       = Settings.GetHandle <int>("failureChanceHealToStanding", "WTH_FailureChance_HealToStanding_Title".Translate(), "WTH_FailureChance_HealToStanding_Description".Translate(), 5);
            failureChanceHackPoorly           = Settings.GetHandle <int>("failureChanceHackPoorly", "WTH_FailureChance_HackPoorly_Title".Translate(), "WTH_FailureChance_HackPoorly_Description".Translate(), 10);
            maintenanceDecayEnabled           = Settings.GetHandle <bool>("maintenanceDecayEnabled", "WTH_MaintenanceDedayEnabled_Title".Translate(), "WTH_MaintenanceDedayEnabled_Description".Translate(), true);

            factionRestrictions = GetDefaultForFactionRestrictions(factionRestrictions, allMechs, allFactionNames);
            GenerateImpliedRecipeDefs();
            DefDatabase <ThingDef> .ResolveAllReferences(true);

            SetMechMarketValue();
        }
Beispiel #12
0
        //Constructs a button in the mod settings that handles custom actions.
        //  Specifically, these are made in order to create special windows.
        private void SettingsButtonCategoryConstructor(ModSettingsPack pack, string labelID, string buttonLabel, string desc,
                                                       Action buttonAction, Func <bool> invalidCondition = null)
        {
            SettingHandle <bool> handle = pack.GetHandle(labelID, Translator.Translate(labelID), Translator.Translate(desc), false, null, null);

            handle.Unsaved      = true;
            handle.CustomDrawer = delegate(Rect rect)
            {
                bool invalid = false;
                if (invalidCondition != null)
                {
                    invalid = invalidCondition();
                }
                if (invalid)
                {
                    GUI.color = new Color(1f, 0.3f, 0.35f);
                }
                bool validButtonRes = Widgets.ButtonText(rect, Translator.Translate(buttonLabel), true, true, true);
                if (validButtonRes)
                {
                    if (!invalid)
                    {
                        buttonAction();
                    }
                    else
                    {
                        SoundDefOf.ClickReject.PlayOneShotOnCamera(null);
                    }
                }

                GUI.color = Color.white;
                return(false);
            };
        }
        public override void DefsLoaded()
        {
            InviteJob = DefDatabase <JobDef> .GetNamed("bdew_longdistance_invite");

            BreakupJob = DefDatabase <JobDef> .GetNamed("bdew_longdistance_breakup");

            RejectedThoughtInviter = DefDatabase <ThoughtDef> .GetNamed("bdew_longdistance_inv_rejected");

            RejectedThoughtTarget = DefDatabase <ThoughtDef> .GetNamed("bdew_longdistance_inv_rejected_target");

            RejectedThoughtInviterMood = DefDatabase <ThoughtDef> .GetNamed("bdew_longdistance_inv_rejected_mood");

            AcceptedThoughtInviter = DefDatabase <ThoughtDef> .GetNamed("bdew_longdistance_inv_accepted");

            AcceptedThoughtTarget = DefDatabase <ThoughtDef> .GetNamed("bdew_longdistance_inv_accepted_target");

            AcceptedThoughtInviterMood = DefDatabase <ThoughtDef> .GetNamed("bdew_longdistance_inv_accepted_mood");

            MinDaysToJoin = Settings.GetHandle("MinDaysToJoin", "LongDistance.Settings.MinDaysToJoin.Name".Translate(), "LongDistance.Settings.MinDaysToJoin.Desc".Translate(), 0.5f);
            MaxDaysToJoin = Settings.GetHandle("MaxDaysToJoin", "LongDistance.Settings.MaxDaysToJoin.Name".Translate(), "LongDistance.Settings.MaxDaysToJoin.Desc".Translate(), 3f);

            JoinBaseChance    = Settings.GetHandle("JoinBaseChance", "LongDistance.Settings.JoinBaseChance.Name".Translate(), "LongDistance.Settings.JoinBaseChance.Desc".Translate(), 0f);
            JoinOpinionFactor = Settings.GetHandle("JoinOpinionFactor", "LongDistance.Settings.JoinOpinionFactor.Name".Translate(), "LongDistance.Settings.JoinOpinionFactor.Desc".Translate(), 0.01f);
            JoinSkillFactor   = Settings.GetHandle("JoinSkillFactor", "LongDistance.Settings.JoinSkillFactor.Name".Translate(), "LongDistance.Settings.JoinSkillFactor.Desc".Translate(), 0.1f);
            JoinFactionFactor = Settings.GetHandle("JoinFactionFactor", "LongDistance.Settings.JoinFactionFactor.Name".Translate(), "LongDistance.Settings.JoinFactionFactor.Desc".Translate(), 0.002f);

            BreakupBaseChance    = Settings.GetHandle("BreakupBaseChance", "LongDistance.Settings.BreakupBaseChance.Name".Translate(), "LongDistance.Settings.BreakupBaseChance.Desc".Translate(), 0.2f);
            BreakupOpinionFactor = Settings.GetHandle("BreakupOpinionFactor", "LongDistance.Settings.BreakupOpinionFactor.Name".Translate(), "LongDistance.Settings.BreakupOpinionFactor.Desc".Translate(), 0.02f);

            PositiveRelationTreshold = Settings.GetHandle("PositiveRelationTreshold", "LongDistance.Settings.PositiveRelationTreshold.Name".Translate(), "LongDistance.Settings.PositiveRelationTreshold.Desc".Translate(), 50);
            NegativeRelationTreshold = Settings.GetHandle("NegativeRelationTreshold", "LongDistance.Settings.NegativeRelationTreshold.Name".Translate(), "LongDistance.Settings.NegativeRelationTreshold.Desc".Translate(), -50);
        }
Beispiel #14
0
        private static bool StartApiServices(Program my)
        {
            _server          = new WebServer();
            _server.Messager = my;
            string conUrl = System.Configuration.ConfigurationManager.AppSettings["Server.Listen"];

            if (string.IsNullOrWhiteSpace(conUrl))
            {
                Console.WriteLine("Server.Listen不能为空");

                return(false);
            }
            string[] urls = conUrl.Split(';');
            _server.ListeneAddress = urls;
            SettingHandle handle = new SettingHandle();

            handle.UserMan            = _userMan;
            handle.Form               = my;
            handle.Message            = my;
            _server.OnException      += _authServices_OnException;
            _server.UrlMap["Setting"] = handle;
            _server.StartServer();

            Console.WriteLine("服务启动成功,监听地址为:" + conUrl);

            return(true);
        }
Beispiel #15
0
        public static bool useAlternateAging = false;                                  //Whether to use the alternate aging algorithm.

        /// <summary>
        /// Runs during game startup.
        /// Initializes settings and setting values.
        /// </summary>
        public override void DefsLoaded()
        {
            //Setup and get settings values
            pawnSpeedMultBeforeCutoffSetting = Settings.GetHandle <int>(settingName: "speedMultSetting", title: "settings_pawnSpeedMultBefore_title".Translate(), description: "settings_pawnSpeedMultBefore_description".Translate(), defaultValue: 1); //Using old setting title speedMultSetting for compatability
            pawnSpeedMultBeforeCutoff        = pawnSpeedMultBeforeCutoffSetting.Value;

            pawnSpeedMultAfterCutoffSetting = Settings.GetHandle <int>(settingName: "pawnSpeedMultAfter", title: "settings_pawnSpeedMultAfter_title".Translate(), description: "settings_pawnSpeedMultAfter_description".Translate(), defaultValue: 1);
            pawnSpeedMultAfterCutoff        = pawnSpeedMultAfterCutoffSetting.Value;

            pawnCutoffAgeSetting = Settings.GetHandle <int>(settingName: "pawnCutoffAge", title: "settings_pawnCutoffAge_title".Translate(), description: "settings_pawnCutoffAge_description".Translate(), defaultValue: 1000);
            pawnCutoffAge        = pawnCutoffAgeSetting.Value;


            animalSpeedMultBeforeCutoffSetting = Settings.GetHandle <int>(settingName: "animalSpeedMultBefore", title: "settings_animalSpeedMultBefore_title".Translate(), description: "settings_animalSpeedMultBefore_description".Translate(), defaultValue: 1);
            animalSpeedMultBeforeCutoff        = animalSpeedMultBeforeCutoffSetting.Value;

            animalSpeedMultAfterCutoffSetting = Settings.GetHandle <int>(settingName: "animalSpeedMultAfter", title: "settings_animalSpeedMultAfter_title".Translate(), description: "settings_animalSpeedMultAfter_description".Translate(), defaultValue: 1);
            animalSpeedMultAfterCutoff        = animalSpeedMultAfterCutoffSetting.Value;

            animalCutoffAgeSetting = Settings.GetHandle <int>(settingName: "animalCutoffAge", title: "settings_animalCutoffAge_title".Translate(), description: "settings_animalCutoffAge_description".Translate(), defaultValue: 1000);
            animalCutoffAge        = animalCutoffAgeSetting.Value;


            modifyChronologicalAgeSetting = Settings.GetHandle <bool>(settingName: "modifyChronologicalAge", title: "settings_modifyChronologicalAge_title".Translate(), description: "settings_modifyChronologicalAge_description".Translate(), defaultValue: false);
            modifyChronologicalAge        = modifyChronologicalAgeSetting.Value;


            useAlternateAgingAlgorithmSetting = Settings.GetHandle <bool>(settingName: "useAlternateAgingAlgorithm", title: "settings_useAlternateAgingAlgorithm_title".Translate(), description: "settings_modifyChronologicalAge_description".Translate(), defaultValue: false);
            useAlternateAging = useAlternateAgingAlgorithmSetting.Value;
        }
Beispiel #16
0
 public void UpdateSettings()
 {
     TechPoolTitle = Settings.GetHandle("TechPoolTitle", "TechPoolModeTitle".Translate(), "TechPoolModeDesc".Translate(), false);
     TechPoolTitle.CustomDrawer = rect => false;
     TechPoolTitle.CanBeReset   = false;
     TechPoolIncludesStarting   = Settings.GetHandle <bool>("TechPoolIncludesStarting", "TechPoolIncludesStartingTitle".Translate(), "TechPoolIncludesStartingDesc".Translate(), true);
     TechPoolIncludesStarting.OnValueChanged = x => { ValidateTechPoolSettings(x); };
     TechPoolIncludesTechLevel = Settings.GetHandle <bool>("TechPoolIncludesTechLevel", "TechPoolIncludesTechLevelTitle".Translate(), "TechPoolIncludesTechLevelDesc".Translate(), true);
     TechPoolIncludesTechLevel.OnValueChanged = x => { ValidateTechPoolSettings(x); };
     TechPoolIncludesBackground = Settings.GetHandle <bool>("TechPoolIncludesBackground", "TechPoolIncludesBackgroundTitle".Translate(), "TechPoolIncludesBackgroundDesc".Translate(), false);
     TechPoolIncludesBackground.OnValueChanged = x => { ValidateTechPoolSettings(x); };
     TechPoolIncludesScenario = Settings.GetHandle <bool>("TechPoolIncludesScenario", "TechPoolIncludesScenarioTitle".Translate(), "TechPoolIncludesScenarioDesc".Translate(), true);
     TechPoolIncludesScenario.OnValueChanged = x => { ValidateTechPoolSettings(x); };
     //TechPoolMode = Settings.GetHandle("TechPoolMode", "TechPoolModeTitle".Translate(), "TechPoolModeDesc".Translate(), FactionTechPool.Both, null, "TechPoolMode_");
     WeaponPoolMode                     = Settings.GetHandle("WeaponPoolMode", "WeaponPoolModeTitle".Translate(), "WeaponPoolModeDesc".Translate(), FactionWeaponPool.Scenario, null, "WeaponPoolMode_");
     FreeScenarioWeapons                = Settings.GetHandle("FreeScenarioWeapons", "FreeScenarioWeaponsTitle".Translate(), "FreeScenarioWeaponsDesc".Translate(), false);
     LearnMeleeWeaponsByGroup           = Settings.GetHandle <bool>("LearnMeleeWeaponsByGroup", "LearnMeleeWeaponsByGroupTitle".Translate(), "LearnMeleeWeaponsByGroupDesc".Translate(), false);
     LearnRangedWeaponsByGroup          = Settings.GetHandle <bool>("LearnRangedWeaponsByGroup", "LearnRangedWeaponsByGroupTitle".Translate(), "LearnRangedWeaponsByGroupDesc".Translate(), true);
     RequireTrainingForSingleUseWeapons = Settings.GetHandle <bool>("RequireTrainingForSingleUseWeapons", "RequireTrainingForSingleUseWeaponsTitle".Translate(), "RequireTrainingForSingleUseWeaponsDesc".Translate(), false);
     EnableJoyGiver                     = Settings.GetHandle <bool>("EnableJoyGiver", "EnableJoyGiverTitle".Translate(), "EnableJoyGiverDesc".Translate(), true);
     ResearchSpeedTiedToDifficulty      = Settings.GetHandle <bool>("ResearchSpeedTiedToDifficulty", "ResearchSpeedTiedToDifficultyTitle".Translate(), "ResearchSpeedTiedToDifficultyDesc".Translate(), true);
     StudySpeedTiedToDifficulty         = Settings.GetHandle <bool>("StudySpeedTiedToDifficulty", "StudySpeedTiedToDifficultyTitle".Translate(), "StudySpeedTiedToDifficultyDesc".Translate(), true);
     FullStartupReport                  = Settings.GetHandle <bool>("FullStartupReport", "DEV: Print full startup report", null, false);
     FullStartupReport.NeverVisible     = !Prefs.DevMode;
 }
Beispiel #17
0
        public override void DefsLoaded()
        {
            base.DefsLoaded();

            List <ThingDef> allAnimals = DefUtility.getAnimals();

            allAnimals = allAnimals.OrderBy(o => o.defName).ToList();

            tabsHandler    = Settings.GetHandle <String>("tabs", "GUC_Tabs_Title".Translate(), "", "none");
            bodySizeFilter = Settings.GetHandle <float>("bodySizeFilter", "GUC_BodySizeFilter_Title".Translate(), "GUC_BodySizeFilter_Description".Translate(), 0.8f);
            animalSelecter = Settings.GetHandle <DictAnimalRecordHandler>("Animalselecter", "GUC_Animalselection_Title".Translate(), "GUC_Animalselection_Description".Translate(), getDefaultForAnimalSelecter(allAnimals));
            drawSelecter   = Settings.GetHandle <DictAnimalRecordHandler>("drawSelecter", "GUC_Drawselection_Title".Translate(), "GUC_Drawselection_Description".Translate(), getDefaultForDrawSelecter(allAnimals));


            tabsHandler.CustomDrawer = rect => { return(DrawUtility.CustomDrawer_Tabs(rect, tabsHandler, tabNames)); };

            bodySizeFilter.CustomDrawer        = rect => { return(DrawUtility.CustomDrawer_Filter(rect, bodySizeFilter, false, 0, 5, highlight1)); };
            animalSelecter.CustomDrawer        = rect => { return(DrawUtility.CustomDrawer_MatchingAnimals_active(rect, animalSelecter, allAnimals, bodySizeFilter, "GUC_SizeOk".Translate(), "GUC_SizeNotOk".Translate())); };
            bodySizeFilter.VisibilityPredicate = delegate { return(tabsHandler.Value == tabNames[0]); };
            animalSelecter.VisibilityPredicate = delegate { return(tabsHandler.Value == tabNames[0]); };


            drawSelecter.CustomDrawer        = rect => { return(DrawUtility.CustomDrawer_MatchingAnimals_active(rect, drawSelecter, allAnimals, null, "GUC_DrawFront".Translate(), "GUC_DrawBack".Translate())); };
            drawSelecter.VisibilityPredicate = delegate { return(tabsHandler.Value == tabNames[1]); };

            if (animalSelecter.Value == null)
            {
                animalSelecter.Value = getDefaultForAnimalSelecter(allAnimals);
            }
            if (drawSelecter.Value == null)
            {
                drawSelecter.Value = getDefaultForDrawSelecter(allAnimals);
            }
        }
Beispiel #18
0
        //public static SettingHandle<float> option_debug_scale_X;
        //public static SettingHandle<float> option_debug_scale_Y;
        //public static SettingHandle<float> option_debug_offset_X;
        //public static SettingHandle<float> option_debug_offset_Y;
        //public static SettingHandle<float> option_debug_loc_X;
        //public static SettingHandle<float> option_debug_loc_Y;
        //public static SettingHandle<float> option_debug_loc_Z;

        //public static SettingHandle<float> option_hair_offset_Y;

        public BnC_Settings(ModSettingsPack settings)
        {
            option_hostile_children_raider = settings.GetHandle <bool>("hostile_children_raider", "HostileChildrenRaider".Translate(), "HostileChildrenRaider_desc".Translate(), true);
            option_child_max_weapon_mass   = settings.GetHandle("child_max_weapon_mas", "ChildMaxWeaponMass".Translate(), "ChildMaxWeaponMass_desc".Translate(), 2, Validators.IntRangeValidator(0, 4));
            option_child_max_weapon_mass.SpinnerIncrement = 1;
            option_accelerated_growth         = settings.GetHandle <bool>("accelerated_growth", "AcceleratedGrowth".Translate(), "AcceleratedGrowth_desc".Translate(), true);
            option_accelerated_growth_end_age = settings.GetHandle("accelerated_growth_end_age", "AcceleratedGrowthEndAge".Translate(), "AcceleratedGrowthEndAge_desc".Translate(), 8, Validators.IntRangeValidator(0, 12));
            option_accelerated_growth_end_age.SpinnerIncrement = 1;
            option_baby_accelerated_factor = settings.GetHandle("baby_accelerated_factor", "BabyAcceleratedFactor".Translate(), "BabyAcceleratedFactor_desc".Translate(), 4, Validators.IntRangeValidator(1, 12));
            option_baby_accelerated_factor.SpinnerIncrement = 1;
            option_toddler_accelerated_factor = settings.GetHandle("toddler_accelerated_factor", "ToddlerAcceleratedFactor".Translate(), "ToddlerAcceleratedFactor_desc".Translate(), 4, Validators.IntRangeValidator(1, 12));
            option_toddler_accelerated_factor.SpinnerIncrement = 1;
            option_child_accelerated_factor = settings.GetHandle("child_accelerated_factor", "ChildAcceleratedFactor".Translate(), "ChildAcceleratedFactor_desc".Translate(), 4, Validators.IntRangeValidator(1, 12));
            option_child_accelerated_factor.SpinnerIncrement = 1;

            //option_texture_scale_X = settings.GetHandle<float>("texture_scale_X", "TextureScaleX".Translate(), "TextureScaleX_desc".Translate(), 1.12f, Validators.FloatRangeValidator(-5f, 5f));
            //option_texture_scale_Y = settings.GetHandle<float>("texture_scale_Y", "TextureScaleY".Translate(), "TextureScaleY_desc".Translate(), 1.32f, Validators.FloatRangeValidator(-5f, 5f));
            //option_texture_offset_X = settings.GetHandle<float>("texture_offset_X", "TextureOffsetX".Translate(), "TextureOffsetX_desc".Translate(), -0.055f, Validators.FloatRangeValidator(-5f, 5f));
            //option_texture_offset_Y = settings.GetHandle<float>("texture_offset_Y", "TextureOffsetY".Translate(), "TextureOffsetY_desc".Translate(), -0.2f, Validators.FloatRangeValidator(-5f, 5f));
            //option_texture_offset_westeast_X = settings.GetHandle<float>("texture_offset_westeast_X", "TextureOffsetWesteast_X".Translate(), "TextureOffsetWesteast_X_desc".Translate(), -0.06f, Validators.FloatRangeValidator(-5f, 5f));

            //option_debug_scale_X = settings.GetHandle<float>("debug_scale_X", "DebugScaleX".Translate(), "DebugScaleX_desc".Translate(), 1.225f, Validators.FloatRangeValidator(-5f, 5f));
            //option_debug_scale_Y = settings.GetHandle<float>("debug_scale_Y", "DebugScaleY".Translate(), "DebugScaleY_desc".Translate(), 1.225f, Validators.FloatRangeValidator(-5f, 5f));
            //option_debug_offset_X = settings.GetHandle<float>("debug_offset_X", "DebugOffsetX".Translate(), "DebugOffsetX_desc".Translate(), -0.105f, Validators.FloatRangeValidator(-5f, 5f));
            //option_debug_offset_Y = settings.GetHandle<float>("debug_offset_Y", "DebugOffsetY".Translate(), "DebugOffsetY_desc".Translate(), -0.10f, Validators.FloatRangeValidator(-5f, 5f));

            ////option_debug_loc_X = settings.GetHandle<float>("debug_loc_X", "DebugLocX".Translate(), "DebugLocX_desc".Translate(), 0f, Validators.FloatRangeValidator(-5f, 5f));
            //option_debug_loc_Y = settings.GetHandle<float>("debug_loc_Y", "DebugLocY".Translate(), "DebugLocY_desc".Translate(), 0f, Validators.FloatRangeValidator(-5f, 5f));
            //option_debug_loc_Z = settings.GetHandle<float>("debug_loc_Z", "DebugLocZ".Translate(), "DebugLocZ_desc".Translate(), 0f, Validators.FloatRangeValidator(-5f, 5f));

            //option_hair_offset_Y = settings.GetHandle<float>("option_hair_offset_Y", "HairOffsetY".Translate(), "HairOffsetY_desc".Translate(), 0.114f, Validators.FloatRangeValidator(-5f, 5f));
        }
Beispiel #19
0
        public static bool CustomDrawer_Filter(Rect rect, SettingHandle<float> slider, bool def_isPercentage, float def_min, float def_max, Color background)
        {
            drawBackground(rect, background);
            int labelWidth = 50;

            Rect sliderPortion = new Rect(rect);
            sliderPortion.width = sliderPortion.width - labelWidth;

            Rect labelPortion = new Rect(rect);
            labelPortion.width = labelWidth;
            labelPortion.position = new Vector2(sliderPortion.position.x + sliderPortion.width + 5f, sliderPortion.position.y + 4f);

            sliderPortion = sliderPortion.ContractedBy(2f);

            if (def_isPercentage)
                Widgets.Label(labelPortion, (Mathf.Round(slider.Value * 100f)).ToString("F0") + "%");
            else
                Widgets.Label(labelPortion, slider.Value.ToString("F2"));

            float val = Widgets.HorizontalSlider(sliderPortion, slider.Value, def_min, def_max, true);
            bool change = false;

            if (slider.Value != val)
                change = true;

            slider.Value = val;
            return change;
        }
Beispiel #20
0
        internal static void filterAnimals(ref SettingHandle <DictAnimalRecordHandler> setting, List <ThingDef> allAnimals, SettingHandle <float> filter = null)
        {
            if (setting.Value == null)
            {
                setting.Value = new DictAnimalRecordHandler();
            }

            Dictionary <String, AnimalRecord> selection = new Dictionary <string, AnimalRecord>();

            foreach (ThingDef animal in allAnimals)
            {
                bool shouldSelect = false;
                if (filter != null)
                {
                    float mass = animal.race.baseBodySize;
                    shouldSelect = mass >= filter.Value;
                }
                AnimalRecord value = null;
                bool         found = setting.Value.InnerList.TryGetValue(animal.defName, out value);
                if (found && value.isException)
                {
                    selection.Add(animal.defName, value);
                }
                else if (found)
                {
                    selection.Add(animal.defName, new AnimalRecord(shouldSelect, false, animal.label));
                }
                else
                {
                    addNewAnimal(animal, selection, shouldSelect, setting.Name);
                }
            }
            selection = selection.OrderBy(d => d.Value.label).ToDictionary(d => d.Key, d => d.Value);
            setting.Value.InnerList = selection;
        }
Beispiel #21
0
 private void RegisterOwnSettings()
 {
     try {
         var pack = Settings.GetModSettings(ModIdentifier);
         pack.EntryName         = "HugsLib_ownSettingsName".Translate();
         pack.DisplayPriority   = ModSettingsPack.ListPriority.Lowest;
         pack.AlwaysExpandEntry = true;
         updateNewsSetting      = pack.GetHandle("modUpdateNews", "HugsLib_setting_showNews_label".Translate(), "HugsLib_setting_showNews_desc".Translate(), true);
         var allNewsHandle = pack.GetHandle("showAllNews", "HugsLib_setting_allNews_label".Translate(), "HugsLib_setting_allNews_desc".Translate(), false);
         allNewsHandle.Unsaved      = true;
         allNewsHandle.CustomDrawer = rect => {
             if (Widgets.ButtonText(rect, "HugsLib_setting_allNews_button".Translate()))
             {
                 if (!UpdateFeatures.TryShowDialog(true))
                 {
                     Find.WindowStack.Add(new Dialog_MessageBox("HugsLib_setting_allNews_fail".Translate()));
                 }
             }
             return(false);
         };
         QuickstartController.RegisterSettings(pack);
     } catch (Exception e) {
         Logger.ReportException(e);
     }
 }
Beispiel #22
0
        /// <summary>
        ///     Initialize weather specific settings
        /// </summary>
        /// <param name="settings">The settings instance to use</param>
        /// <param name="biome">The biome we're working with</param>
        /// <param name="key">The key to use</param>
        /// <param name="weathers">The weathers to iterate through</param>
        /// <param name="visibilityFunc">Our base visibility function</param>
        private void InitWeatherSettings(ModSettingsPack settings, BiomeDef biome, string key,
                                         List <WeatherDef> weathers,
                                         SettingHandle.ShouldDisplay visibilityFunc)
        {
            // Per-biome rain and snowfall multipliers
            foreach (var weather in weathers)
            {
                weatherCommonalities[weather] = new WeatherData(settings, biome, weather, visibilityFunc);
            }

            SpacerDrawer.GenerateSpacer("ColdDesertNights_WeatherMiscSettings".Translate(), settings, visibilityFunc);

            // If we're allowed to bypass the rain limits
            settingIgnoreRainLimit = settings.GetHandle(
                $"ignore_rain_limit_{key}",
                "    " + "ColdDesertNights_IgnoreRainLimit".Translate(),
                "ColdDesertNights_IgnoreRainLimit_Desc".Translate(), false);

            // Force weather into the given range
            minWeatherTemperature = settings.GetHandle(
                $"weather_temp_min_{key}",
                "    " + "ColdDesertNights_WeatherTempMin".Translate(),
                "ColdDesertNights_WeatherTempMin_Desc".Translate(), -999f);
            maxWeatherTemperature = settings.GetHandle(
                $"weather_temp_max_{key}",
                "    " + "ColdDesertNights_WeatherTempMax".Translate(),
                "ColdDesertNights_WeatherTempMax_Desc".Translate(), 999f);

            // Set our visibility predicates:
            settingIgnoreRainLimit.VisibilityPredicate        =
                minWeatherTemperature.VisibilityPredicate     =
                    maxWeatherTemperature.VisibilityPredicate =
                        visibilityFunc;
        }
Beispiel #23
0
        internal static void filterWeapons(ref SettingHandle <DictWeaponRecordHandler> setting, List <ThingDef> allWeapons, SettingHandle <float> filter = null)
        {
            if (setting.Value == null)
            {
                setting.Value = new DictWeaponRecordHandler();
            }

            Dictionary <String, WeaponRecord> selection = new Dictionary <string, WeaponRecord>();

            foreach (ThingDef weapon in allWeapons)
            {
                bool shouldSelect = false;
                if (filter != null)
                {
                    float mass = weapon.GetStatValueAbstract(StatDefOf.Mass);
                    shouldSelect = mass >= filter.Value;
                }
                WeaponRecord value = null;
                bool         found = setting.Value.InnerList.TryGetValue(weapon.defName, out value);
                if (found && value.isException)
                {
                    selection.Add(weapon.defName, value);
                }
                else
                {
                    selection.Add(weapon.defName, new WeaponRecord(shouldSelect, false, weapon.label));
                }
            }
            selection = selection.OrderBy(d => d.Value.label).ToDictionary(d => d.Key, d => d.Value);
            setting.Value.InnerList = selection;
        }
Beispiel #24
0
        public static bool CustomDrawer_Filter(Rect rect, SettingHandle <float> slider, float defMin, float defMax)
        {
            int labelWidth = 50;

            Rect sliderPortion = new Rect(rect);

            sliderPortion.width = sliderPortion.width - labelWidth;

            Rect labelPortion = new Rect(rect)
            {
                width    = labelWidth,
                position = new Vector2(sliderPortion.position.x + sliderPortion.width + 5f,
                                       sliderPortion.position.y + 4f)
            };

            sliderPortion = sliderPortion.ContractedBy(2f);

            Widgets.Label(labelPortion, (Mathf.Round(slider.Value * 100f)).ToString("F0") + "%");

            float val    = Widgets.HorizontalSlider(sliderPortion, slider.Value, defMin, defMax, true);
            bool  change = Math.Abs(slider.Value - val) > Single.Epsilon;

            slider.Value = val;
            return(change);
        }
Beispiel #25
0
        public static bool HugsDrawerRebuild_Spinner(SettingHandle <int> handle, Rect controlRect, Color background)
        {
            drawBackground(controlRect, background);
            var buttonSize      = controlRect.height;
            var leftButtonRect  = new Rect(controlRect.x, controlRect.y, buttonSize, buttonSize);
            var rightButtonRect = new Rect(controlRect.x + controlRect.width - buttonSize, controlRect.y, buttonSize, buttonSize);
            var changed         = false;

            if (Widgets.ButtonText(leftButtonRect, "-"))
            {
                handle.Value -= handle.SpinnerIncrement;
                changed       = true;
            }
            if (Widgets.ButtonText(rightButtonRect, "+"))
            {
                handle.Value += handle.SpinnerIncrement;
                changed       = true;
            }
            var textRect = new Rect(controlRect.x + buttonSize + 1, controlRect.y, controlRect.width - buttonSize * 2 - 2f, controlRect.height);

            if (HugsDrawerRebuild_IntEntry(handle, textRect))
            {
                changed = true;
            }
            return(changed);
        }
Beispiel #26
0
        public static bool CustomDrawer_Button(Rect rect, SettingHandle <bool> setting, String activateText, String deactivateText, int xOffset = 0, int yOffset = 0)
        {
            int  labelWidth       = (int)rect.width - 20;
            int  horizontalOffset = 0;
            int  verticalOffset   = 0;
            bool change           = false;
            Rect buttonRect       = new Rect(rect);

            buttonRect.width    = labelWidth;
            buttonRect.position = new Vector2(buttonRect.position.x + horizontalOffset + xOffset, buttonRect.position.y + verticalOffset + yOffset);
            Color  activeColor = GUI.color;
            bool   isSelected  = setting.Value;
            String text        = setting ? deactivateText : activateText;

            if (isSelected)
            {
                GUI.color = SelectedOptionColor;
            }
            bool clicked = Widgets.ButtonText(buttonRect, text);

            if (isSelected)
            {
                GUI.color = activeColor;
            }

            if (clicked)
            {
                setting.Value = !setting.Value;
                change        = true;
            }
            return(change);
        }
Beispiel #27
0
 public override void DefsLoaded()
 {
     ForgetBackstories       = Settings.GetHandle <bool>("forgetBackstories", "Forget Most Backstories", "Causes most of the backstories in the game to be generated as Amnesia. Has no effect on already generated pawns.", true);
     ForgetForcedBackstories = Settings.GetHandle <bool>("forgetForcedBackstories", "Also Forget Forced Backstories", "If Forget Most Backstories is enanbled, this option will also remove the backstories of 'special' pawns.", true);
     ForgetTraits            = Settings.GetHandle <bool>("forgetTraits", "Forget Most Traits", "Makes newly generated pawns to have no traits other than the ones required by thier backstories.", true);
     ForgetForcedTraits      = Settings.GetHandle <bool>("forgetForcedTraits", "Also Forget Forced Traits", "If 'Forget Most Traits' is enabled, this option forces backstory traits to be removed.", true);
 }
Beispiel #28
0
 public override void DefsLoaded()
 {
     multiplyer        = Settings.GetHandle <int>("multiplyer", "settings_multiplyer_title".Translate(), "settings_multiplyer_desc".Translate(), 1);
     doMultiply        = Settings.GetHandle <bool>("doMultiply", "settings_doMultiply_title".Translate(), "settings_doMultiply_desc".Translate(), true);
     settingMultiplyer = multiplyer.Value;
     settingDoMultiply = doMultiply.Value;
 }
Beispiel #29
0
        // Token: 0x0600001B RID: 27 RVA: 0x0000294C File Offset: 0x00000B4C
        public static bool CustomDrawer_Filter(Rect rect, SettingHandle <float> slider, bool def_isPercentage, float def_min, float def_max, Color background)
        {
            DrawUtility.drawBackground(rect, background);
            int  num   = 50;
            Rect rect2 = new Rect(rect);

            rect2.width -= (float)num;
            Rect rect3 = new Rect(rect);

            rect3.width    = (float)num;
            rect3.position = new Vector2(rect2.position.x + rect2.width + 5f, rect2.position.y + 4f);
            rect2          = GenUI.ContractedBy(rect2, 2f);
            if (def_isPercentage)
            {
                Widgets.Label(rect3, Mathf.Round(slider.Value * 100f).ToString("F0") + "%");
            }
            else
            {
                Widgets.Label(rect3, slider.Value.ToString("F2"));
            }
            float num2   = Widgets.HorizontalSlider(rect2, slider.Value, def_min, def_max, true, null, null, null, -1f);
            bool  result = false;
            bool  flag   = slider.Value != num2;

            if (flag)
            {
                result = true;
            }
            slider.Value = num2;
            return(result);
        }
Beispiel #30
0
 private void PrepareModSettingHandles()
 {
     SettingHandle_AutoPauseNewsInterface = Settings.GetHandle("toggleAutoPauseNewsInterface",
                                                               "NewsUIAutoPause_title".Translate(), "NewsUIAutoPause_descr".Translate(), true);
     SettingHandle_OnlySpreadInSameRoom = Settings.GetHandle("toggleOnlySpreadInSameRoom",
                                                             "OnlySpreadInSameRoom_title".Translate(), "OnlySpreadInSameRoom_descr".Translate(), false);
 }
		private void PrepareSettingsHandles() {
			settingGlobalHotkeys = Settings.GetHandle("globalHotkeys", "setting_globalHotkeys_label".Translate(), "setting_globalHotkeys_desc".Translate(), true);
		}
			public DesignatorEntry(Designator_SelectableThings designator, KeyBindingDef key, SettingHandle<bool> visibilitySetting) {
				this.designator = designator;
				this.key = key;
				this.visibilitySetting = visibilitySetting;
			}