public override void Refresh()
    {
        SettingLevel currentQualitySetting = CustomGameSettings.Instance.GetCurrentQualitySetting(config);

        Toggle.ChangeState(config.IsOnLevel(currentQualitySetting.id) ? 1 : 0);
        ToggleToolTip.toolTip = currentQualitySetting.tooltip;
    }
Example #2
0
 private static ConfigFileSettings CreateLocal(VsrModule module, ConfigFileSettings lowerPriority,
                                               SettingLevel settingLevel, bool allowCache = true)
 {
     return(new ConfigFileSettings(lowerPriority,
                                   ConfigFileSettingsCache.Create(Path.Combine(module.GitCommonDirectory, "config"), true, allowCache),
                                   settingLevel));
 }
        protected void SetCredentials(SettingLevel settingLevel, string name, NetworkCredential?value)
        {
            var targetName = GetWindowsCredentialsTarget(name, settingLevel);

            Validates.NotNull(targetName);
            Credentials.AddOrUpdate(targetName, value, (s, credential) => value);
        }
Example #4
0
 private static RepoDistSettings CreateLocal(GitModule module, RepoDistSettings?lowerPriority,
                                             SettingLevel settingLevel, bool allowCache = true)
 {
     return(new RepoDistSettings(lowerPriority,
                                 GitExtSettingsCache.Create(Path.Combine(module.GitCommonDirectory, AppSettings.SettingsFileName), allowCache),
                                 settingLevel));
 }
 public RepoDistSettings(RepoDistSettings lowerPriority, GitExtSettingsCache settingsCache, SettingLevel settingLevel)
     : base(lowerPriority, settingsCache)
 {
     BuildServer  = new BuildServer(this);
     Detailed     = new DetailedGroup(this);
     SettingLevel = settingLevel;
 }
