private bool AllValuesMatch(Dictionary <string, string> data, CustomGameMode mode) { bool result = true; foreach (KeyValuePair <string, SettingConfig> qualitySetting in QualitySettings) { if (!(qualitySetting.Key == CustomGameSettingConfigs.WorldgenSeed.id)) { string b = null; switch (mode) { case CustomGameMode.Nosweat: b = qualitySetting.Value.nosweat_default_level_id; break; case CustomGameMode.Survival: b = qualitySetting.Value.default_level_id; break; } if (data.ContainsKey(qualitySetting.Key) && data[qualitySetting.Key] != b) { return(false); } } } return(result); }
public void SetNosweatDefaults() { customGameMode = CustomGameMode.Nosweat; LoadWorlds(); foreach (KeyValuePair <string, SettingConfig> qualitySetting in QualitySettings) { SetQualitySetting(qualitySetting.Value, qualitySetting.Value.nosweat_default_level_id); } }
public void SetSurvivalDefaults() { customGameMode = CustomGameMode.Survival; LoadWorlds(); foreach (KeyValuePair <string, SettingConfig> qualitySetting in QualitySettings) { SetQualitySetting(qualitySetting.Value, qualitySetting.Value.default_level_id); } }
private void OnDeserialized() { if (SaveLoader.Instance.GameInfo.IsVersionOlderThan(7, 6)) { customGameMode = (is_custom_game ? CustomGameMode.Custom : CustomGameMode.Survival); } if (CurrentQualityLevelsBySetting.ContainsKey("CarePackages ")) { if (!CurrentQualityLevelsBySetting.ContainsKey(CustomGameSettingConfigs.CarePackages.id)) { CurrentQualityLevelsBySetting.Add(CustomGameSettingConfigs.CarePackages.id, CurrentQualityLevelsBySetting["CarePackages "]); } CurrentQualityLevelsBySetting.Remove("CarePackages "); } }
public List <MetricSettingsData> GetSettingsForMetrics() { List <MetricSettingsData> list = new List <MetricSettingsData>(); list.Add(new MetricSettingsData { Name = "CustomGameMode", Value = this.customGameMode.ToString() }); foreach (KeyValuePair <string, string> item2 in CurrentQualityLevelsBySetting) { list.Add(new MetricSettingsData { Name = item2.Key, Value = item2.Value }); } MetricSettingsData metricSettingsData = default(MetricSettingsData); metricSettingsData.Name = "CustomGameModeActual"; metricSettingsData.Value = 255.ToString(); MetricSettingsData item = metricSettingsData; IEnumerator enumerator2 = Enum.GetValues(typeof(CustomGameMode)).GetEnumerator(); try { while (enumerator2.MoveNext()) { CustomGameMode customGameMode = (CustomGameMode)enumerator2.Current; if (customGameMode != CustomGameMode.Custom && AllValuesMatch(CurrentQualityLevelsBySetting, customGameMode)) { item.Value = customGameMode.ToString(); break; } } } finally { IDisposable disposable; if ((disposable = (enumerator2 as IDisposable)) != null) { disposable.Dispose(); } } list.Add(item); return(list); }
public void SetQualitySetting(SettingConfig config, string value) { CurrentQualityLevelsBySetting[config.id] = value; bool flag = true; bool flag2 = true; foreach (KeyValuePair <string, string> item in CurrentQualityLevelsBySetting) { if (QualitySettings[item.Key].triggers_custom_game) { if (item.Value != QualitySettings[item.Key].default_level_id) { flag = false; } if (item.Value != QualitySettings[item.Key].nosweat_default_level_id) { flag2 = false; } if (!flag && !flag2) { break; } } } CustomGameMode customGameMode = (!flag) ? (flag2 ? CustomGameMode.Nosweat : CustomGameMode.Custom) : CustomGameMode.Survival; if (customGameMode != this.customGameMode) { DebugUtil.LogArgs("Game mode changed from", this.customGameMode, "to", customGameMode); this.customGameMode = customGameMode; } if (this.OnSettingChanged != null) { this.OnSettingChanged(config, GetCurrentQualitySetting(config)); } }