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

Implement sending user unlockedSongList in userDataResponse and dymamically sending eventFolder data in initialDataResponse

This commit is contained in:
S-Sebb?? 2023-09-21 04:53:03 +08:00
parent fd38cc6808
commit 4cce75b692
3 changed files with 29 additions and 12 deletions

View File

@ -20,10 +20,6 @@ public static class Constants
public const string INTRO_DATA_FILE_NAME = "intro_data.json";
public const string EVENT_FOLDER_DATA_FILE_NAME = "event_folder_data.json";
public static readonly int[] EVENT_FOLDER_IDS = {
1, 2, 3, 4, 5, 6, 7, 8, 12, 13, 14
};
public const int MIN_DAN_ID = 1;
public const int MAX_DAN_ID = 19;
@ -43,6 +39,5 @@ public static class Constants
COSTUME_FLAG_3_ARRAY_SIZE,
COSTUME_FLAG_4_ARRAY_SIZE,
COSTUME_FLAG_5_ARRAY_SIZE
};
}

View File

@ -92,11 +92,12 @@ public class InitialDataCheckController : BaseController<InitialDataCheckControl
response.AryVerupNoData2s.Add(verUp2Type102);
var eventFolderData = new List<InitialdatacheckResponse.VerupNoData2.InformationData>();
foreach (var folderId in Constants.EVENT_FOLDER_IDS)
var eventFolderDictionary = gameDataService.GetFolderDictionary();
foreach (var folderId in eventFolderDictionary.Keys)
{
eventFolderData.Add(new InitialdatacheckResponse.VerupNoData2.InformationData
{
InfoId = (uint)folderId,
InfoId = folderId,
VerupNo = 1
});
}

View File

@ -34,13 +34,34 @@ public class UserDataController : BaseController<UserDataController>
Logger.LogInformation("UserData request : {Request}", request.Stringify());
var songIdMax = settings.EnableMoreSongs ? Constants.MUSIC_ID_MAX_EXPANDED : Constants.MUSIC_ID_MAX;
var releaseSongArray =
FlagCalculator.GetBitArrayFromIds(gameDataService.GetMusicList(), songIdMax, Logger);
var uraSongArray =
FlagCalculator.GetBitArrayFromIds(gameDataService.GetMusicWithUraList(), songIdMax, Logger);
var userData = await userDatumService.GetFirstUserDatumOrDefault(request.Baid);
var unlockedSongIdList = new List<uint>();
try
{
unlockedSongIdList = !string.IsNullOrEmpty(userData.UnlockedSongIdList)
? JsonSerializer.Deserialize<List<uint>>(userData.UnlockedSongIdList)
: new List<uint>();
}
catch (JsonException e)
{
Logger.LogError(e, "Parsing UnlockedSongIdList data for user with baid {Request} failed!", request.Baid);
}
unlockedSongIdList.ThrowIfNull("UnlockedSongIdList should never be null");
var musicList = gameDataService.GetMusicList();
var lockedSongsList = gameDataService.GetLockedSongsList();
lockedSongsList = lockedSongsList.Except(unlockedSongIdList).ToList();
var enabledMusicList = musicList.Except(lockedSongsList);
var releaseSongArray =
FlagCalculator.GetBitArrayFromIds(enabledMusicList, songIdMax, Logger);
var defaultSongWithUraList = gameDataService.GetMusicWithUraList();
var enabledUraMusicList = defaultSongWithUraList.Except(lockedSongsList);
var uraSongArray =
FlagCalculator.GetBitArrayFromIds(enabledUraMusicList, songIdMax, Logger);
var toneFlg = Array.Empty<uint>();
try