1
0
mirror of synced 2024-11-23 22:41:01 +01:00

Add DifficultySettingArray handle and WebUI

This commit is contained in:
esuo1198 2023-09-18 18:54:02 +09:00
parent 05cdeb0dec
commit 4fedead174
6 changed files with 328 additions and 253 deletions

View File

@ -7,17 +7,23 @@ public class UserSetting
public uint ToneId { get; set; } public uint ToneId { get; set; }
public bool IsDisplayAchievement { get; set; } public bool IsDisplayAchievement { get; set; }
public bool IsDisplayDanOnNamePlate { get; set; } public bool IsDisplayDanOnNamePlate { get; set; }
public uint DifficultySettingCourse { get; set; }
public uint DifficultySettingStar { get; set; }
public uint DifficultySettingSort { get; set; }
public bool IsVoiceOn { get; set; } public bool IsVoiceOn { get; set; }
public bool IsSkipOn { get; set; } public bool IsSkipOn { get; set; }
public Difficulty AchievementDisplayDifficulty { get; set; } public Difficulty AchievementDisplayDifficulty { get; set; }
public PlaySetting PlaySetting { get; set; } = new(); public PlaySetting PlaySetting { get; set; } = new();
public int NotesPosition { get; set; } public int NotesPosition { get; set; }
public string MyDonName { get; set; } = string.Empty; public string MyDonName { get; set; } = string.Empty;
@ -27,29 +33,29 @@ public class UserSetting
public uint TitlePlateId { get; set; } public uint TitlePlateId { get; set; }
public uint Kigurumi { get; set; } public uint Kigurumi { get; set; }
public uint Head { get; set; } public uint Head { get; set; }
public uint Body { get; set; } public uint Body { get; set; }
public uint Face { get; set; } public uint Face { get; set; }
public uint Puchi { get; set; } public uint Puchi { get; set; }
public List<uint> UnlockedKigurumi { get; set; } = new(); public List<uint> UnlockedKigurumi { get; set; } = new();
public List<uint> UnlockedHead { get; set; } = new(); public List<uint> UnlockedHead { get; set; } = new();
public List<uint> UnlockedBody { get; set; } = new(); public List<uint> UnlockedBody { get; set; } = new();
public List<uint> UnlockedFace { get; set; } = new(); public List<uint> UnlockedFace { get; set; } = new();
public List<uint> UnlockedPuchi { get; set; } = new(); public List<uint> UnlockedPuchi { get; set; } = new();
public uint FaceColor { get; set; } public uint FaceColor { get; set; }
public uint BodyColor { get; set; } public uint BodyColor { get; set; }
public uint LimbColor { get; set; } public uint LimbColor { get; set; }
} }

View File