Example #6
0
    private void ApplyCustomGameSettings()
    {
        SettingLevel currentQualitySetting = CustomGameSettings.Instance.GetCurrentQualitySetting(CustomGameSettingConfigs.ImmuneSystem);

        if (currentQualitySetting.id == "Compromised")
        {
            Db.Get().Attributes.DiseaseCureSpeed.Lookup(this).Add(new AttributeModifier(Db.Get().Attributes.DiseaseCureSpeed.Id, -0.3333f, UI.FRONTEND.CUSTOMGAMESETTINGSSCREEN.SETTINGS.IMMUNESYSTEM.LEVELS.COMPROMISED.ATTRIBUTE_MODIFIER_NAME, false, false, true));
            Db.Get().Attributes.GermResistance.Lookup(this).Add(new AttributeModifier(Db.Get().Attributes.GermResistance.Id, -2f, UI.FRONTEND.CUSTOMGAMESETTINGSSCREEN.SETTINGS.IMMUNESYSTEM.LEVELS.COMPROMISED.ATTRIBUTE_MODIFIER_NAME, false, false, true));
        }
        else if (currentQualitySetting.id == "Weak")
        {
            Db.Get().Attributes.GermResistance.Lookup(this).Add(new AttributeModifier(Db.Get().Attributes.GermResistance.Id, -1f, UI.FRONTEND.CUSTOMGAMESETTINGSSCREEN.SETTINGS.IMMUNESYSTEM.LEVELS.WEAK.ATTRIBUTE_MODIFIER_NAME, false, false, true));
        }
        else if (currentQualitySetting.id == "Strong")
        {
            Db.Get().Attributes.DiseaseCureSpeed.Lookup(this).Add(new AttributeModifier(Db.Get().Attributes.DiseaseCureSpeed.Id, 2f, UI.FRONTEND.CUSTOMGAMESETTINGSSCREEN.SETTINGS.IMMUNESYSTEM.LEVELS.STRONG.ATTRIBUTE_MODIFIER_NAME, false, false, true));
            Db.Get().Attributes.GermResistance.Lookup(this).Add(new AttributeModifier(Db.Get().Attributes.GermResistance.Id, 2f, UI.FRONTEND.CUSTOMGAMESETTINGSSCREEN.SETTINGS.IMMUNESYSTEM.LEVELS.STRONG.ATTRIBUTE_MODIFIER_NAME, false, false, true));
        }
        else if (currentQualitySetting.id == "Invincible")
        {
            Db.Get().Attributes.DiseaseCureSpeed.Lookup(this).Add(new AttributeModifier(Db.Get().Attributes.DiseaseCureSpeed.Id, 1E+08f, UI.FRONTEND.CUSTOMGAMESETTINGSSCREEN.SETTINGS.IMMUNESYSTEM.LEVELS.INVINCIBLE.ATTRIBUTE_MODIFIER_NAME, false, false, true));
            Db.Get().Attributes.GermResistance.Lookup(this).Add(new AttributeModifier(Db.Get().Attributes.GermResistance.Id, 200f, UI.FRONTEND.CUSTOMGAMESETTINGSSCREEN.SETTINGS.IMMUNESYSTEM.LEVELS.INVINCIBLE.ATTRIBUTE_MODIFIER_NAME, false, false, true));
        }
        SettingLevel currentQualitySetting2 = CustomGameSettings.Instance.GetCurrentQualitySetting(CustomGameSettingConfigs.Stress);

        if (currentQualitySetting2.id == "Doomed")
        {
            Db.Get().Amounts.Stress.deltaAttribute.Lookup(this).Add(new AttributeModifier(Db.Get().Amounts.Stress.deltaAttribute.Id, 0.0333333351f, UI.FRONTEND.CUSTOMGAMESETTINGSSCREEN.SETTINGS.STRESS.LEVELS.DOOMED.ATTRIBUTE_MODIFIER_NAME, false, false, true));
        }
        else if (currentQualitySetting2.id == "Pessimistic")
        {
            Db.Get().Amounts.Stress.deltaAttribute.Lookup(this).Add(new AttributeModifier(Db.Get().Amounts.Stress.deltaAttribute.Id, 0.0166666675f, UI.FRONTEND.CUSTOMGAMESETTINGSSCREEN.SETTINGS.STRESS.LEVELS.PESSIMISTIC.ATTRIBUTE_MODIFIER_NAME, false, false, true));
        }
        else if (currentQualitySetting2.id == "Optimistic")
        {
            Db.Get().Amounts.Stress.deltaAttribute.Lookup(this).Add(new AttributeModifier(Db.Get().Amounts.Stress.deltaAttribute.Id, -0.0166666675f, UI.FRONTEND.CUSTOMGAMESETTINGSSCREEN.SETTINGS.STRESS.LEVELS.OPTIMISTIC.ATTRIBUTE_MODIFIER_NAME, false, false, true));
        }
        else if (currentQualitySetting2.id == "Indomitable")
        {
            Db.Get().Amounts.Stress.deltaAttribute.Lookup(this).Add(new AttributeModifier(Db.Get().Amounts.Stress.deltaAttribute.Id, float.NegativeInfinity, UI.FRONTEND.CUSTOMGAMESETTINGSSCREEN.SETTINGS.STRESS.LEVELS.INDOMITABLE.ATTRIBUTE_MODIFIER_NAME, false, false, true));
        }
        SettingLevel currentQualitySetting3 = CustomGameSettings.Instance.GetCurrentQualitySetting(CustomGameSettingConfigs.CalorieBurn);

        if (currentQualitySetting3.id == "VeryHard")
        {
            Db.Get().Amounts.Calories.deltaAttribute.Lookup(this).Add(new AttributeModifier(Db.Get().Amounts.Calories.deltaAttribute.Id, -1666.66663f, UI.FRONTEND.CUSTOMGAMESETTINGSSCREEN.SETTINGS.CALORIE_BURN.LEVELS.VERYHARD.ATTRIBUTE_MODIFIER_NAME, false, false, true));
        }
        else if (currentQualitySetting3.id == "Hard")
        {
            Db.Get().Amounts.Calories.deltaAttribute.Lookup(this).Add(new AttributeModifier(Db.Get().Amounts.Calories.deltaAttribute.Id, -833.3333f, UI.FRONTEND.CUSTOMGAMESETTINGSSCREEN.SETTINGS.CALORIE_BURN.LEVELS.HARD.ATTRIBUTE_MODIFIER_NAME, false, false, true));
        }
        else if (currentQualitySetting3.id == "Easy")
        {
            Db.Get().Amounts.Calories.deltaAttribute.Lookup(this).Add(new AttributeModifier(Db.Get().Amounts.Calories.deltaAttribute.Id, 833.3333f, UI.FRONTEND.CUSTOMGAMESETTINGSSCREEN.SETTINGS.CALORIE_BURN.LEVELS.EASY.ATTRIBUTE_MODIFIER_NAME, false, false, true));
        }
        else if (currentQualitySetting3.id == "Disabled")
        {
            Db.Get().Amounts.Calories.deltaAttribute.Lookup(this).Add(new AttributeModifier(Db.Get().Amounts.Calories.deltaAttribute.Id, float.PositiveInfinity, UI.FRONTEND.CUSTOMGAMESETTINGSSCREEN.SETTINGS.CALORIE_BURN.LEVELS.DISABLED.ATTRIBUTE_MODIFIER_NAME, false, false, true));
        }
    }
