Merge branch 'CHN' of https://github.com/asesidaa/TaikoLocalServer into CHN
This commit is contained in:
commit
0fbdfae3a8
@ -1,6 +1,7 @@
|
|||||||
using SharedProject.Models;
|
using SharedProject.Models;
|
||||||
using SharedProject.Utils;
|
using SharedProject.Utils;
|
||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
|
using Throw;
|
||||||
|
|
||||||
namespace TaikoLocalServer.Controllers.Api;
|
namespace TaikoLocalServer.Controllers.Api;
|
||||||
|
|
||||||
@ -123,6 +124,21 @@ public class UserSettingsController : BaseController<UserSettingsController>
|
|||||||
user.ColorLimb = userSetting.LimbColor;
|
user.ColorLimb = userSetting.LimbColor;
|
||||||
user.CostumeData = JsonSerializer.Serialize(costumes);
|
user.CostumeData = JsonSerializer.Serialize(costumes);
|
||||||
|
|
||||||
|
// If a locked tone is selected, unlock it
|
||||||
|
uint[] toneFlg = { 0u };
|
||||||
|
try
|
||||||
|
{
|
||||||
|
toneFlg = JsonSerializer.Deserialize<uint[]>(user.ToneFlgArray)!;
|
||||||
|
}
|
||||||
|
catch (JsonException e)
|
||||||
|
{
|
||||||
|
Logger.LogError(e, "Parsing tone flg json data failed");
|
||||||
|
}
|
||||||
|
toneFlg.ThrowIfNull("Tone flg should never be null!");
|
||||||
|
toneFlg = toneFlg.Append(0u).Append(userSetting.ToneId).Distinct().ToArray();
|
||||||
|
|
||||||
|
user.ToneFlgArray = JsonSerializer.Serialize(toneFlg);
|
||||||
|
|
||||||
await userDatumService.UpdateUserDatum(user);
|
await userDatumService.UpdateUserDatum(user);
|
||||||
|
|
||||||
return NoContent();
|
return NoContent();
|
||||||
|
Loading…
Reference in New Issue
Block a user