Game/BackgroundStyle.cs

A data class that defines cosmetic background styles for the game. It stores id, name, description, cost, and two preview colours, exposes a static array of all built-in styles and a helper to get a style by id with a default fallback.

namespace DesertPump;

/// <summary>
/// A scene to pump in. Purely cosmetic - bought once, kept forever, swapped whenever.
/// The look itself is drawn in GameHud.razor.scss under .scene-[Id].
/// </summary>
public sealed class BackgroundStyle
{
	/// <summary>Stable key used in the save file and as the css class suffix.</summary>
	public string Id { get; init; }

	public string Name { get; init; }
	public string Description { get; init; }

	/// <summary>Zero means it's yours from the start.</summary>
	public double Cost { get; init; }

	/// <summary>Two colours for the little preview swatch in the shop.</summary>
	public string PreviewTop { get; init; }
	public string PreviewBottom { get; init; }

	[SkipHotload]
	public static readonly BackgroundStyle[] All = new BackgroundStyle[]
	{
		new()
		{
			Id = "dawn",
			Name = "Desert Dawn",
			Description = "Where you started. Blue sky, hot sand, no shade anywhere.",
			Cost = 0,
			PreviewTop = "#4aa3d8",
			PreviewBottom = "#e9b264"
		},
		new()
		{
			Id = "dusk",
			Name = "Blood Moon",
			Description = "Night over the dunes, and something large and red watching.",
			Cost = 25_000,
			PreviewTop = "#241436",
			PreviewBottom = "#8c3a35"
		},
		new()
		{
			Id = "oasis",
			Name = "Green Oasis",
			Description = "You pumped enough water that things started growing.",
			Cost = 4_000_000,
			PreviewTop = "#3fb0a5",
			PreviewBottom = "#4f8f3a"
		},
		new()
		{
			Id = "neon",
			Name = "Neon Wastes",
			Description = "The desert, some time after everyone left. Still humming.",
			Cost = 900_000_000,
			PreviewTop = "#2a0b45",
			PreviewBottom = "#ff5fa2"
		},
		new()
		{
			Id = "sandstorm",
			Name = "Sandstorm",
			Description = "You can taste the horizon. The pump doesn't mind.",
			Cost = 50e9,
			PreviewTop = "#c99a52",
			PreviewBottom = "#7a5326"
		},
		new()
		{
			Id = "golden",
			Name = "Golden Hour",
			Description = "Twenty minutes a day where the desert looks kind.",
			Cost = 2e12,
			PreviewTop = "#f2884b",
			PreviewBottom = "#c1476a"
		},
		new()
		{
			Id = "starfield",
			Name = "Starfield",
			Description = "No moon, no cloud, and rather a lot of sky.",
			Cost = 120e12,
			PreviewTop = "#070b1c",
			PreviewBottom = "#2b3560"
		},
		new()
		{
			Id = "aurora",
			Name = "Aurora",
			Description = "Green light over the ice, moving like it's thinking.",
			Cost = 9e15,
			PreviewTop = "#04121f",
			PreviewBottom = "#3fd6a0"
		},
		new()
		{
			Id = "volcanic",
			Name = "Volcanic",
			Description = "The rock is warm and the water comes up boiling.",
			Cost = 600e15,
			PreviewTop = "#1a0806",
			PreviewBottom = "#e2542a"
		},
		new()
		{
			Id = "crystal",
			Name = "Crystal Cavern",
			Description = "Deep enough that the walls have started to glow.",
			Cost = 40e21,
			PreviewTop = "#160d33",
			PreviewBottom = "#7f6ae0"
		},
	};

	public const string DefaultId = "dawn";

	public static BackgroundStyle Get( string id ) =>
		All.FirstOrDefault( x => x.Id == id ) ?? All[0];
}