Example #7
0
 public ConfigFileSettings(ConfigFileSettings lowerPriority, ConfigFileSettingsCache settingsCache,
                           SettingLevel settingLevel)
     : base(lowerPriority, settingsCache)
 {
     core         = new CorePath(this);
     SettingLevel = settingLevel;
 }
    public string GetSettingsCoordinate()
    {
        ProcGen.World worldData             = SettingsCache.worlds.GetWorldData(Instance.GetCurrentQualitySetting(CustomGameSettingConfigs.World).id);
        SettingLevel  currentQualitySetting = Instance.GetCurrentQualitySetting(CustomGameSettingConfigs.WorldgenSeed);
        string        otherSettingsCode     = GetOtherSettingsCode();

        return($"{worldData.GetCoordinatePrefix()}-{currentQualitySetting.id}-{otherSettingsCode}");
    }
    public override void Refresh()
    {
        SettingLevel currentQualitySetting = CustomGameSettings.Instance.GetCurrentQualitySetting(config);

        ValueLabel.text           = currentQualitySetting.label;
        ValueToolTip.toolTip      = currentQualitySetting.tooltip;
        CycleLeft.isInteractable  = !config.IsFirstLevel(currentQualitySetting.id);
        CycleRight.isInteractable = !config.IsLastLevel(currentQualitySetting.id);
    }
Example #10
0
        private string GetWindowsCredentialsTarget(string name, SettingLevel settingLevel)
        {
            if (settingLevel == SettingLevel.Global)
            {
                return($"{name}");
            }

            var suffix = _getWorkingDir();

            return(string.IsNullOrWhiteSpace(suffix) ? null : $"{name}_{suffix}");
        }
Example #11
0
            private bool SettingLevelSupported(SettingLevel settingLevel)
            {
                switch (settingLevel)
                {
                case SettingLevel.Global:
                case SettingLevel.Local:
                case SettingLevel.Effective:
                    return(true);
                }

                return(false);
            }
    private void SettingChanged(SettingConfig config, SettingLevel level)
    {
        coordinate.text = CustomGameSettings.Instance.GetSettingsCoordinate();
        string setting  = newGameSettings.GetSetting(CustomGameSettingConfigs.World);
        string setting2 = newGameSettings.GetSetting(CustomGameSettingConfigs.WorldgenSeed);

        int.TryParse(setting2, out int result);
        ColonyDestinationAsteroidData colonyDestinationAsteroidData = destinationMapPanel.SelectAsteroid(setting, result);

        DebugUtil.LogArgs("Selected asteroid", setting, result);
        destinationProperties.SetDescriptors(colonyDestinationAsteroidData.GetParamDescriptors());
        startLocationProperties.SetDescriptors(colonyDestinationAsteroidData.GetTraitDescriptors());
    }