@ -1,10 +1,33 @@
using System.Text.Json; using GameDatabase.Entities;
using GameDatabase.Entities; using System.Text.Json;
namespace TaikoLocalServer.Common.Utils; namespace TaikoLocalServer.Common.Utils;
public static class JsonHelper public static class JsonHelper
{ {
public static uint[] GetUIntArrayFromJson(string data, int length, ILogger logger, string fieldName)
{
var array = new uint[length];
try
{
array = JsonSerializer.Deserialize<uint[]>(data);
}
catch (JsonException e)
{
logger.LogError(e, "Parsing {FieldName} json data failed", fieldName);
}
if (array != null && array.Length >= length)
{
return array;
}
logger.LogWarning($"{fieldName} is null or length less than {length}!");
array = new uint[length];
return array;
}
public static List<uint> GetCostumeDataFromUserData(UserDatum userData, ILogger logger) public static List<uint> GetCostumeDataFromUserData(UserDatum userData, ILogger logger)
{ {
var costumeData = new List<uint> { 0, 0, 0, 0, 0 }; var costumeData = new List<uint> { 0, 0, 0, 0, 0 };
@ -22,13 +45,13 @@ public static class JsonHelper
{ {
return costumeData; return costumeData;
} }
logger.LogWarning("Costume data is null or count less than 5!"); logger.LogWarning("Costume data is null or count less than 5!");
costumeData = new List<uint> { 0, 0, 0, 0, 0 }; costumeData = new List<uint> { 0, 0, 0, 0, 0 };
return costumeData; return costumeData;
} }
public static List<List<uint>> GetCostumeUnlockDataFromUserData(UserDatum userData, ILogger logger) public static List<List<uint>> GetCostumeUnlockDataFromUserData(UserDatum userData, ILogger logger)
{ {
var costumeUnlockData = new List<List<uint>> { new(), new(), new(), new(), new() }; var costumeUnlockData = new List<List<uint>> { new(), new(), new(), new(), new() };
@ -45,7 +68,7 @@ public static class JsonHelper
{ {
return costumeUnlockData; return costumeUnlockData;
} }
logger.LogWarning("Costume unlock data is null or count less than 5!"); logger.LogWarning("Costume unlock data is null or count less than 5!");
costumeUnlockData = new List<List<uint>> { new(), new(), new(), new(), new() }; costumeUnlockData = new List<List<uint>> { new(), new(), new(), new(), new() };

View File

@ -1,6 +1,6 @@
using System.Text.Json; using SharedProject.Models;
using SharedProject.Models;
using SharedProject.Utils; using SharedProject.Utils;
using System.Text.Json;
namespace TaikoLocalServer.Controllers.Api; namespace TaikoLocalServer.Controllers.Api;
@ -25,6 +25,8 @@ public class UserSettingsController : BaseController<UserSettingsController>
return NotFound(); return NotFound();
} }
var difficultySettingArray = JsonHelper.GetUIntArrayFromJson(user.DifficultySettingArray, 3, Logger, nameof(user.DifficultySettingArray));
var costumeData = JsonHelper.GetCostumeDataFromUserData(user, Logger); var costumeData = JsonHelper.GetCostumeDataFromUserData(user, Logger);
var costumeUnlockData = JsonHelper.GetCostumeUnlockDataFromUserData(user, Logger); var costumeUnlockData = JsonHelper.GetCostumeUnlockDataFromUserData(user, Logger);
@ -34,6 +36,9 @@ public class UserSettingsController : BaseController<UserSettingsController>
AchievementDisplayDifficulty = user.AchievementDisplayDifficulty, AchievementDisplayDifficulty = user.AchievementDisplayDifficulty,
IsDisplayAchievement = user.DisplayAchievement, IsDisplayAchievement = user.DisplayAchievement,
IsDisplayDanOnNamePlate = user.DisplayDan, IsDisplayDanOnNamePlate = user.DisplayDan,
DifficultySettingCourse = difficultySettingArray[0],
DifficultySettingStar = difficultySettingArray[1],
DifficultySettingSort = difficultySettingArray[2],
IsVoiceOn = user.IsVoiceOn, IsVoiceOn = user.IsVoiceOn,
IsSkipOn = user.IsSkipOn, IsSkipOn = user.IsSkipOn,
NotesPosition = user.NotesPosition, NotesPosition = user.NotesPosition,
@ -48,9 +53,9 @@ public class UserSettingsController : BaseController<UserSettingsController>
Face = costumeData[3], Face = costumeData[3],
Puchi = costumeData[4], Puchi = costumeData[4],
UnlockedKigurumi = costumeUnlockData[0], UnlockedKigurumi = costumeUnlockData[0],
UnlockedHead = costumeUnlockData[1], UnlockedHead = costumeUnlockData[1],
UnlockedBody = costumeUnlockData[2], UnlockedBody = costumeUnlockData[2],
UnlockedFace = costumeUnlockData[3], UnlockedFace = costumeUnlockData[3],
UnlockedPuchi = costumeUnlockData[4], UnlockedPuchi = costumeUnlockData[4],
BodyColor = user.ColorBody, BodyColor = user.ColorBody,
FaceColor = user.ColorFace, FaceColor = user.ColorFace,
@ -77,11 +82,19 @@ public class UserSettingsController : BaseController<UserSettingsController>
userSetting.Face, userSetting.Face,
userSetting.Puchi, userSetting.Puchi,
}; };
var difficultySettings = new List<uint>
{
userSetting.DifficultySettingCourse,
userSetting.DifficultySettingStar,
userSetting.DifficultySettingSort
};
user.IsSkipOn = userSetting.IsSkipOn; user.IsSkipOn = userSetting.IsSkipOn;
user.IsVoiceOn = userSetting.IsVoiceOn; user.IsVoiceOn = userSetting.IsVoiceOn;
user.DisplayAchievement = userSetting.IsDisplayAchievement; user.DisplayAchievement = userSetting.IsDisplayAchievement;
user.DisplayDan = userSetting.IsDisplayDanOnNamePlate; user.DisplayDan = userSetting.IsDisplayDanOnNamePlate;
user.DifficultySettingArray = JsonSerializer.Serialize(difficultySettings);
user.NotesPosition = userSetting.NotesPosition; user.NotesPosition = userSetting.NotesPosition;
user.SelectedToneId = userSetting.ToneId; user.SelectedToneId = userSetting.ToneId;
user.AchievementDisplayDifficulty = userSetting.AchievementDisplayDifficulty; user.AchievementDisplayDifficulty = userSetting.AchievementDisplayDifficulty;
@ -93,7 +106,6 @@ public class UserSettingsController : BaseController<UserSettingsController>
user.ColorFace = userSetting.FaceColor; user.ColorFace = userSetting.FaceColor;
user.ColorLimb = userSetting.LimbColor; user.ColorLimb = userSetting.LimbColor;
user.CostumeData = JsonSerializer.Serialize(costumes); user.CostumeData = JsonSerializer.Serialize(costumes);
await userDatumService.UpdateUserDatum(user); await userDatumService.UpdateUserDatum(user);

