@using System.Globalization Herkunft @if (_max > 0) { 1 @for (var level = 1; level <= Levels; level++) { } @Formatting.Number(_max) } @foreach (var country in Map.Countries) { var count = Count(country.Code); @Title(CountryNames.Display(country.Code, country.Name)!, count) } @foreach (var marker in Map.Markers) { var count = Count(marker.Code); if (count > 0) { var x = marker.X.ToString(CultureInfo.InvariantCulture); var y = marker.Y.ToString(CultureInfo.InvariantCulture); @Title(CountryNames.Display(marker.Code, marker.Name)!, count) } } @if (_max == 0) { Sobald Bots anklopfen, färbt sich die Karte nach Herkunftsland. } @code { private const int Levels = 5; private int _max; [Parameter, EditorRequired] public required IReadOnlyDictionary CatchesByCountry { get; set; } private static WorldMapData Map => WorldMapData.Instance; protected override void OnParametersSet() => _max = CatchesByCountry.Count == 0 ? 0 : CatchesByCountry.Values.Max(); private int Count(string? code) => code is not null && CatchesByCountry.TryGetValue(code, out var count) ? count : 0; private static string Title(string name, int count) => $"{name}: {count:N0} {(count == 1 ? "Fang" : "Fänge")}"; private int Level(int count) => count == 0 || _max == 0 ? 0 : Math.Max(1, (int)Math.Ceiling(Math.Log(count + 1) / Math.Log(_max + 1) * Levels)); }
Sobald Bots anklopfen, färbt sich die Karte nach Herkunftsland.