Example #13
0
            public static void Prefix(ref int width, ref int height)
            {
                Debug.Log(" === GridSettings_ResetMod INI === ");

                // 8x12 default
                //    if ()
                {
                    width  = 12 * 32;
                    height = 16 * 32;
                }
                return;

                //  ModConfig Config = new ModConfig(ModName);

                //   return;

                if (Game.Instance == null)
                {
                    return;
                }

                SettingConfig settingConfig         = Game.Instance.customSettings.QualitySettings[UseCustomWorldSize];
                SettingLevel  currentQualitySetting =
                    Game.Instance.customSettings.GetCurrentQualitySetting(UseCustomWorldSize);

                bool allowCustomSize = settingConfig?.IsDefaultLevel(currentQualitySetting.id) == true;

                if (!allowCustomSize)
                {
                    return;
                }

                SettingLevel currentQualitySettingX = Game.Instance.customSettings.GetCurrentQualitySetting(WorldsizeX);
                SettingLevel currentQualitySettingY = Game.Instance.customSettings.GetCurrentQualitySetting(WorldsizeY);

                if (Int32.TryParse(currentQualitySettingX.id, out width))
                {
                    width *= 32;
                }
                if (Int32.TryParse(currentQualitySettingY.id, out height))
                {
                    height *= 32;
                }

                //  if (Config.Enabled && Config.CustomWorldSize)
                //{
                //    width  = Config.width;
                //    height = Config.height;
                //}
            }
    public string GetSettingLevelTooltip(string setting_id, string level_id)
    {
        SettingConfig settingConfig = QualitySettings[setting_id];

        if (settingConfig != null)
        {
            SettingLevel level = settingConfig.GetLevel(level_id);
            if (level != null)
            {
                return(level.tooltip);
            }
        }
        Debug.LogWarning("No tooltip string for setting: " + setting_id + " level: " + level_id);
        return(string.Empty);
    }
 public void Sim4000ms(float dt)
 {
     if (!skipUpdate)
     {
         float        num = 0.004166667f;
         float        b   = 0.0416666679f;
         SettingLevel currentQualitySetting = CustomGameSettings.Instance.GetCurrentQualitySetting(CustomGameSettingConfigs.Morale);
         if (currentQualitySetting.id == "Disabled")
         {
             SetModifier(null);
         }
         else
         {
             if (currentQualitySetting.id == "Easy")
             {
                 num = 0.00333333341f;
                 b   = 0.0166666675f;
             }
             else if (currentQualitySetting.id == "Hard")
             {
                 num = 0.008333334f;
                 b   = 0.05f;
             }
             else if (currentQualitySetting.id == "VeryHard")
             {
                 num = 0.0166666675f;
                 b   = 0.0833333358f;
             }
             float totalValue  = qolAttribute.GetTotalValue();
             float totalValue2 = expectationAttribute.GetTotalValue();
             float num2        = totalValue2 - totalValue;
             if (totalValue < totalValue2)
             {
                 stressPenalty.modifier.SetValue(Mathf.Min(num2 * num, b));
                 SetModifier(stressPenalty);
             }
             else if (totalValue > totalValue2)
             {
                 stressBonus.modifier.SetValue(Mathf.Max((0f - num2) * -0.0166666675f, -0.0333333351f));
                 SetModifier(stressBonus);
             }
             else
             {
                 SetModifier(stressNeutral);
             }
         }
     }
 }
    private void DoWorldGenInitialize()
    {
        SettingLevel currentQualitySetting  = CustomGameSettings.Instance.GetCurrentQualitySetting(CustomGameSettingConfigs.World);
        SettingLevel currentQualitySetting2 = CustomGameSettings.Instance.GetCurrentQualitySetting(CustomGameSettingConfigs.WorldgenSeed);

        seed = int.Parse(currentQualitySetting2.id);
        List <string> randomTraits = SettingsCache.GetRandomTraits(seed);

        worldGen = new WorldGen(currentQualitySetting.id, randomTraits);
        Vector2I worldsize = worldGen.Settings.world.worldsize;

        GridSettings.Reset(worldsize.x, worldsize.y);
        worldGen.Initialise(UpdateProgress, OnError, seed, seed, seed, seed);
        firstPassGeneration = true;
        worldGen.GenerateOfflineThreaded();
    }
