From 14261c8e294c27d6fa2b1c07795e0c4547b053ca Mon Sep 17 00:00:00 2001 From: jiych1 Date: Thu, 7 Jul 2022 21:46:17 +0800 Subject: [PATCH] Change avatar/navigator/title select method Add the function to change player name --- .../controllers/ApiController.cs | 14 + MudAdmin/MudAdmin.csproj | 13 + MudAdmin/Pages/ChangePlayerNameDialog.razor | 73 +++ MudAdmin/Pages/FavoriteDialog.razor | 2 +- MudAdmin/Pages/User.razor | 479 +++++++++++------- MudAdmin/Pages/User.razor.cs | 129 +++-- MudAdmin/Pages/Users.razor | 24 +- MudAdmin/Shared/MainLayout.razor | 2 +- SharedProject/SharedProject.csproj | 4 + SharedProject/common/SharedConstants.cs | 10 +- .../enums/NavigatorDefaultAvailability.cs | 5 +- SharedProject/enums/NavigatorGenre.cs | 5 +- SharedProject/enums/TitleUnlockType.cs | 5 +- SharedProject/models/Avatar.cs | 23 +- SharedProject/models/NameEntry.cs | 14 +- SharedProject/models/Navigator.cs | 19 +- SharedProject/models/Navigators.cs | 7 +- SharedProject/models/Title.cs | 17 +- SharedProject/models/User.cs | 6 +- 19 files changed, 610 insertions(+), 241 deletions(-) create mode 100644 MudAdmin/Pages/ChangePlayerNameDialog.razor diff --git a/GC-local-server-rewrite/controllers/ApiController.cs b/GC-local-server-rewrite/controllers/ApiController.cs index 2dc5923..5608016 100644 --- a/GC-local-server-rewrite/controllers/ApiController.cs +++ b/GC-local-server-rewrite/controllers/ApiController.cs @@ -39,6 +39,20 @@ public List GetUsers() return result; } + [Route(HttpVerbs.Post, "/Users/SetPlayerName")] + public bool SetPlayerName([JsonData] User data) + { + var existing = cardSqLiteConnection.Table().Where(card => card.CardId == data.CardId); + if (!existing.Any()) + { + $"Trying to update non existing user's name! Card id {data.CardId}".Warn(); + return false; + } + var user = existing.First(); + user.PlayerName = data.PlayerName; + return cardSqLiteConnection.Update(user) == 1; + } + [Route(HttpVerbs.Post, "/UserDetail/SetMusicFavorite")] // ReSharper disable once UnusedMember.Global public bool SetFavorite([JsonData] MusicFavoriteData data) diff --git a/MudAdmin/MudAdmin.csproj b/MudAdmin/MudAdmin.csproj index 88d99c7..03d1869 100644 --- a/MudAdmin/MudAdmin.csproj +++ b/MudAdmin/MudAdmin.csproj @@ -19,6 +19,7 @@ + @@ -30,6 +31,18 @@ PreserveNewest true + + PreserveNewest + true + + + PreserveNewest + true + + + PreserveNewest + true + PreserveNewest true diff --git a/MudAdmin/Pages/ChangePlayerNameDialog.razor b/MudAdmin/Pages/ChangePlayerNameDialog.razor new file mode 100644 index 0000000..912a248 --- /dev/null +++ b/MudAdmin/Pages/ChangePlayerNameDialog.razor @@ -0,0 +1,73 @@ +@using SharedProject.common +@using System.Text.RegularExpressions +@inject HttpClient Client +@inject ILogger Logger + + + + + Change Player Name + + + + + + + + + + Cancel + Confirm + + + +@code { + + [CascadingParameter] + MudDialogInstance MudDialog { get; set; } = null!; + + [Parameter] + public SharedProject.models.User Data { get; set; } = null!; + + private string originalName = string.Empty; + + private bool IsValid { get; set; } + + protected override void OnInitialized() + { + base.OnInitialized(); + originalName = new string(Data.PlayerName); + } + + async Task Submit() + { + Logger.LogInformation("Data is {cardId}, {name}", Data.CardId, Data.PlayerName); + var response = await Client.PostAsJsonAsync("api/Users/SetPlayerName", Data); + var result = await response.Content.ReadFromJsonAsync(); + Logger.LogInformation("SetPlayerName result is {result}", result); + MudDialog.Close(DialogResult.Ok(result)); + } + + void Cancel() + { + Data.PlayerName = originalName; + MudDialog.Cancel(); + } + + private static string? ValidatePlayerName(string playerName) + { + const string pattern = @"^[a-zA-Z0-9!?,./\-+:<>_\\@*#&=() ]{1,8}$"; + + return playerName.Length switch + { + 0 => "Player name cannot be empty!", + > 8 => "Player name cannot be longer than 8 characters!", + _ => !Regex.IsMatch(playerName, pattern) ? "Player name contains invalid character!" : null + }; + + } +} \ No newline at end of file diff --git a/MudAdmin/Pages/FavoriteDialog.razor b/MudAdmin/Pages/FavoriteDialog.razor index 639da68..5635759 100644 --- a/MudAdmin/Pages/FavoriteDialog.razor +++ b/MudAdmin/Pages/FavoriteDialog.razor @@ -38,7 +38,7 @@ [Parameter] public long CardId { get; set; } - async void Submit() + async Task Submit() { var postData = new MusicFavoriteData { diff --git a/MudAdmin/Pages/User.razor b/MudAdmin/Pages/User.razor index 527f9e7..110151f 100644 --- a/MudAdmin/Pages/User.razor +++ b/MudAdmin/Pages/User.razor @@ -4,203 +4,302 @@ User - @if (pageLoading) +@if (pageLoading) +{ + + + +} +else +{ + if (userDetail is null) { - - - + No Data } else { - if (userDetail is null) - { - No Data - } - else - { - - - - Player Name: @userDetail.PlayerName - Total Score: @userDetail.TotalScore - Average Score: @userDetail.AverageScore - Played Song Count: @userDetail.PlayedSongCount / @userDetail.TotalSongCount - Cleared Stage Count: @userDetail.ClearedStageCount / @userDetail.TotalStageCount - No Miss Stage Count: @userDetail.NoMissStageCount / @userDetail.TotalStageCount - Full Chain Stage Count: @userDetail.FullChainStageCount / @userDetail.TotalStageCount - Perfect Stage Count: @userDetail.PerfectStageCount / @userDetail.TotalStageCount - S and Above Stage Count: @userDetail.SAboveStageCount / @userDetail.TotalStageCount - S+ and Above Stage Count: @userDetail.SPlusAboveStageCount / @userDetail.TotalStageCount - S++ and Above Stage Count: @userDetail.SPlusPlusAboveStageCount / @userDetail.TotalStageCount - - - - - @foreach (var item in Enum.GetValues()) - { - @item.GetHelpText() - } - + + + + Player Name: @userDetail.PlayerName + Total Score: @userDetail.TotalScore + Average Score: @userDetail.AverageScore + Played Song Count: @userDetail.PlayedSongCount / @userDetail.TotalSongCount + Cleared Stage Count: @userDetail.ClearedStageCount / @userDetail.TotalStageCount + No Miss Stage Count: @userDetail.NoMissStageCount / @userDetail.TotalStageCount + Full Chain Stage Count: @userDetail.FullChainStageCount / @userDetail.TotalStageCount + Perfect Stage Count: @userDetail.PerfectStageCount / @userDetail.TotalStageCount + S and Above Stage Count: @userDetail.SAboveStageCount / @userDetail.TotalStageCount + S+ and Above Stage Count: @userDetail.SPlusAboveStageCount / @userDetail.TotalStageCount + S++ and Above Stage Count: @userDetail.SPlusPlusAboveStageCount / @userDetail.TotalStageCount + + + + + + @foreach (var item in Enum.GetValues()) + { + @item.GetHelpText() + } + - - @foreach (var item in Enum.GetValues()) - { - @item.GetHelpText() - } - + + @foreach (var item in Enum.GetValues()) + { + @item.GetHelpText() + } + + + + + @NavigatorIdToString(playOption.NavigatorId) + + + Change Navigator + + - - - @* - Load more options - *@ - - Only first 50 items are displayed - - - - - - - @* - Load more options - *@ - - Only first 50 items are displayed - - - - - - - @* - Load more options - *@ - - Only first 50 items are displayed - - - + + + @AvatarIdToString(playOption.AvatarId) + + + Change Avatar + + - - @if (isSavingOptions) - { - - Saving... - } - else - { - - Save - } + + + @TitleIdToString(playOption.TitleId) + + + Change Title - - - - - Played Songs - - - - - - @(context.Item.ShowDetails ? "Hide" : "Show") Song Play Details - - - - - - - - - - - - - - - @if (context.ShowDetails) - { - - - - - - Song Play Details - - - - - - Difficulty - Clear State - Play Count - Rating - Score - Max Chain - Last Play Time - - - @SongPlayDetail.Difficulty - - @(SongPlayDetail.Score != 1000000 ? SongPlayDetail.ClearState : ClearState.Perfect) - - @SongPlayDetail.PlayCount - @CalculateRating(SongPlayDetail.Score) - @SongPlayDetail.Score - @SongPlayDetail.MaxChain - @SongPlayDetail.LastPlayTime - - - - - - - } - - - - - - - - } + + + + + + + + + Navigators + + + + + + + + + + + + + + + + Currently selected navigator:
+ @SelectedNavigator +
+ + Close + +
+
+
+
+ + + + + + + + Avatars + + + + + + + + + + + + + + + Currently selected avatar:
+ @SelectedAvatar +
+ + Close + +
+
+
+
+ + + + + + + + Titles + + + + + + + + + + + + + + + + Currently selected title:
+ @SelectedTitle +
+ + Close + +
+
+
+
+ + + @if (isSavingOptions) + { + + Saving... + } + else + { + + Save + } + + +
+ + + + Played Songs + + + + + + @(context.Item.ShowDetails ? "Hide" : "Show") Song Play Details + + + + + + + + + + + + + + + @if (context.ShowDetails) + { + + + + + + Song Play Details + + + + + + Difficulty + Clear State + Play Count + Rating + Score + Max Chain + Last Play Time + + + @SongPlayDetail.Difficulty + + @(SongPlayDetail.Score != 1000000 ? SongPlayDetail.ClearState : ClearState.Perfect) + + @SongPlayDetail.PlayCount + @CalculateRating(SongPlayDetail.Score) + @SongPlayDetail.Score + @SongPlayDetail.MaxChain + @SongPlayDetail.LastPlayTime + + + + + + + } + + + + + + +
} +}
\ No newline at end of file diff --git a/MudAdmin/Pages/User.razor.cs b/MudAdmin/Pages/User.razor.cs index 1d79a1a..3c4179a 100644 --- a/MudAdmin/Pages/User.razor.cs +++ b/MudAdmin/Pages/User.razor.cs @@ -1,6 +1,7 @@ using System.Net.Http.Json; using Microsoft.AspNetCore.Components; using MudBlazor; +using ProtoBuf; using SharedProject.common; using SharedProject.models; @@ -8,7 +9,6 @@ namespace MudAdmin.Pages; public partial class User { - [Inject] public HttpClient Client { get; set; } = null!; @@ -17,27 +17,37 @@ public partial class User [Inject] public ILogger Logger { get; set; } = null!; - - [Parameter] - public long CardId { get; set; } - private PlayOption playOption = new(); - - private UserDetail? userDetail; + private Dictionary avatarDictionary = new(); - private List songPlayDataList = new(); + private bool isSavingOptions; private Dictionary navigatorDictionary = new(); + private bool pageLoading = true; + + private PlayOption playOption = new(); + + private List songPlayDataList = new(); + private Dictionary titleDictionary = new(); - private Dictionary avatarDictionary = new(); + private UserDetail? userDetail; - private bool isSavingOptions; + [Parameter] + public long CardId { get; set; } - private int avatarMaxItems = 50; + private bool IsTitleOverlayVisible { get; set; } - private bool pageLoading = true; + private bool IsNavigatorOverlayVisible { get; set; } + + private bool IsAvatarOverlayVisible { get; set; } + + private Title? SelectedTitle { get; set; } + + private Avatar? SelectedAvatar { get; set; } + + private Navigator? SelectedNavigator { get; set; } protected override async Task OnInitializedAsync() { @@ -51,24 +61,38 @@ protected override async Task OnInitializedAsync() songPlayDataList = userDetail.SongPlayDataList ?? new List(); playOption = userDetail.PlayOption; - var navigators = await Client.GetFromJsonAsync("data/navigator.json"); + var navigatorStream = await Client.GetStreamAsync(SharedConstants.NAVIGATOR_DAT_URI); + var navigators = Serializer.Deserialize(navigatorStream); if (navigators?.NavigatorList != null) { - this.navigatorDictionary = navigators.NavigatorList.ToDictionary(navigator => (long)navigator.Id); + navigatorDictionary = navigators.NavigatorList.ToDictionary(navigator => (long)navigator.Id); } - var avatars = await Client.GetFromJsonAsync("data/avatar.json"); + + var avatarStream = await Client.GetStreamAsync(SharedConstants.AVATAR_DAT_URI); + var avatars = Serializer.Deserialize>(avatarStream); if (avatars != null) { - this.avatarDictionary = avatars.ToDictionary(avatar => (long)avatar.Id); + avatarDictionary = avatars.ToDictionary(avatar => (long)avatar.Id); } - var titles = await Client.GetFromJsonAsync("data/title.json"); + + var titleStream = await Client.GetStreamAsync(SharedConstants.TITLE_DAT_URI); + var titles = Serializer.Deserialize>(titleStream); if (titles != null) { - this.titleDictionary = titles.ToDictionary(title => (long)title.Id); + titleDictionary = titles.ToDictionary(title => (long)title.Id); } + + SetSelected(); pageLoading = false; } + private void SetSelected() + { + SelectedTitle = titleDictionary.GetValueOrDefault(playOption.TitleId); + SelectedAvatar = avatarDictionary.GetValueOrDefault(playOption.AvatarId); + SelectedNavigator = navigatorDictionary.GetValueOrDefault(playOption.NavigatorId); + } + private void OnShowDetailsClick(SongPlayData data) { data.ShowDetails = !data.ShowDetails; @@ -92,7 +116,7 @@ private async Task SaveOptions() private static string CalculateRating(int score) { - var grade = SharedConstants.GRADES.Where(g => g.Score <= score).Select(g => g.Grade).Last(); + var grade = SharedConstants.Grades.Where(g => g.Score <= score).Select(g => g.Grade).Last(); return grade; } @@ -124,25 +148,19 @@ private async Task OnFavoriteToggled(SongPlayData data) private Task> SearchAvatar(string value) { - var result = string.IsNullOrEmpty(value) ? - avatarDictionary.Keys : - avatarDictionary.Where(pair => pair.Value.ToString().Contains(value, StringComparison.InvariantCultureIgnoreCase)).Select(pair => pair.Key); + var result = string.IsNullOrEmpty(value) ? avatarDictionary.Keys : avatarDictionary.Where(pair => pair.Value.ToString().Contains(value, StringComparison.InvariantCultureIgnoreCase)).Select(pair => pair.Key); return Task.FromResult(result); } - + private Task> SearchTitle(string value) { - var result = string.IsNullOrEmpty(value) ? - titleDictionary.Keys : - titleDictionary.Where(pair => pair.Value.ToString().Contains(value, StringComparison.InvariantCultureIgnoreCase)).Select(pair => pair.Key); + var result = string.IsNullOrEmpty(value) ? titleDictionary.Keys : titleDictionary.Where(pair => pair.Value.ToString().Contains(value, StringComparison.InvariantCultureIgnoreCase)).Select(pair => pair.Key); return Task.FromResult(result); } - + private Task> SearchNavigator(string value) { - var result = string.IsNullOrEmpty(value) ? - navigatorDictionary.Keys : - navigatorDictionary.Where(pair => pair.Value.ToString().Contains(value, StringComparison.InvariantCultureIgnoreCase)).Select(pair => pair.Key); + var result = string.IsNullOrEmpty(value) ? navigatorDictionary.Keys : navigatorDictionary.Where(pair => pair.Value.ToString().Contains(value, StringComparison.InvariantCultureIgnoreCase)).Select(pair => pair.Key); return Task.FromResult(result); } @@ -150,14 +168,61 @@ private string AvatarIdToString(long id) { return avatarDictionary.ContainsKey(id) ? avatarDictionary[id].ToString() : $"No Data for {id}!"; } - + private string NavigatorIdToString(long id) { return navigatorDictionary.ContainsKey(id) ? navigatorDictionary[id].ToString() : $"No Data for {id}!"; } - + private string TitleIdToString(long id) { return titleDictionary.ContainsKey(id) ? titleDictionary[id].ToString() : $"No Data for {id}!"; } + + private void OnChangeTitleButtonClick() + { + IsTitleOverlayVisible = true; + } + + private void OnChangeNavigatorButtonClick() + { + IsNavigatorOverlayVisible = true; + } + + private void OnChangeAvatarButtonClick() + { + IsAvatarOverlayVisible = true; + } + + private void OnTitleOverlayClosed() + { + IsTitleOverlayVisible = false; + if (SelectedTitle != null) + { + playOption.TitleId = SelectedTitle.Id; + } + } + + private void OnNavigatorOverlayClosed() + { + IsNavigatorOverlayVisible = false; + if (SelectedNavigator != null) + { + playOption.NavigatorId = SelectedNavigator.Id; + } + } + + private void OnAvatarOverlayClosed() + { + IsAvatarOverlayVisible = false; + if (SelectedAvatar != null) + { + playOption.AvatarId = SelectedAvatar.Id; + } + } + + private static object NameEntrySortByFunc(Navigator navigator) + { + return navigator.NameEntry1?.ToString().ToLowerInvariant() ?? string.Empty; + } } \ No newline at end of file diff --git a/MudAdmin/Pages/Users.razor b/MudAdmin/Pages/Users.razor index e760d28..e2c0c8c 100644 --- a/MudAdmin/Pages/Users.razor +++ b/MudAdmin/Pages/Users.razor @@ -2,6 +2,8 @@ @using models = SharedProject.models @inject NavigationManager NavigationManager @inject HttpClient Client +@inject IDialogService DialogService +@inject ILogger Logger Users @@ -41,13 +43,17 @@ @user.PlayerName + + + Card ID @user.CardId - Check detail + Check detail @@ -70,9 +76,23 @@ users = await Client.GetFromJsonAsync>("api/Users") ?? new List(); } - private void OnClick(models.User user) + private void OnCheckDetailClick(models.User user) { NavigationManager.NavigateTo($"user/{user.CardId}"); } + private async Task OnEditPlayerNameClicked(models.User user) + { + var options = new DialogOptions + { + CloseOnEscapeKey = false, + DisableBackdropClick = true, + FullWidth = true + }; + var parameters = new DialogParameters(); + parameters.Add("Data", user); + var dialog = DialogService.Show("Favorite", parameters, options); + var result = await dialog.Result; + } + } \ No newline at end of file diff --git a/MudAdmin/Shared/MainLayout.razor b/MudAdmin/Shared/MainLayout.razor index 582b66d..84031d2 100644 --- a/MudAdmin/Shared/MainLayout.razor +++ b/MudAdmin/Shared/MainLayout.razor @@ -5,7 +5,7 @@ - + diff --git a/SharedProject/SharedProject.csproj b/SharedProject/SharedProject.csproj index 52b24a0..df65cef 100644 --- a/SharedProject/SharedProject.csproj +++ b/SharedProject/SharedProject.csproj @@ -7,4 +7,8 @@ SharedProject + + + + diff --git a/SharedProject/common/SharedConstants.cs b/SharedProject/common/SharedConstants.cs index e960722..2daf768 100644 --- a/SharedProject/common/SharedConstants.cs +++ b/SharedProject/common/SharedConstants.cs @@ -20,7 +20,15 @@ public static class SharedConstants public const int S_PLUS_PLUS_SCORE_THRESHOLD = 990000; - public static readonly ScoreGradeMap[] GRADES = + public const int MAX_PLAYER_NAME_LENGTH = 8; + + public const string NAVIGATOR_DAT_URI = "data/navigator.dat"; + + public const string AVATAR_DAT_URI = "data/avatar.dat"; + + public const string TITLE_DAT_URI = "data/title.dat"; + + public static readonly ScoreGradeMap[] Grades = { new(E_SCORE_THRESHOLD, "E"), new(D_SCORE_THRESHOLD, "D"), diff --git a/SharedProject/enums/NavigatorDefaultAvailability.cs b/SharedProject/enums/NavigatorDefaultAvailability.cs index 1ce455b..eb844cc 100644 --- a/SharedProject/enums/NavigatorDefaultAvailability.cs +++ b/SharedProject/enums/NavigatorDefaultAvailability.cs @@ -1,5 +1,8 @@ -namespace SharedProject.enums; +using ProtoBuf; +namespace SharedProject.enums; + +[ProtoContract] public enum NavigatorDefaultAvailability { NotAvailable = 0, diff --git a/SharedProject/enums/NavigatorGenre.cs b/SharedProject/enums/NavigatorGenre.cs index 194fb11..031a430 100644 --- a/SharedProject/enums/NavigatorGenre.cs +++ b/SharedProject/enums/NavigatorGenre.cs @@ -1,5 +1,8 @@ -namespace SharedProject.enums; +using ProtoBuf; +namespace SharedProject.enums; + +[ProtoContract] public enum NavigatorGenre { Default = 1, diff --git a/SharedProject/enums/TitleUnlockType.cs b/SharedProject/enums/TitleUnlockType.cs index a82d2fa..f964625 100644 --- a/SharedProject/enums/TitleUnlockType.cs +++ b/SharedProject/enums/TitleUnlockType.cs @@ -1,5 +1,8 @@ -namespace SharedProject.enums; +using ProtoBuf; +namespace SharedProject.enums; + +[ProtoContract] public enum TitleUnlockType { Invalid = 0, diff --git a/SharedProject/models/Avatar.cs b/SharedProject/models/Avatar.cs index 1cc9a52..ed34391 100644 --- a/SharedProject/models/Avatar.cs +++ b/SharedProject/models/Avatar.cs @@ -1,15 +1,32 @@ -namespace SharedProject.models; +using ProtoBuf; +namespace SharedProject.models; + +[ProtoContract] public class Avatar { + [ProtoMember(1)] public uint Id { get; set; } + + [ProtoMember(2)] public string? IdString { get; set; } + + [ProtoMember(3)] public string? FullName { get; set; } + + [ProtoMember(4)] public string? Name { get; set; } + + [ProtoMember(5)] public string? Variant { get; set; } - public string? AcquireMethod { get; set; } + + [ProtoMember(6)] + public string? AcquireMethodJp { get; set; } + + [ProtoMember(7)] + public string? AcquireMethodEn { get; set; } public override string ToString() { - return $"{Id}: {FullName}, {AcquireMethod}"; + return $"{Id}: {FullName}, {AcquireMethodEn}"; } } \ No newline at end of file diff --git a/SharedProject/models/NameEntry.cs b/SharedProject/models/NameEntry.cs index 0252a50..30ecfb9 100644 --- a/SharedProject/models/NameEntry.cs +++ b/SharedProject/models/NameEntry.cs @@ -1,12 +1,20 @@ -namespace SharedProject.models; +using ProtoBuf; +namespace SharedProject.models; + +[ProtoContract] public class NameEntry { + [ProtoMember(1)] public string? NameWithVariant { get; set; } + [ProtoMember(2)] public string? NameWithoutVariant{ get; set; } + [ProtoMember(3)] public string? Variant{ get; set; } + [ProtoMember(4)] public string? IllustrationCredit{ get; set; } - public override string ToString() { - return $"{NameWithVariant}"; + public override string ToString() + { + return $"{NameWithVariant}, {IllustrationCredit}"; } } \ No newline at end of file diff --git a/SharedProject/models/Navigator.cs b/SharedProject/models/Navigator.cs index 23f2f6d..ede9246 100644 --- a/SharedProject/models/Navigator.cs +++ b/SharedProject/models/Navigator.cs @@ -1,25 +1,40 @@ -using SharedProject.enums; +using ProtoBuf; +using SharedProject.enums; namespace SharedProject.models; +[ProtoContract] public class Navigator { + [ProtoMember(1)] public uint Id { get; set; } + [ProtoMember(2)] public string? IdString { get; set; } + [ProtoMember(3)] public string? FileName { get; set; } + [ProtoMember(4)] public NameEntry? NameEntry0 { get; set; } + + [ProtoMember(5)] public NameEntry? NameEntry1 { get; set; } + [ProtoMember(6)] public NavigatorGenre Genre { get; set; } + [ProtoMember(7)] public NavigatorDefaultAvailability DefaultAvailability { get; set; } + [ProtoMember(8)] public string? ToolTipJp { get; set; } + + [ProtoMember(9)] public string? ToolTipEn { get; set; } public override string ToString() { - return $"{Id}: {NameEntry1}, {ToolTipEn}"; + return $"{Id}: {NameEntry1?.NameWithVariant}, {NameEntry1?.IllustrationCredit}"; } + + } \ No newline at end of file diff --git a/SharedProject/models/Navigators.cs b/SharedProject/models/Navigators.cs index 90f8de3..ee47560 100644 --- a/SharedProject/models/Navigators.cs +++ b/SharedProject/models/Navigators.cs @@ -1,8 +1,13 @@ -namespace SharedProject.models; +using ProtoBuf; +namespace SharedProject.models; + +[ProtoContract] public class Navigators { + [ProtoMember(1)] public int Count { get; set; } + [ProtoMember(2)] public List? NavigatorList { get; set; } } \ No newline at end of file diff --git a/SharedProject/models/Title.cs b/SharedProject/models/Title.cs index 72005fd..9f4a6df 100644 --- a/SharedProject/models/Title.cs +++ b/SharedProject/models/Title.cs @@ -1,15 +1,30 @@ -using SharedProject.enums; +using ProtoBuf; +using SharedProject.enums; namespace SharedProject.models; +[ProtoContract] public class Title { + [ProtoMember(1)] public uint Id { get; set; } + + [ProtoMember(2)] public string? IdString { get; set; } + + [ProtoMember(3)] public string? NameJp { get; set; } + + [ProtoMember(4)] public string? NameEng { get; set; } + + [ProtoMember(5)] public string? UnlockRequirementJp { get; set; } + + [ProtoMember(6)] public string? UnlockRequirementEng { get; set; } + + [ProtoMember(7)] public TitleUnlockType Type { get; set; } public override string ToString() { return $"{Id}: {NameEng}, {UnlockRequirementEng}"; diff --git a/SharedProject/models/User.cs b/SharedProject/models/User.cs index 7b7ded7..1aee2e6 100644 --- a/SharedProject/models/User.cs +++ b/SharedProject/models/User.cs @@ -1,10 +1,14 @@ -namespace SharedProject.models; +using System.Text.Json.Serialization; + +namespace SharedProject.models; public class User { // ReSharper disable once UnusedAutoPropertyAccessor.Global + [JsonPropertyName(nameof(CardId))] public long CardId { get; set; } // ReSharper disable once AutoPropertyCanBeMadeGetOnly.Global + [JsonPropertyName(nameof(PlayerName))] public string PlayerName { get; set; } = string.Empty; } \ No newline at end of file