View File

@ -1,6 +1,6 @@
using System.Buffers.Binary; using Microsoft.Extensions.Options;
using System.Buffers.Binary;
using System.Text.Json; using System.Text.Json;
using Microsoft.Extensions.Options;
using TaikoLocalServer.Settings; using TaikoLocalServer.Settings;
using Throw; using Throw;
@ -17,8 +17,8 @@ public class UserDataController : BaseController<UserDataController>
private readonly IGameDataService gameDataService; private readonly IGameDataService gameDataService;
private readonly ServerSettings settings; private readonly ServerSettings settings;
public UserDataController(IUserDatumService userDatumService, ISongPlayDatumService songPlayDatumService, public UserDataController(IUserDatumService userDatumService, ISongPlayDatumService songPlayDatumService,
IGameDataService gameDataService, IOptions<ServerSettings> settings) IGameDataService gameDataService, IOptions<ServerSettings> settings)
{ {
this.userDatumService = userDatumService; this.userDatumService = userDatumService;
@ -80,7 +80,7 @@ public class UserDataController : BaseController<UserDataController>
.ThenByDescending(datum => datum.SongNumber) .ThenByDescending(datum => datum.SongNumber)
.Select(datum => datum.SongId) .Select(datum => datum.SongId)
.ToArray(); .ToArray();
// Use custom implementation as distinctby cannot guarantee preserved element // Use custom implementation as distinctby cannot guarantee preserved element
var recentSet = new OrderedSet<uint>(); var recentSet = new OrderedSet<uint>();
foreach (var id in recentSongs) foreach (var id in recentSongs)
@ -111,26 +111,17 @@ public class UserDataController : BaseController<UserDataController>
var defaultOptions = new byte[2]; var defaultOptions = new byte[2];
BinaryPrimitives.WriteInt16LittleEndian(defaultOptions, userData.OptionSetting); BinaryPrimitives.WriteInt16LittleEndian(defaultOptions, userData.OptionSetting);
var difficultyPlayedArray = Array.Empty<uint>(); var difficultySettingArray = JsonHelper.GetUIntArrayFromJson(userData.DifficultySettingArray, 3, Logger, nameof(userData.DifficultySettingArray));
try for (int i = 0; i < 3; i++)
{ {
difficultyPlayedArray = JsonSerializer.Deserialize<uint[]>(userData.DifficultyPlayedArray); if (difficultySettingArray[i] >= 2)
} {
catch (JsonException e) difficultySettingArray[i] -= 1;
{ }
Logger.LogError(e, "Parsing difficulty played json data failed");
}
var difficultySettingArray = Array.Empty<uint>();
try
{
difficultySettingArray = JsonSerializer.Deserialize<uint[]>(userData.DifficultySettingArray);
}
catch (JsonException e)
{
Logger.LogError(e, "Parsing difficulty setting json data failed");
} }
var difficultyPlayedArray = JsonHelper.GetUIntArrayFromJson(userData.DifficultyPlayedArray, 3, Logger, nameof(userData.DifficultyPlayedArray));
var response = new UserDataResponse var response = new UserDataResponse
{ {
Result = 1, Result = 1,
@ -144,24 +135,16 @@ public class UserDataController : BaseController<UserDataController>
NotesPosition = userData.NotesPosition, NotesPosition = userData.NotesPosition,
IsVoiceOn = userData.IsVoiceOn, IsVoiceOn = userData.IsVoiceOn,
IsSkipOn = userData.IsSkipOn, IsSkipOn = userData.IsSkipOn,
DifficultySettingCourse = difficultySettingArray[0],
DifficultySettingStar = difficultySettingArray[1],
DifficultySettingSort = difficultySettingArray[2],
DifficultyPlayedCourse = difficultyPlayedArray[0],
DifficultyPlayedStar = difficultyPlayedArray[1],
DifficultyPlayedSort = difficultyPlayedArray[2],
IsChallengecompe = false, IsChallengecompe = false,
SongRecentCnt = (uint)recentSongs.Length SongRecentCnt = (uint)recentSongs.Length
}; };
if (difficultyPlayedArray is { Length: >= 3 })
{
response.DifficultyPlayedCourse = difficultyPlayedArray[0];
response.DifficultyPlayedStar = difficultyPlayedArray[1];
response.DifficultyPlayedSort = difficultyPlayedArray[2];
}
if (difficultySettingArray is { Length: >= 3 })
{
response.DifficultySettingCourse = difficultySettingArray[0];
response.DifficultySettingStar = difficultySettingArray[1];
response.DifficultySettingSort = difficultySettingArray[2];
}
return Ok(response); return Ok(response);
} }
} }

