Implemented getDanOdai type 2
This commit is contained in:
parent
62ef9bf980
commit
7dd43d2617
@ -16,29 +16,41 @@ public class GetDanOdaiController : BaseController<GetDanOdaiController>
|
|||||||
public IActionResult GetDanOdai([FromBody] GetDanOdaiRequest request)
|
public IActionResult GetDanOdai([FromBody] GetDanOdaiRequest request)
|
||||||
{
|
{
|
||||||
Logger.LogInformation("GetDanOdai request : {Request}", request.Stringify());
|
Logger.LogInformation("GetDanOdai request : {Request}", request.Stringify());
|
||||||
|
|
||||||
var response = new GetDanOdaiResponse
|
var response = new GetDanOdaiResponse
|
||||||
{
|
{
|
||||||
Result = 1
|
Result = 1
|
||||||
};
|
};
|
||||||
|
|
||||||
// if (request.Type == 2)
|
if (request.Type == 1)
|
||||||
// {
|
|
||||||
// return Ok(response);
|
|
||||||
// }
|
|
||||||
|
|
||||||
foreach (var danId in request.DanIds)
|
|
||||||
{
|
{
|
||||||
gameDataService.GetDanDataDictionary().TryGetValue(danId, out var odaiData);
|
foreach (var danId in request.DanIds)
|
||||||
if (odaiData is null)
|
|
||||||
{
|
{
|
||||||
Logger.LogWarning("Requested dan id {Id} does not exist!", danId);
|
gameDataService.GetDanDataDictionary().TryGetValue(danId, out var odaiData);
|
||||||
continue;
|
if (odaiData is null)
|
||||||
|
{
|
||||||
|
Logger.LogWarning("Requested dan id {Id} does not exist!", danId);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
response.AryOdaiDatas.Add(odaiData);
|
||||||
}
|
}
|
||||||
|
|
||||||
response.AryOdaiDatas.Add(odaiData);
|
|
||||||
}
|
}
|
||||||
|
else if (request.Type == 2)
|
||||||
|
{
|
||||||
|
foreach (var danId in request.DanIds)
|
||||||
|
{
|
||||||
|
gameDataService.GetGaidenDataDictionary().TryGetValue(danId, out var odaiData);
|
||||||
|
if (odaiData is null)
|
||||||
|
{
|
||||||
|
Logger.LogWarning("Requested dan id {Id} does not exist!", danId);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
response.AryOdaiDatas.Add(odaiData);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return Ok(response);
|
return Ok(response);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -73,11 +73,22 @@ public class InitialDataCheckController : BaseController<InitialDataCheckControl
|
|||||||
verUp2Type101.AryInformationDatas.AddRange(danData);
|
verUp2Type101.AryInformationDatas.AddRange(danData);
|
||||||
response.AryVerupNoData2s.Add(verUp2Type101);
|
response.AryVerupNoData2s.Add(verUp2Type101);
|
||||||
|
|
||||||
|
var gaidenData = new List<InitialdatacheckResponse.VerupNoData2.InformationData>();
|
||||||
|
var gaidenDataDictionary = gameDataService.GetGaidenDataDictionary();
|
||||||
|
foreach (var gaidenId in gaidenDataDictionary.Keys)
|
||||||
|
{
|
||||||
|
gaidenData.Add(new InitialdatacheckResponse.VerupNoData2.InformationData
|
||||||
|
{
|
||||||
|
InfoId = gaidenId,
|
||||||
|
VerupNo = 1
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
var verUp2Type102 = new InitialdatacheckResponse.VerupNoData2
|
var verUp2Type102 = new InitialdatacheckResponse.VerupNoData2
|
||||||
{
|
{
|
||||||
MasterType = 102,
|
MasterType = 102,
|
||||||
};
|
};
|
||||||
verUp2Type102.AryInformationDatas.AddRange(danData);
|
verUp2Type102.AryInformationDatas.AddRange(gaidenData);
|
||||||
response.AryVerupNoData2s.Add(verUp2Type102);
|
response.AryVerupNoData2s.Add(verUp2Type102);
|
||||||
|
|
||||||
var eventFolderData = new List<InitialdatacheckResponse.VerupNoData2.InformationData>();
|
var eventFolderData = new List<InitialdatacheckResponse.VerupNoData2.InformationData>();
|
||||||
|
@ -17,6 +17,9 @@ public class GameDataService : IGameDataService
|
|||||||
|
|
||||||
private ImmutableDictionary<uint, GetDanOdaiResponse.OdaiData> danDataDictionary =
|
private ImmutableDictionary<uint, GetDanOdaiResponse.OdaiData> danDataDictionary =
|
||||||
ImmutableDictionary<uint, GetDanOdaiResponse.OdaiData>.Empty;
|
ImmutableDictionary<uint, GetDanOdaiResponse.OdaiData>.Empty;
|
||||||
|
|
||||||
|
private ImmutableDictionary<uint, GetDanOdaiResponse.OdaiData> gaidenDataDictionary =
|
||||||
|
ImmutableDictionary<uint, GetDanOdaiResponse.OdaiData>.Empty;
|
||||||
|
|
||||||
private ImmutableDictionary<uint, GetSongIntroductionResponse.SongIntroductionData> introDataDictionary =
|
private ImmutableDictionary<uint, GetSongIntroductionResponse.SongIntroductionData> introDataDictionary =
|
||||||
ImmutableDictionary<uint, GetSongIntroductionResponse.SongIntroductionData>.Empty;
|
ImmutableDictionary<uint, GetSongIntroductionResponse.SongIntroductionData>.Empty;
|
||||||
@ -72,6 +75,11 @@ public class GameDataService : IGameDataService
|
|||||||
{
|
{
|
||||||
return danDataDictionary;
|
return danDataDictionary;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ImmutableDictionary<uint, GetDanOdaiResponse.OdaiData> GetGaidenDataDictionary()
|
||||||
|
{
|
||||||
|
return gaidenDataDictionary;
|
||||||
|
}
|
||||||
|
|
||||||
public ImmutableDictionary<uint, GetSongIntroductionResponse.SongIntroductionData> GetSongIntroDictionary()
|
public ImmutableDictionary<uint, GetSongIntroductionResponse.SongIntroductionData> GetSongIntroDictionary()
|
||||||
{
|
{
|
||||||
@ -111,6 +119,7 @@ public class GameDataService : IGameDataService
|
|||||||
var musicAttributePath = Path.Combine(dataPath, Constants.MUSIC_ATTRIBUTE_FILE_NAME);
|
var musicAttributePath = Path.Combine(dataPath, Constants.MUSIC_ATTRIBUTE_FILE_NAME);
|
||||||
var compressedMusicAttributePath = Path.Combine(dataPath, Constants.MUSIC_ATTRIBUTE_COMPRESSED_FILE_NAME);
|
var compressedMusicAttributePath = Path.Combine(dataPath, Constants.MUSIC_ATTRIBUTE_COMPRESSED_FILE_NAME);
|
||||||
var danDataPath = Path.Combine(dataPath, settings.DanDataFileName);
|
var danDataPath = Path.Combine(dataPath, settings.DanDataFileName);
|
||||||
|
var gaidenDataPath = Path.Combine(dataPath, settings.GaidenDataFileName);
|
||||||
var songIntroDataPath = Path.Combine(dataPath, settings.IntroDataFileName);
|
var songIntroDataPath = Path.Combine(dataPath, settings.IntroDataFileName);
|
||||||
var movieDataPath = Path.Combine(dataPath, settings.MovieDataFileName);
|
var movieDataPath = Path.Combine(dataPath, settings.MovieDataFileName);
|
||||||
var eventFolderDataPath = Path.Combine(dataPath, settings.EventFolderDataFileName);
|
var eventFolderDataPath = Path.Combine(dataPath, settings.EventFolderDataFileName);
|
||||||
@ -129,6 +138,7 @@ public class GameDataService : IGameDataService
|
|||||||
await using var musicInfoFile = File.OpenRead(musicInfoPath);
|
await using var musicInfoFile = File.OpenRead(musicInfoPath);
|
||||||
await using var musicAttributeFile = File.OpenRead(musicAttributePath);
|
await using var musicAttributeFile = File.OpenRead(musicAttributePath);
|
||||||
await using var danDataFile = File.OpenRead(danDataPath);
|
await using var danDataFile = File.OpenRead(danDataPath);
|
||||||
|
await using var gaidenDataFile = File.OpenRead(gaidenDataPath);
|
||||||
await using var songIntroDataFile = File.OpenRead(songIntroDataPath);
|
await using var songIntroDataFile = File.OpenRead(songIntroDataPath);
|
||||||
await using var movieDataFile = File.OpenRead(movieDataPath);
|
await using var movieDataFile = File.OpenRead(movieDataPath);
|
||||||
await using var eventFolderDataFile = File.OpenRead(eventFolderDataPath);
|
await using var eventFolderDataFile = File.OpenRead(eventFolderDataPath);
|
||||||
@ -139,6 +149,7 @@ public class GameDataService : IGameDataService
|
|||||||
var infoesData = await JsonSerializer.DeserializeAsync<MusicInfoes>(musicInfoFile);
|
var infoesData = await JsonSerializer.DeserializeAsync<MusicInfoes>(musicInfoFile);
|
||||||
var attributesData = await JsonSerializer.DeserializeAsync<MusicAttributes>(musicAttributeFile);
|
var attributesData = await JsonSerializer.DeserializeAsync<MusicAttributes>(musicAttributeFile);
|
||||||
var danData = await JsonSerializer.DeserializeAsync<List<DanData>>(danDataFile);
|
var danData = await JsonSerializer.DeserializeAsync<List<DanData>>(danDataFile);
|
||||||
|
var gaidenData = await JsonSerializer.DeserializeAsync<List<DanData>>(gaidenDataFile);
|
||||||
var introData = await JsonSerializer.DeserializeAsync<List<SongIntroductionData>>(songIntroDataFile);
|
var introData = await JsonSerializer.DeserializeAsync<List<SongIntroductionData>>(songIntroDataFile);
|
||||||
var movieData = await JsonSerializer.DeserializeAsync<List<MovieData>>(movieDataFile);
|
var movieData = await JsonSerializer.DeserializeAsync<List<MovieData>>(movieDataFile);
|
||||||
var eventFolderData = await JsonSerializer.DeserializeAsync<List<EventFolderData>>(eventFolderDataFile);
|
var eventFolderData = await JsonSerializer.DeserializeAsync<List<EventFolderData>>(eventFolderDataFile);
|
||||||
@ -151,6 +162,8 @@ public class GameDataService : IGameDataService
|
|||||||
InitializeMusicAttributes(attributesData);
|
InitializeMusicAttributes(attributesData);
|
||||||
|
|
||||||
InitializeDanData(danData);
|
InitializeDanData(danData);
|
||||||
|
|
||||||
|
InitializeGaidenData(gaidenData);
|
||||||
|
|
||||||
InitializeIntroData(introData);
|
InitializeIntroData(introData);
|
||||||
|
|
||||||
@ -206,6 +219,12 @@ public class GameDataService : IGameDataService
|
|||||||
danData.ThrowIfNull("Shouldn't happen!");
|
danData.ThrowIfNull("Shouldn't happen!");
|
||||||
danDataDictionary = danData.ToImmutableDictionary(data => data.DanId, ToResponseOdaiData);
|
danDataDictionary = danData.ToImmutableDictionary(data => data.DanId, ToResponseOdaiData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void InitializeGaidenData(List<DanData>? gaidenData)
|
||||||
|
{
|
||||||
|
gaidenData.ThrowIfNull("Shouldn't happen!");
|
||||||
|
gaidenDataDictionary = gaidenData.ToImmutableDictionary(data => data.DanId, ToResponseOdaiData);
|
||||||
|
}
|
||||||
|
|
||||||
private void InitializeEventFolderData(List<EventFolderData>? eventFolderData)
|
private void InitializeEventFolderData(List<EventFolderData>? eventFolderData)
|
||||||
{
|
{
|
||||||
|
@ -15,6 +15,8 @@ public interface IGameDataService
|
|||||||
public ImmutableDictionary<uint, MusicAttributeEntry> GetMusicAttributes();
|
public ImmutableDictionary<uint, MusicAttributeEntry> GetMusicAttributes();
|
||||||
|
|
||||||
public ImmutableDictionary<uint, GetDanOdaiResponse.OdaiData> GetDanDataDictionary();
|
public ImmutableDictionary<uint, GetDanOdaiResponse.OdaiData> GetDanDataDictionary();
|
||||||
|
|
||||||
|
public ImmutableDictionary<uint, GetDanOdaiResponse.OdaiData> GetGaidenDataDictionary();
|
||||||
|
|
||||||
public ImmutableDictionary<uint, GetSongIntroductionResponse.SongIntroductionData> GetSongIntroDictionary();
|
public ImmutableDictionary<uint, GetSongIntroductionResponse.SongIntroductionData> GetSongIntroDictionary();
|
||||||
|
|
||||||
|
@ -3,6 +3,8 @@
|
|||||||
public class DataSettings
|
public class DataSettings
|
||||||
{
|
{
|
||||||
public string DanDataFileName { get; set; } = "dan_data.json";
|
public string DanDataFileName { get; set; } = "dan_data.json";
|
||||||
|
|
||||||
|
public string GaidenDataFileName { get; set; } = "gaiden_data.json";
|
||||||
|
|
||||||
public string EventFolderDataFileName { get; set; } = "event_folder_data.json";
|
public string EventFolderDataFileName { get; set; } = "event_folder_data.json";
|
||||||
|
|
||||||
|
@ -81,6 +81,9 @@
|
|||||||
<Content Update="wwwroot\data\wordlist.json">
|
<Content Update="wwwroot\data\wordlist.json">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
|
<Content Update="wwwroot\data\gaiden_data.json">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
38
TaikoLocalServer/wwwroot/data/gaiden_data.json
Normal file
38
TaikoLocalServer/wwwroot/data/gaiden_data.json
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"danId":20,
|
||||||
|
"verupNo":1,
|
||||||
|
"title":"gaiden_2022_odai_7",
|
||||||
|
"aryOdaiSong":[
|
||||||
|
{
|
||||||
|
"songNo":828,
|
||||||
|
"level":2,
|
||||||
|
"isHiddenSongName":false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"songNo":187,
|
||||||
|
"level":2,
|
||||||
|
"isHiddenSongName":false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"songNo":789,
|
||||||
|
"level":2,
|
||||||
|
"isHiddenSongName":false
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"aryOdaiBorder":[
|
||||||
|
{
|
||||||
|
"odaiType":1,
|
||||||
|
"borderType":1,
|
||||||
|
"redBorderTotal":92,
|
||||||
|
"goldBorderTotal":95
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"odaiType":8,
|
||||||
|
"borderType":1,
|
||||||
|
"redBorderTotal":786,
|
||||||
|
"goldBorderTotal":832
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
Loading…
Reference in New Issue
Block a user