Example #17
0
        protected NetworkCredential GetCredentialOrDefault(SettingLevel settingLevel, [NotNull] string name, NetworkCredential defaultValue)
        {
            var targetName = GetWindowsCredentialsTarget(name, settingLevel);

            if (string.IsNullOrWhiteSpace(targetName))
            {
                return(defaultValue);
            }

            if (Credentials.TryGetValue(targetName, out var result) || AdysTechCredentialManagerWrapper.TryGetCredentials(targetName, out result))
            {
                return(result ?? defaultValue);
            }

            return(defaultValue);
        }
    private string GetOtherSettingsCode()
    {
        int num = 0;

        foreach (KeyValuePair <string, string> item in CurrentQualityLevelsBySetting)
        {
            SettingConfig settingConfig = QualitySettings[item.Key];
            if (settingConfig.coordinate_dimension >= 0 && settingConfig.coordinate_dimension_width >= 0)
            {
                SettingLevel level = settingConfig.GetLevel(item.Value);
                int          num2  = settingConfig.coordinate_dimension * level.coordinate_offset;
                num += num2;
            }
        }
        return(Base10toBase36(num));
    }
        public static void Prefix(ref int width, ref int height)
        {
            // 256x512 default

            Debug.Log(" === CWS: Using custom world size ... === ");
            //if (!CustomGameSettings.Get().is_custom_game)
            //if (!CustomGameSettings.Instance.is_custom_game)
            Debug.Log(" === " + CustomGameSettings.Instance.customGameMode + " === ");
            if (CustomGameSettings.Instance.customGameMode != CustomGameSettings.CustomGameMode.Custom)
            {
                Debug.Log(" === CWS: Nah, no custom game ... === ");
                return;
            }

            //SettingConfig settingConfig = CustomGameSettings.Get().QualitySettings[CustomWorldMod.UseCustomWorldSize];
            SettingConfig settingConfig         = CustomGameSettings.Instance.QualitySettings[CustomWorldMod.UseCustomWorldSize];
            SettingLevel  currentQualitySetting =
                //CustomGameSettings.Get().GetCurrentQualitySetting(CustomWorldMod.UseCustomWorldSize);
                CustomGameSettings.Instance.GetCurrentQualitySetting(CustomWorldMod.UseCustomWorldSize);

            bool allowCustomSize = !settingConfig.IsDefaultLevel(currentQualitySetting.id);

            if (!allowCustomSize)
            {
                Debug.Log(" === CWS: No custom size allowed ... === ");
                return;
            }

            //SettingLevel currentQualitySettingX = CustomGameSettings.Get().GetCurrentQualitySetting(CustomWorldMod.WorldsizeX);
            //SettingLevel currentQualitySettingY = CustomGameSettings.Get().GetCurrentQualitySetting(CustomWorldMod.WorldsizeY);
            SettingLevel currentQualitySettingX = CustomGameSettings.Instance.GetCurrentQualitySetting(CustomWorldMod.WorldsizeX);
            SettingLevel currentQualitySettingY = CustomGameSettings.Instance.GetCurrentQualitySetting(CustomWorldMod.WorldsizeY);

            Int32.TryParse(currentQualitySettingX.id, out width);
            Int32.TryParse(currentQualitySettingY.id, out height);

            Debug.Log(" === CWS: Using " + width + "/" + height + " as new world size === ");

            //  if (Config.Enabled && Config.CustomWorldSize)
            //{
            //    width  = Config.width;
            //    height = Config.height;
            //}
        }
Example #20
0
 static public ToggleSettingConfig NewToggleSetting(SettingLevel offlevel, SettingLevel onlevel)
 {
     return(new ToggleSettingConfig("", "", "", offlevel, onlevel, "", ""));
 }
