From 0888581d27a266809852b51a11fa6d865c77c95e Mon Sep 17 00:00:00 2001 From: shiibe Date: Wed, 14 Sep 2022 14:17:46 -0400 Subject: [PATCH] Add color pickers --- SharedProject/Models/CostumeData.cs | 16 ++ TaikoWebUI/Pages/Profile.razor | 253 +++++++++++++++--------- TaikoWebUI/Pages/Profile.razor.cs | 35 ++-- TaikoWebUI/Services/GameDataService.cs | 17 +- TaikoWebUI/Services/IGameDataService.cs | 2 + TaikoWebUI/wwwroot/style.overrides.css | 11 ++ 6 files changed, 219 insertions(+), 115 deletions(-) create mode 100644 SharedProject/Models/CostumeData.cs diff --git a/SharedProject/Models/CostumeData.cs b/SharedProject/Models/CostumeData.cs new file mode 100644 index 0000000..f09ce43 --- /dev/null +++ b/SharedProject/Models/CostumeData.cs @@ -0,0 +1,16 @@ +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 f898932..2348264 100644 --- a/TaikoWebUI/Pages/Profile.razor +++ b/TaikoWebUI/Pages/Profile.razor @@ -8,116 +8,180 @@ @if (response is not null) { - + - - -

Profile Options

+ + + + +

Profile Options

- + - - - - - - - @for (uint i = 0; i < 8; i++) + + + + + + + @for (uint i = 0; i < 8; i++) + { + var index = i; + @titlePlateStrings[index] + } + + + + + + @foreach (var item in Enum.GetValues()) { - var index = i; - @titlePlateStrings[index] + } - - - - @foreach (var item in Enum.GetValues()) - { - - } - + + +
+
- - -
-
+ + +

Costume Options

+ + + + + @for (uint i = 0; i < GameDataService.COSTUME_HEAD_MAX; i++) + { + var index = i; + @index + } + - - -

Song Options

- - - - - - - - - - - - - @for (uint i = 0; i < 15; i++) - { - var index = i; - @speedStrings[index] - } - + + @for (uint i = 0; i < GameDataService.COSTUME_BODY_MAX; i++) + { + var index = i; + @index + } + - - @foreach (var item in Enum.GetValues()) - { - - } - + + @for (uint i = 0; i < GameDataService.COSTUME_FACE_MAX; i++) + { + var index = i; + @index + } + - - @for (uint i = 0; i < 19; i++) - { - var index = i; - @toneStrings[index] - } - + + @for (uint i = 0; i < GameDataService.COSTUME_KIGURUMI_MAX; i++) + { + var index = i; + @index + } + - - Notes Position - - - - -
-
+ + @for (uint i = 0; i < GameDataService.COSTUME_PUCHI_MAX; i++) + { + var index = i; + @index + } + +
- - - Costume Options - - - - - - - - - - - - - - - - - - - + + + @for (uint i = 0; i < GameDataService.COSTUME_COLOR_MAX; i++) + { + var index = i; + +
+ @index +
+ } +
+ + @for (uint i = 0; i < GameDataService.COSTUME_COLOR_MAX; i++) + { + var index = i; + +
+ @index +
+ } +
+ + @for (uint i = 0; i < GameDataService.COSTUME_COLOR_MAX; i++) + { + var index = i; + +
+ @index +
+ } +
+
+
+
+
+
+ + +

Song Options

+ + + + + + + + + + + + + @for (uint i = 0; i < 15; i++) + { + var index = i; + @speedStrings[index] + } + + + + @foreach (var item in Enum.GetValues()) + { + + } + + + + @for (uint i = 0; i < 19; i++) + { + var index = i; + @toneStrings[index] + } + + + + Notes Position + + + + +
+
+
- - + + + +
} \ No newline at end of file diff --git a/TaikoWebUI/Pages/Profile.razor.cs b/TaikoWebUI/Pages/Profile.razor.cs index 68359d6..c65ac9f 100644 --- a/TaikoWebUI/Pages/Profile.razor.cs +++ b/TaikoWebUI/Pages/Profile.razor.cs @@ -1,4 +1,6 @@ -namespace TaikoWebUI.Pages; +using MudBlazor.Utilities; + +namespace TaikoWebUI.Pages; public partial class Profile { @@ -9,26 +11,19 @@ public partial class Profile private bool isSavingOptions; - private const int COSTUME_HEAD_MAX = 138; - private const int COSTUME_FACE_MAX = 57; - private const int COSTUME_BODY_MAX = 154; - private const int COSTUME_KIGURUMI_MAX = 152; - private const int COSTUME_PUCHI_MAX = 127; - private const int COSTUME_COLOR_MAX = 62; - - private readonly string[] costumeColors = + public string[] costumeColors = { - "F84828", "68C0C0", "DC1500", "F8F0E0", "009687", "00BF87", - "00FF9A", "66FFC2", "FFFFFF", "690000", "FF0000", "FF6666", - "FFB3B3", "00BCC2", "00F7FF", "66FAFF", "B3FDFF", "B3FDFF", - "E4E4E4", "993800", "FF5E00", "FF9E78", "FFCFB3", "005199", - "0088FF", "66B8FF", "B3DBFF", "B9B9B9", "B37700", "FFAA00", - "FFCC66", "FFE2B3", "000C80", "0019FF", "6675FF", "B3BAFF", - "858585", "B39B00", "FFDD00", "FFFF71", "2B0080", "5500FF", - "9966FF", "CCB3FF", "505050", "38A100", "78C900", "B3FF00", - "DCFF8A", "610080", "C400FF", "DC66FF", "EDB3FF", "232323", - "006600", "00B800", "00FF00", "8AFF9E", "990059", "FF0095", - "FF66BF", "FFB3DF", "000000" + "#F84828", "#68C0C0", "#DC1500", "#F8F0E0", "#009687", "#00BF87", + "#00FF9A", "#66FFC2", "#FFFFFF", "#690000", "#FF0000", "#FF6666", + "#FFB3B3", "#00BCC2", "#00F7FF", "#66FAFF", "#B3FDFF", "#E4E4E4", + "#993800", "#FF5E00", "#FF9E78", "#FFCFB3", "#005199", "#0088FF", + "#66B8FF", "#B3DBFF", "#B9B9B9", "#B37700", "#FFAA00", "#FFCC66", + "#FFE2B3", "#000C80", "#0019FF", "#6675FF", "#B3BAFF", "#858585", + "#B39B00", "#FFDD00", "#FFFF71", "#2B0080", "#5500FF", "#9966FF", + "#CCB3FF", "#505050", "#38A100", "#78C900", "#B3FF00", "#DCFF8A", + "#610080", "#C400FF", "#DC66FF", "#EDB3FF", "#232323", "#006600", + "#00B800", "#00FF00", "#8AFF9E", "#990059", "#FF0095", "#FF66BF", + "#FFB3DF", "#000000" }; private readonly string[] speedStrings = diff --git a/TaikoWebUI/Services/GameDataService.cs b/TaikoWebUI/Services/GameDataService.cs index 4fd7c2f..871a991 100644 --- a/TaikoWebUI/Services/GameDataService.cs +++ b/TaikoWebUI/Services/GameDataService.cs @@ -1,4 +1,5 @@ using System.Collections.Immutable; +using MudBlazor.Utilities; using Swan.Mapping; using TaikoWebUI.Shared.Models; @@ -12,6 +13,15 @@ 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 GameDataService(HttpClient client) { this.client = client; @@ -38,7 +48,7 @@ public class GameDataService : IGameDataService { var songNameKey = $"song_{music.Id}"; var songArtistKey = $"song_sub_{music.Id}"; - + var musicName = dict.GetValueOrDefault(songNameKey, new WordListEntry()); var musicArtist = dict.GetValueOrDefault(songArtistKey, new WordListEntry()); @@ -84,6 +94,11 @@ 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 fbad860..a80c7bd 100644 --- a/TaikoWebUI/Services/IGameDataService.cs +++ b/TaikoWebUI/Services/IGameDataService.cs @@ -8,6 +8,8 @@ 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); diff --git a/TaikoWebUI/wwwroot/style.overrides.css b/TaikoWebUI/wwwroot/style.overrides.css index 61dab8d..bbae00c 100644 --- a/TaikoWebUI/wwwroot/style.overrides.css +++ b/TaikoWebUI/wwwroot/style.overrides.css @@ -18,4 +18,15 @@ .mud-progress-linear.bar-pass-red .mud-typography { font-weight: bold; color: #333; +} + +.color-box { + width: 16px; + height: 16px; + border-radius: 9999px; + display: inline-block; + margin-right: 10px; + border: 1px solid black; + position: relative; + top: 2px; } \ No newline at end of file