View File

@ -11,204 +11,237 @@
@if (response is not null) @if (response is not null)
{ {
<MudGrid Class="my-4 pb-10"> <MudGrid Class="my-4 pb-10">
<MudItem xs="12" md="8"> <MudItem xs="12" md="8">
<MudPaper Elevation="0" Outlined="true"> <MudPaper Elevation="0" Outlined="true">
<MudTabs Rounded="true" Border="true" PanelClass="pa-8"> <MudTabs Rounded="true" Border="true" PanelClass="pa-8">
<MudTabPanel Text="Profile"> <MudTabPanel Text="Profile">
<MudStack Spacing="4"> <MudStack Spacing="4">
<h2>Profile Options</h2> <h2>Profile Options</h2>
<MudTextField @bind-Value="@response.MyDonName" Label="Name"></MudTextField> <MudTextField @bind-Value="@response.MyDonName" Label="Name"></MudTextField>
<MudGrid> <MudGrid>
<MudItem xs="12" md="8"> <MudItem xs="12" md="8">
<MudTextField @bind-Value="@response.Title" Label="Title"/> <MudTextField @bind-Value="@response.Title" Label="Title" />
<MudButton Color="Color.Primary" Class="mt-1" Size="Size.Small" OnClick="@((e)=>OpenChooseTitleDialog())"> <MudButton Color="Color.Primary" Class="mt-1" Size="Size.Small" OnClick="@((e)=>OpenChooseTitleDialog())">
Select a Title Select a Title
</MudButton> </MudButton>
</MudItem> </MudItem>
<MudItem xs="12" md="4"> <MudItem xs="12" md="4">
<MudSelect @bind-Value="@response.TitlePlateId" Label="Title Plate"> <MudSelect @bind-Value="@response.TitlePlateId" Label="Title Plate">
@for (uint i = 0; i < 8; i++) @for (uint i = 0; i < 8; i++)
{
var index = i;
<MudSelectItem Value="@i">@TitlePlateStrings[index]</MudSelectItem>
}
</MudSelect>
</MudItem>
</MudGrid>
<MudSelect @bind-Value="@response.AchievementDisplayDifficulty"
Label="Achievement Panel Difficulty">
@foreach (var item in Enum.GetValues<Difficulty>())
{
<MudSelectItem Value="@item"/>
}
</MudSelect>
<MudSwitch @bind-Checked="@response.IsDisplayAchievement" Label="Display Achievement Panel" Color="Color.Primary"/>
<MudSwitch @bind-Checked="@response.IsDisplayDanOnNamePlate" Label="Display Dan Rank on Name Plate" Color="Color.Primary"/>
</MudStack>
</MudTabPanel>
<MudTabPanel Text="Costume">
<MudStack Spacing="4">
<h2>Costume Options</h2>
<MudGrid>
<MudItem xs="12">
<MudStack Spacing="4" Class="mb-8">
<MudSelect @bind-Value="@response.Head" Label="Head">
@for (var i = 0; i < Constants.COSTUME_HEAD_MAX; i++)
{
var index = (uint)i;
var costumeTitle = GameDataService.GetHeadTitle(index);
<MudSelectItem Value="@index">@index - @costumeTitle</MudSelectItem>
}
</MudSelect>
<MudSelect @bind-Value="@response.Body" Label="Body">
@for (var i = 0; i < Constants.COSTUME_BODY_MAX; i++)
{
var index = (uint)i;
var costumeTitle = GameDataService.GetBodyTitle(index);
<MudSelectItem Value="@index">@index - @costumeTitle</MudSelectItem>
}
</MudSelect>
<MudSelect @bind-Value="@response.Face" Label="Face">
@for (var i = 0; i < Constants.COSTUME_FACE_MAX; i++)
{
var index = (uint)i;
var costumeTitle = GameDataService.GetFaceTitle(index);
<MudSelectItem Value="@index">@index - @costumeTitle</MudSelectItem>
}
</MudSelect>
<MudSelect @bind-Value="@response.Kigurumi" Label="Kigurumi">
@for (var i = 0; i < Constants.COSTUME_KIGURUMI_MAX; i++)
{
var index = (uint)i;
var costumeTitle = GameDataService.GetKigurumiTitle(index);
<MudSelectItem Value="@index">@index - @costumeTitle</MudSelectItem>
}
</MudSelect>
<MudSelect @bind-Value="@response.Puchi" Label="Puchi">
@for (var i = 0; i < Constants.COSTUME_PUCHI_MAX; i++)
{
var index = (uint)i;
var costumeTitle = GameDataService.GetPuchiTitle(index);
<MudSelectItem Value="@index">@index - @costumeTitle</MudSelectItem>
}
</MudSelect>
</MudStack>
<MudStack Row="true">
<MudSelect @bind-Value="@response.BodyColor" Label="Body Color">
@for (uint i = 0; i < Constants.COSTUME_COLOR_MAX; i++)
{ {
var index = i; var index = i;
<MudSelectItem Value="@index"> <MudSelectItem Value="@i">@TitlePlateStrings[index]</MudSelectItem>
<div class="color-box" style=@($"background: {CostumeColors[index]}")></div>
@index
</MudSelectItem>
} }
</MudSelect> </MudSelect>
<MudSelect @bind-Value="@response.FaceColor" Label="Face Color"> </MudItem>
@for (uint i = 0; i < Constants.COSTUME_COLOR_MAX; i++) </MudGrid>
{
var index = i;
<MudSelectItem Value="@index">
<div class="color-box" style=@($"background: {CostumeColors[index]}")></div>
@index
</MudSelectItem>
}
</MudSelect>
<MudSelect @bind-Value="@response.LimbColor" Label="Limb Color">
@for (uint i = 0; i < Constants.COSTUME_COLOR_MAX; i++)
{
var index = i;
<MudSelectItem Value="@index">
<div class="color-box" style=@($"background: {CostumeColors[index]}")></div>
@index
</MudSelectItem>
}
</MudSelect>
</MudStack>
</MudItem>
</MudGrid>
</MudStack>
</MudTabPanel>
<MudTabPanel Text="Song Options"> <MudSelect @bind-Value="@response.AchievementDisplayDifficulty"
<MudStack Spacing="4"> Label="Achievement Panel Difficulty">
<h2>Song Options</h2> @foreach (var item in Enum.GetValues<Difficulty>())
<MudGrid> {
<MudItem xs="12" md="4"> <MudSelectItem Value="@item" />
<MudStack Spacing="4"> }
<MudSwitch @bind-Checked="@response.PlaySetting.IsVanishOn" Label="Vanish" Color="Color.Primary"/> </MudSelect>
<MudSwitch @bind-Checked="@response.PlaySetting.IsInverseOn" Label="Inverse" Color="Color.Primary"/>
<MudSwitch @bind-Checked="@response.IsSkipOn" Label="Give Up" Color="Color.Primary"/>
<MudSwitch @bind-Checked="@response.IsVoiceOn" Label="Voice" Color="Color.Primary"/>
</MudStack>
</MudItem>
<MudItem xs="12" md="8">
<MudStack Spacing="4">
<MudSelect @bind-Value="@response.PlaySetting.Speed" Label="Speed">
@for (uint i = 0; i < 15; i++)
{
var index = i;
<MudSelectItem Value="@i">@SpeedStrings[index]</MudSelectItem>
}
</MudSelect>
<MudSelect @bind-Value="@response.PlaySetting.RandomType" <MudGrid>
Label="Random"> <MudItem xs="12" md="4">
@foreach (var item in Enum.GetValues<RandomType>()) <MudStack Spacing="4">
{ <MudSwitch @bind-Checked="@response.IsDisplayAchievement" Label="Display Achievement Panel" Color="Color.Primary" />
<MudSelectItem Value="@item"/> <MudSwitch @bind-Checked="@response.IsDisplayDanOnNamePlate" Label="Display Dan Rank on Name Plate" Color="Color.Primary" />
} </MudStack>
</MudSelect> </MudItem>
<MudItem xs="12" md="8">
<MudStack Spacing="4">
<MudSelect @bind-Value="@response.DifficultySettingCourse" Label="Difficulty Setting Course">
@for (uint i = 0; i < DifficultySettingCourseStrings.Length; i++)
{
var index = i;
<MudSelectItem Value="@i">@DifficultySettingCourseStrings[index]</MudSelectItem>
}
</MudSelect>
<MudSelect @bind-Value="@response.ToneId" Label="Tone"> <MudSelect @bind-Value="@response.DifficultySettingStar" Label="Difficulty Setting Star">
@for (uint i = 0; i < 19; i++) @for (uint i = 0; i < DifficultySettingStarStrings.Length; i++)
{ {
var index = i; var index = i;
<MudSelectItem Value="@i">@ToneStrings[index]</MudSelectItem> <MudSelectItem Value="@i">@DifficultySettingStarStrings[index]</MudSelectItem>
} }
</MudSelect> </MudSelect>
<MudSlider Class="mb-8" @bind-Value="@response.NotesPosition" Size="Size.Medium" Min="-5" Max="5" Step="1" TickMarks="true" TickMarkLabels="@NotePositionStrings"> <MudSelect @bind-Value="@response.DifficultySettingSort" Label="Difficulty Setting Sort">
<MudText Typo="Typo.caption">Notes Position</MudText> @for (uint i = 0; i < DifficultySettingSortStrings.Length; i++)
</MudSlider> {
</MudStack> var index = i;
</MudItem> <MudSelectItem Value="@i">@DifficultySettingSortStrings[index]</MudSelectItem>
</MudGrid> }
</MudStack> </MudSelect>
</MudTabPanel> </MudStack>
</MudTabs> </MudItem>
</MudPaper> </MudGrid>
</MudItem> </MudStack>
</MudTabPanel>
<MudItem md="4" xs="12" Class="py-4 px-8"> <MudTabPanel Text="Costume">
<MudStack Style="top:100px" Class="sticky"> <MudStack Spacing="4">
<MudButton Disabled="@isSavingOptions" <h2>Costume Options</h2>
OnClick="SaveOptions" <MudGrid>
Variant="Variant.Filled" <MudItem xs="12">
Color="Color.Primary"> <MudStack Spacing="4" Class="mb-8">
@if (isSavingOptions) <MudSelect @bind-Value="@response.Head" Label="Head">
{ @for (var i = 0; i < Constants.COSTUME_HEAD_MAX; i++)
<MudProgressCircular Class="ms-n1" Size="Size.Small" Indeterminate="true"/> {
<MudText Class="ms-2">Saving...</MudText> var index = (uint)i;
} var costumeTitle = GameDataService.GetHeadTitle(index);
else <MudSelectItem Value="@index">@index - @costumeTitle</MudSelectItem>
{ }
<MudIcon Icon="@Icons.Filled.Save" Class="mx-2"></MudIcon> </MudSelect>
<MudText>Save</MudText>
}
</MudButton>
</MudStack>
</MudItem> <MudSelect @bind-Value="@response.Body" Label="Body">
@for (var i = 0; i < Constants.COSTUME_BODY_MAX; i++)
{
var index = (uint)i;
var costumeTitle = GameDataService.GetBodyTitle(index);
<MudSelectItem Value="@index">@index - @costumeTitle</MudSelectItem>
}
</MudSelect>
<MudSelect @bind-Value="@response.Face" Label="Face">
@for (var i = 0; i < Constants.COSTUME_FACE_MAX; i++)
{
var index = (uint)i;
var costumeTitle = GameDataService.GetFaceTitle(index);
<MudSelectItem Value="@index">@index - @costumeTitle</MudSelectItem>
}
</MudSelect>
<MudSelect @bind-Value="@response.Kigurumi" Label="Kigurumi">
@for (var i = 0; i < Constants.COSTUME_KIGURUMI_MAX; i++)
{
var index = (uint)i;
var costumeTitle = GameDataService.GetKigurumiTitle(index);
<MudSelectItem Value="@index">@index - @costumeTitle</MudSelectItem>
}
</MudSelect>
<MudSelect @bind-Value="@response.Puchi" Label="Puchi">
@for (var i = 0; i < Constants.COSTUME_PUCHI_MAX; i++)
{
var index = (uint)i;
var costumeTitle = GameDataService.GetPuchiTitle(index);
<MudSelectItem Value="@index">@index - @costumeTitle</MudSelectItem>
}
</MudSelect>
</MudStack>
<MudStack Row="true">
<MudSelect @bind-Value="@response.BodyColor" Label="Body Color">
@for (uint i = 0; i < Constants.COSTUME_COLOR_MAX; i++)
{
var index = i;
<MudSelectItem Value="@index">
<div class="color-box" style=@($"background: {CostumeColors[index]}")></div>
@index
</MudSelectItem>
}
</MudSelect>
<MudSelect @bind-Value="@response.FaceColor" Label="Face Color">
@for (uint i = 0; i < Constants.COSTUME_COLOR_MAX; i++)
{
var index = i;
<MudSelectItem Value="@index">
<div class="color-box" style=@($"background: {CostumeColors[index]}")></div>
@index
</MudSelectItem>
}
</MudSelect>
<MudSelect @bind-Value="@response.LimbColor" Label="Limb Color">
@for (uint i = 0; i < Constants.COSTUME_COLOR_MAX; i++)
{
var index = i;
<MudSelectItem Value="@index">
<div class="color-box" style=@($"background: {CostumeColors[index]}")></div>
@index
</MudSelectItem>
}
</MudSelect>
</MudStack>
</MudItem>
</MudGrid>
</MudStack>
</MudTabPanel>
<MudTabPanel Text="Song Options">
<MudStack Spacing="4">
<h2>Song Options</h2>
<MudGrid>
<MudItem xs="12" md="4">
<MudStack Spacing="4">
<MudSwitch @bind-Checked="@response.PlaySetting.IsVanishOn" Label="Vanish" Color="Color.Primary" />
<MudSwitch @bind-Checked="@response.PlaySetting.IsInverseOn" Label="Inverse" Color="Color.Primary" />
<MudSwitch @bind-Checked="@response.IsSkipOn" Label="Give Up" Color="Color.Primary" />
<MudSwitch @bind-Checked="@response.IsVoiceOn" Label="Voice" Color="Color.Primary" />
</MudStack>
</MudItem>
<MudItem xs="12" md="8">
<MudStack Spacing="4">
<MudSelect @bind-Value="@response.PlaySetting.Speed" Label="Speed">
@for (uint i = 0; i < 15; i++)
{
var index = i;
<MudSelectItem Value="@i">@SpeedStrings[index]</MudSelectItem>
}
</MudSelect>
<MudSelect @bind-Value="@response.PlaySetting.RandomType"
Label="Random">
@foreach (var item in Enum.GetValues<RandomType>())
{
<MudSelectItem Value="@item" />
}
</MudSelect>
<MudSelect @bind-Value="@response.ToneId" Label="Tone">
@for (uint i = 0; i < 19; i++)
{
var index = i;
<MudSelectItem Value="@i">@ToneStrings[index]</MudSelectItem>
}
</MudSelect>
<MudSlider Class="mb-8" @bind-Value="@response.NotesPosition" Size="Size.Medium" Min="-5" Max="5" Step="1" TickMarks="true" TickMarkLabels="@NotePositionStrings">
<MudText Typo="Typo.caption">Notes Position</MudText>
</MudSlider>
</MudStack>
</MudItem>
</MudGrid>
</MudStack>
</MudTabPanel>
</MudTabs>
</MudPaper>
</MudItem>
<MudItem md="4" xs="12" Class="py-4 px-8">
<MudStack Style="top:100px" Class="sticky">
<MudButton Disabled="@isSavingOptions"
OnClick="SaveOptions"
Variant="Variant.Filled"
Color="Color.Primary">
@if (isSavingOptions)
{
<MudProgressCircular Class="ms-n1" Size="Size.Small" Indeterminate="true" />
<MudText Class="ms-2">Saving...</MudText>
}
else
{
<MudIcon Icon="@Icons.Filled.Save" Class="mx-2"></MudIcon>
<MudText>Save</MudText>
}
</MudButton>
</MudStack>
</MudItem>
</MudGrid> </MudGrid>
} }

