/// <summary> /// Gets Loading Counter with user settings. /// </summary> /// <param name="labelText">Text shown while loading.</param> /// <param name="labelTextFinish">Text shown after loading.</param> private LoadingLabel MakeLabel(ModSettings settings) { const string loadingLabelSection = "LoadingLabel"; if (!settings.GetBool(loadingLabelSection, "Enable")) { return(null); } string labelText = settings.GetString(loadingLabelSection, "LoadingText"); bool isDynamic = settings.GetBool(loadingLabelSection, "IsDynamic"); string labelTextFinish = settings.GetString(loadingLabelSection, "EndText"); string deathLabel = settings.GetString(loadingLabelSection, "DeathText"); Rect rect = GetRect( settings.GetTupleInt(loadingLabelSection, "Position"), new Tuple <int, int>(10, 3)); return(new LoadingLabel(rect, labelText, labelTextFinish, isDynamic, ".", deathLabel) { Font = settings.GetInt(loadingLabelSection, "Font"), FontSize = settings.GetInt(loadingLabelSection, "FontSize"), FontStyle = (FontStyle)settings.GetInt(loadingLabelSection, "FontStyle"), FontColor = settings.GetColor(loadingLabelSection, "FontColor") }); }
/// <summary> /// Gets Level Counter with user settings. /// </summary> private LevelCounter MakeLevelCounter(ModSettings settings) { const string levelProgressSection = "LevelProgress"; if (!settings.GetBool(levelProgressSection, "Enable")) { return(null); } Rect rect = GetRect( settings.GetTupleInt(levelProgressSection, "Position"), settings.GetTupleInt(levelProgressSection, "Size")); return(new LevelCounter(rect) { LabelFormat = settings.GetString(levelProgressSection, "Text"), Font = settings.GetInt(levelProgressSection, "Font"), FontColor = settings.GetColor(levelProgressSection, "FontColor"), }); }
/// <summary> /// Gets Quests Messages with user settings. /// </summary> private QuestsMessages MakeQuestMessages(ModSettings settings) { const string questsSection = "Quests"; if (!settings.GetBool(questsSection, "Enable")) { return(null); } Rect rect = GetRect( settings.GetTupleInt(questsSection, "Position"), settings.GetTupleInt(questsSection, "Size")); return(new QuestsMessages(rect) { Font = settings.GetInt(questsSection, "Font"), FontStyle = (FontStyle)settings.GetInt(questsSection, "FontStyle"), FontColor = settings.GetColor(questsSection, "FontColor") }); }
/// <summary> /// Gets Daggerfall Tips with user settings. /// </summary> private DfTips MakeTips(ModSettings settings) { const string tipsSection = "Tips"; if (!settings.GetBool(tipsSection, "Enable")) { return(null); } Rect rect = GetRect( settings.GetTupleInt(tipsSection, "Position"), settings.GetTupleInt(tipsSection, "Size")); return(new DfTips(rect) { Font = settings.GetInt(tipsSection, "Font"), FontStyle = (FontStyle)settings.GetInt(tipsSection, "FontStyle"), FontColor = settings.GetColor(tipsSection, "FontColor") }); }
private void LoadSettings(ModSettings settings, ModSettingsChange change) { const string style = "Style", waterPlantsSection = "WaterPlants", grassSection = "Grass", advancedSection = "Advanced"; options.WaterPlants = settings.GetBool(waterPlantsSection, "Enabled"); var properties = new PrototypesProperties() { GrassHeight = settings.GetTupleFloat(grassSection, "Height"), GrassWidth = settings.GetTupleFloat(grassSection, "Width"), NoiseSpread = settings.GetFloat(grassSection, "NoiseSpread"), GrassColors = new GrassColors() { SpringHealthy = settings.GetColor(grassSection, "SpringHealthy"), SpringDry = settings.GetColor(grassSection, "SpringDry"), SummerHealty = settings.GetColor(grassSection, "SummerHealty"), SummerDry = settings.GetColor(grassSection, "SummerDry"), FallHealty = settings.GetColor(grassSection, "FallHealty"), FallDry = settings.GetColor(grassSection, "FallDry"), SeasonInterpolation = settings.GetBool(grassSection, "SeasonInterpolation") }, UseGrassShader = !settings.GetBool(style, "Billboard"), TextureOverride = settings.GetBool(advancedSection, "TextureOverride") }; var density = new Density() { GrassThick = settings.GetTupleInt(grassSection, "ThickDensity"), GrassThin = settings.GetTupleInt(grassSection, "ThinDensity"), WaterPlants = settings.GetTupleInt(waterPlantsSection, "Density"), DesertPlants = settings.GetTupleInt(waterPlantsSection, "DesertDensity"), }; switch (settings.GetInt(style, "Stones")) { case 0: options.TerrainStones = false; break; case 1: options.TerrainStones = true; density.Rocks = 2; break; case 2: options.TerrainStones = true; density.Rocks = 4; break; } if (change.HasChanged(style, "Style")) { switch (settings.GetValue <int>(style, "Style")) { case 0: default: options.GrassStyle = GrassStyle.Classic; break; case 1: options.GrassStyle = GrassStyle.Mixed; break; case 2: options.GrassStyle = GrassStyle.Full; break; } } if (change.HasChanged(advancedSection)) { options.DetailObjectDistance = settings.GetValue <int>(advancedSection, "DetailDistance"); string detailDistanceOverride = settings.GetValue <string>(advancedSection, "DetailDistanceOverride"); if (!string.IsNullOrWhiteSpace(detailDistanceOverride) && int.TryParse(detailDistanceOverride, out int value)) { options.DetailObjectDistance = value; Debug.Log($"{this}: override detail distance with {value}", this); } options.DetailObjectDensity = settings.GetValue <float>(advancedSection, "DetailDensity"); options.FlyingInsects = settings.GetValue <bool>(advancedSection, "FlyingInsects"); } detailPrototypesManager = new DetailPrototypesManager(mod, transform, options, properties); densityManager = new DensityManager(mod, options, density); if (isEnabled) { RefreshTerrainDetailsAsync(); } }
private void LoadSettings(ModSettings settings, ModSettingsChange change) { const string waterPlantsSection = "WaterPlants", grassSection = "Grass", othersSection = "Others", advancedSection = "Advanced"; // Optional details int waterPlantsMode = settings.GetInt(waterPlantsSection, "Mode"); WaterPlants = waterPlantsMode != 0; WinterPlants = waterPlantsMode == 2; // Detail prototypes settings var properties = new PrototypesProperties() { GrassHeight = settings.GetTupleFloat(grassSection, "Height"), GrassWidth = settings.GetTupleFloat(grassSection, "Width"), NoiseSpread = settings.GetFloat(grassSection, "NoiseSpread"), GrassColors = new GrassColors() { SpringHealthy = settings.GetColor(grassSection, "SpringHealthy"), SpringDry = settings.GetColor(grassSection, "SpringDry"), SummerHealty = settings.GetColor(grassSection, "SummerHealty"), SummerDry = settings.GetColor(grassSection, "SummerDry"), FallHealty = settings.GetColor(grassSection, "FallHealty"), FallDry = settings.GetColor(grassSection, "FallDry"), }, UseGrassShader = settings.GetInt(grassSection, "Shader") == 1, NoiseSpreadPlants = settings.GetFloat(waterPlantsSection, "NoiseSpread"), TextureOverride = settings.GetBool(advancedSection, "TextureOverride") }; // Detail prototypes density var density = new Density() { GrassThick = settings.GetTupleInt(grassSection, "ThickDensity"), GrassThin = settings.GetTupleInt(grassSection, "ThinDensity"), WaterPlants = settings.GetTupleInt(waterPlantsSection, "Density"), DesertPlants = settings.GetTupleInt(waterPlantsSection, "DesertDensity"), }; switch (settings.GetInt(othersSection, "Flowers")) { case 0: Flowers = false; break; case 1: Flowers = true; density.Flowers = 5; break; case 2: Flowers = true; density.Flowers = 25; break; case 3: Flowers = true; density.Flowers = 50; break; } switch (settings.GetInt(othersSection, "Stones")) { case 0: TerrainStones = false; break; case 1: TerrainStones = true; density.Rocks = 2; break; case 2: TerrainStones = true; density.Rocks = 4; break; } if (change.HasChanged(grassSection, "Realistic")) { RealisticGrass = settings.GetValue <bool>(grassSection, "Realistic"); } if (change.HasChanged(othersSection, "FlyingInsects")) { FlyingInsects = settings.GetValue <bool>(othersSection, "FlyingInsects"); } if (change.HasChanged(advancedSection)) { DetailObjectDistance = settings.GetValue <int>(advancedSection, "DetailDistance"); DetailObjectDensity = settings.GetValue <float>(advancedSection, "DetailDensity"); } detailPrototypesManager = new DetailPrototypesManager(properties); densityManager = new DensityManager(density); if (isEnabled) { RefreshTerrainDetailsAsync(); } }