From 06ec07169be5cd2edf535081444db29da6a07305 Mon Sep 17 00:00:00 2001 From: Michael Bond Date: Mon, 25 Nov 2024 22:56:30 -0500 Subject: [PATCH] Begin support for country / region (Gen IV - VII) --- .../MainTabPages/TrainerInfoTab.razor | 33 +++++++++++++++++++ .../MainTabPages/TrainerInfoTab.razor.cs | 24 ++++++++++++++ 2 files changed, 57 insertions(+) diff --git a/Pkmds.Web/Components/MainTabPages/TrainerInfoTab.razor b/Pkmds.Web/Components/MainTabPages/TrainerInfoTab.razor index 5e5029cc..a5cf8d8b 100644 --- a/Pkmds.Web/Components/MainTabPages/TrainerInfoTab.razor +++ b/Pkmds.Web/Components/MainTabPages/TrainerInfoTab.razor @@ -75,6 +75,39 @@ } + @if (saveFile is SAV4 sav4Geo) + { +
+ + @foreach (var country in Countries.OrderBy(c => c.Text)) + { + + @country.Text + + } + +
+
+ + @foreach (var region in Regions) + { + + @region.Text + + } + +
+ } +
private TimeSpan? HallOfFameTime { get; set; } + private List Countries { get; set; } = []; + + private List Regions { get; set; } = []; + protected override void OnParametersSet() { base.OnParametersSet(); (GameStartedDate, GameStartedTime) = GetGameStarted(); (HallOfFameDate, HallOfFameTime) = GetHallOfFame(); + Countries = Util.GetCountryRegionList("countries", GameInfo.CurrentLanguage); + } + + private void UpdateCountry() + { + var countryId = AppState.SaveFile switch + { + SAV4 sav4Geo => sav4Geo.Country, + SAV5 sav5Geo => sav5Geo.Country, + SAV6 sav6Geo => sav6Geo.Country, + SAV7 sav7Geo => sav7Geo.Country, + _ => 0, + }; + + if (countryId == 0) + { + return; + } + + Regions = Util.GetCountryRegionList($"sr_{countryId:000}", GameInfo.CurrentLanguage); } private void OnGenderToggle(Gender newGender)