Example #21
0
        protected void SetCredentials(SettingLevel settingLevel, [NotNull] string name, [CanBeNull] NetworkCredential value)
        {
            var targetName = GetWindowsCredentialsTarget(name, settingLevel);

            Credentials.AddOrUpdate(targetName, value, (s, credential) => value);
        }
 public ConfigFileSettings(ConfigFileSettings?lowerPriority, ConfigFileSettingsCache settingsCache,
                           SettingLevel settingLevel)
     : base(lowerPriority, settingsCache)
 {
     SettingLevel = settingLevel;
 }
Example #23
0
 public RepoDistSettings(RepoDistSettings?lowerPriority, GitExtSettingsCache settingsCache, SettingLevel settingLevel)
     : base(lowerPriority, settingsCache)
 {
     SettingLevel = settingLevel;
 }
        public static void Postfix(WorldGenSettings __instance, ref string worldName, ref List <string> traits)
        {
            // 256x512 default

            Debug.Log(" === CWS: Using custom world size ... Default: " + __instance.world.worldsize.x + "/" + __instance.world.worldsize.y + " === ");
            //if (!CustomGameSettings.Get().is_custom_game)
            //if (!CustomGameSettings.Instance.is_custom_game)
            Debug.Log(" === " + CustomGameSettings.Instance.customGameMode + " === ");
            if (CustomGameSettings.Instance.customGameMode != CustomGameSettings.CustomGameMode.Custom)
            {
                Debug.Log(" === CWS: Nah, no custom game ... === ");
                return;
            }

            //SettingConfig settingConfig = CustomGameSettings.Get().QualitySettings[CustomWorldSize.UseCustomWorldSize];
            SettingConfig settingConfig         = CustomGameSettings.Instance.QualitySettings[CustomWorldSize.UseCustomWorldSize];
            SettingLevel  currentQualitySetting =
                //CustomGameSettings.Get().GetCurrentQualitySetting(CustomWorldSize.UseCustomWorldSize);
                CustomGameSettings.Instance.GetCurrentQualitySetting(CustomWorldSize.UseCustomWorldSize);

            bool allowCustomSize = !settingConfig.IsDefaultLevel(currentQualitySetting.id);

            if (!allowCustomSize)
            {
                Debug.Log(" === CWS: No custom size applied ... === " + "Using " + __instance.world.worldsize.x + " / " + __instance.world.worldsize.y + " as new world size === ");
                return;
            }

            //SettingLevel currentQualitySettingX = CustomGameSettings.Get().GetCurrentQualitySetting(CustomWorldSize.WorldsizeX);
            //SettingLevel currentQualitySettingY = CustomGameSettings.Get().GetCurrentQualitySetting(CustomWorldSize.WorldsizeY);
            SettingLevel currentQualitySettingX = CustomGameSettings.Instance.GetCurrentQualitySetting(CustomWorldSize.WorldsizeX);
            SettingLevel currentQualitySettingY = CustomGameSettings.Instance.GetCurrentQualitySetting(CustomWorldSize.WorldsizeY);


            int width  = __instance.world.worldsize.x;
            int height = __instance.world.worldsize.y;

            Int32.TryParse(currentQualitySettingX.id, out width);
            Int32.TryParse(currentQualitySettingY.id, out height);

            Vector2I worldsize = __instance.world.worldsize;

            worldsize.x = width;
            worldsize.y = height;

            if (worldsize.x > worldsize.y)
            {
                Debug.Log(" === CWS: Fixing width. Width must be equals or less than height. There is a bug in ONI code somewhere :( otherwise, game crashes === ");
                worldsize.x = worldsize.y;
            }

            AccessTools.Property(typeof(ProcGen.World), "worldsize").SetValue(__instance.world, worldsize, null);

            Debug.Log(" === CWS: Using " + __instance.world.worldsize.x + "/" + __instance.world.worldsize.y + " as new world size === ");

            //  if (Config.Enabled && Config.CustomWorldSize)
            //{
            //    width  = Config.width;
            //    height = Config.height;
            //}
        }