View File

@ -11,15 +11,15 @@ public partial class Profile
private bool isSavingOptions; private bool isSavingOptions;
private static readonly string[] CostumeColors = private static readonly string[] CostumeColors =
{ {
"#F84828", "#68C0C0", "#DC1500", "#F8F0E0", "#009687", "#00BF87", "#F84828", "#68C0C0", "#DC1500", "#F8F0E0", "#009687", "#00BF87",
"#00FF9A", "#66FFC2", "#FFFFFF", "#690000", "#FF0000", "#FF6666", "#00FF9A", "#66FFC2", "#FFFFFF", "#690000", "#FF0000", "#FF6666",
"#FFB3B3", "#00BCC2", "#00F7FF", "#66FAFF", "#B3FDFF", "#E4E4E4", "#FFB3B3", "#00BCC2", "#00F7FF", "#66FAFF", "#B3FDFF", "#E4E4E4",
"#993800", "#FF5E00", "#FF9E78", "#FFCFB3", "#005199", "#0088FF", "#993800", "#FF5E00", "#FF9E78", "#FFCFB3", "#005199", "#0088FF",
"#66B8FF", "#B3DBFF", "#B9B9B9", "#B37700", "#FFAA00", "#FFCC66", "#66B8FF", "#B3DBFF", "#B9B9B9", "#B37700", "#FFAA00", "#FFCC66",
"#FFE2B3", "#000C80", "#0019FF", "#6675FF", "#B3BAFF", "#858585", "#FFE2B3", "#000C80", "#0019FF", "#6675FF", "#B3BAFF", "#858585",
"#B39B00", "#FFDD00", "#FFFF00", "#FFFF71", "#2B0080", "#5500FF", "#B39B00", "#FFDD00", "#FFFF00", "#FFFF71", "#2B0080", "#5500FF",
"#9966FF", "#CCB3FF", "#505050", "#38A100", "#78C900", "#B3FF00", "#9966FF", "#CCB3FF", "#505050", "#38A100", "#78C900", "#B3FF00",
"#DCFF8A", "#610080", "#C400FF", "#DC66FF", "#EDB3FF", "#232323", "#DCFF8A", "#610080", "#C400FF", "#DC66FF", "#EDB3FF", "#232323",
"#006600", "#00B800", "#00FF00", "#8AFF9E", "#990059", "#FF0095", "#006600", "#00B800", "#00FF00", "#8AFF9E", "#990059", "#FF0095",
@ -50,6 +50,24 @@ public partial class Profile
"AI 1", "AI 2", "AI 3", "AI 4" "AI 1", "AI 2", "AI 3", "AI 4"
}; };
private static readonly string[] DifficultySettingCourseStrings =
{
"None", "Set up each time",
"Easy", "Normal", "Hard", "Oni", "Ura Oni"
};
private static readonly string[] DifficultySettingStarStrings =
{
"None", "Set up each time",
"1", "2", "3", "4", "5", "6", "7", "8", "9", "10"
};
private static readonly string[] DifficultySettingSortStrings =
{
"None", "Set up each time", "Default",
"Not cleared", "Not Full Combo", "Not Donderful Combo"
};
private readonly List<BreadcrumbItem> breadcrumbs = new() private readonly List<BreadcrumbItem> breadcrumbs = new()
{ {
new BreadcrumbItem("Cards", href: "/Cards"), new BreadcrumbItem("Cards", href: "/Cards"),