From d75b1a4d9f6a328e12525084bb0ce09f415264e1 Mon Sep 17 00:00:00 2001 From: shiibe Date: Wed, 14 Sep 2022 15:36:12 -0400 Subject: [PATCH] Costume select complete --- SharedProject/Models/CostumeData.cs | 16 ------- TaikoWebUI/Pages/Profile.razor | 17 +++++--- TaikoWebUI/Services/GameDataService.cs | 58 ++++++++++++++++++++++--- TaikoWebUI/Services/IGameDataService.cs | 2 - 4 files changed, 62 insertions(+), 31 deletions(-) delete mode 100644 SharedProject/Models/CostumeData.cs diff --git a/SharedProject/Models/CostumeData.cs b/SharedProject/Models/CostumeData.cs deleted file mode 100644 index f09ce43..0000000 --- a/SharedProject/Models/CostumeData.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System.Text.Json.Serialization; - -namespace SharedProject.Models; - -public class CostumeData -{ - public uint Head { get; set; } - - public uint Body { get; set; } - - public uint Face { get; set; } - - public uint Kigurumi { get; set; } - - public uint Puchi { get; set; } -} \ No newline at end of file diff --git a/TaikoWebUI/Pages/Profile.razor b/TaikoWebUI/Pages/Profile.razor index 2348264..8e3ba5e 100644 --- a/TaikoWebUI/Pages/Profile.razor +++ b/TaikoWebUI/Pages/Profile.razor @@ -11,7 +11,7 @@ - +

Profile Options

@@ -56,7 +56,8 @@ @for (uint i = 0; i < GameDataService.COSTUME_HEAD_MAX; i++) { var index = i; - @index + var costumeTitle = GameDataService.headMap[index]; + @index - @costumeTitle } @@ -64,7 +65,8 @@ @for (uint i = 0; i < GameDataService.COSTUME_BODY_MAX; i++) { var index = i; - @index + var costumeTitle = GameDataService.bodyMap[index]; + @index - @costumeTitle } @@ -72,7 +74,8 @@ @for (uint i = 0; i < GameDataService.COSTUME_FACE_MAX; i++) { var index = i; - @index + var costumeTitle = GameDataService.faceMap[index]; + @index - @costumeTitle } @@ -80,7 +83,8 @@ @for (uint i = 0; i < GameDataService.COSTUME_KIGURUMI_MAX; i++) { var index = i; - @index + var costumeTitle = GameDataService.kigurumiMap[index]; + @index - @costumeTitle } @@ -88,7 +92,8 @@ @for (uint i = 0; i < GameDataService.COSTUME_PUCHI_MAX; i++) { var index = i; - @index + var costumeTitle = GameDataService.puchiMap[index]; + @index - @costumeTitle }
diff --git a/TaikoWebUI/Services/GameDataService.cs b/TaikoWebUI/Services/GameDataService.cs index 871a991..b1d2f77 100644 --- a/TaikoWebUI/Services/GameDataService.cs +++ b/TaikoWebUI/Services/GameDataService.cs @@ -13,14 +13,18 @@ public class GameDataService : IGameDataService private ImmutableDictionary danMap = null!; - private ImmutableDictionary costumeMap = null!; - public const uint COSTUME_HEAD_MAX = 138; public const uint COSTUME_FACE_MAX = 57; public const uint COSTUME_BODY_MAX = 154; public const uint COSTUME_KIGURUMI_MAX = 152; public const uint COSTUME_PUCHI_MAX = 127; public const uint COSTUME_COLOR_MAX = 62; + + public static string[] headMap = new string[COSTUME_HEAD_MAX]; + public static string[] faceMap = new string[COSTUME_FACE_MAX]; + public static string[] bodyMap = new string[COSTUME_BODY_MAX]; + public static string[] kigurumiMap = new string[COSTUME_KIGURUMI_MAX]; + public static string[] puchiMap = new string[COSTUME_PUCHI_MAX]; public GameDataService(HttpClient client) { @@ -69,6 +73,51 @@ public class GameDataService : IGameDataService musicMap[songId].Index = index; } } + + for (var i = 0; i < COSTUME_HEAD_MAX; i++) + { + var index = i; + var key = $"costume_head_{index}"; + + var costumeWordlistItem = dict.GetValueOrDefault(key, new WordListEntry()); + headMap[index] = costumeWordlistItem.JapaneseText; + } + + for (var i = 0; i < COSTUME_FACE_MAX; i++) + { + var index = i; + var key = $"costume_face_{index}"; + + var costumeWordlistItem = dict.GetValueOrDefault(key, new WordListEntry()); + faceMap[index] = costumeWordlistItem.JapaneseText; + } + + for (var i = 0; i < COSTUME_BODY_MAX; i++) + { + var index = i; + var key = $"costume_body_{index}"; + + var costumeWordlistItem = dict.GetValueOrDefault(key, new WordListEntry()); + bodyMap[index] = costumeWordlistItem.JapaneseText; + } + + for (var i = 0; i < COSTUME_KIGURUMI_MAX; i++) + { + var index = i; + var key = $"costume_kigurumi_{index}"; + + var costumeWordlistItem = dict.GetValueOrDefault(key, new WordListEntry()); + kigurumiMap[index] = costumeWordlistItem.JapaneseText; + } + + for (var i = 0; i < COSTUME_PUCHI_MAX; i++) + { + var index = i; + var key = $"costume_puchi_{index}"; + + var costumeWordlistItem = dict.GetValueOrDefault(key, new WordListEntry()); + puchiMap[index] = costumeWordlistItem.JapaneseText; + } } public string GetMusicNameBySongId(uint songId) @@ -94,11 +143,6 @@ public class GameDataService : IGameDataService return danMap.GetValueOrDefault(danId, new DanData()); } - public string GetCostumeTitleById(uint costumeId, string type) - { - return ""; - } - public int GetMusicStarLevel(uint songId, Difficulty difficulty) { var success = musicMap.TryGetValue(songId, out var musicDetail); diff --git a/TaikoWebUI/Services/IGameDataService.cs b/TaikoWebUI/Services/IGameDataService.cs index a80c7bd..fbad860 100644 --- a/TaikoWebUI/Services/IGameDataService.cs +++ b/TaikoWebUI/Services/IGameDataService.cs @@ -8,8 +8,6 @@ public interface IGameDataService public string GetMusicArtistBySongId(uint songId); - public string GetCostumeTitleById(uint costumeId, string type); - public SongGenre GetMusicGenreBySongId(uint songId); public int GetMusicIndexBySongId(uint songId);