1
0
mirror of synced 2024-09-24 03:18:27 +02:00

Add ary_movie_info handle

This commit is contained in:
esuo1198 2023-09-13 12:24:48 +09:00
parent b880ac9663
commit aa6499866f
7 changed files with 98 additions and 28 deletions

View File

@ -0,0 +1,12 @@
using System.Text.Json.Serialization;
namespace SharedProject.Models;
public class MovieData
{
[JsonPropertyName("movie_id")]
public uint MovieId { get; set; }
[JsonPropertyName("enable_days")]
public uint EnableDays { get; set; }
}

View File

@ -24,7 +24,7 @@ public class InitialDataCheckController : BaseController<InitialDataCheckControl
Logger.LogInformation("Initial data check request: {Request}", request.Stringify());
var songIdMax = settings.EnableMoreSongs ? Constants.MUSIC_ID_MAX_EXPANDED : Constants.MUSIC_ID_MAX;
var lockedSongsList = gameDataService.GetLockedSongsList();
var enabledMusicList = gameDataService.GetMusicList().Except(lockedSongsList);
var enabledUraMusicList = gameDataService.GetMusicWithUraList().Except(lockedSongsList);
@ -33,12 +33,14 @@ public class InitialDataCheckController : BaseController<InitialDataCheckControl
FlagCalculator.GetBitArrayFromIds(enabledMusicList, songIdMax, Logger);
var uraReleaseBit = FlagCalculator.GetBitArrayFromIds(enabledUraMusicList, songIdMax, Logger);
var movieDataDictionary = gameDataService.GetMovieDataDictionary();
var verupNo1 = new uint[] { 104 };
var aryVerUp = verupNo1.Select(i => new InitialdatacheckResponse.VerupNoData1
{
MasterType = i,
VerupNo = 1
})
{
MasterType = i,
VerupNo = 1
})
.ToList();
var response = new InitialdatacheckResponse
@ -49,8 +51,11 @@ public class InitialDataCheckController : BaseController<InitialDataCheckControl
UraReleaseBit = uraReleaseBit,
SongIntroductionEndDatetime = DateTime.Now.AddYears(10).ToString(Constants.DATE_TIME_FORMAT),
};
foreach (var movieData in movieDataDictionary) response.AryMovieInfoes.Add(movieData.Value);
response.AryVerupNoData1s.AddRange(aryVerUp);
var danData = new List<InitialdatacheckResponse.VerupNoData2.InformationData>();
for (var danId = Constants.MIN_DAN_ID; danId <= 18; danId++)
{
@ -60,6 +65,7 @@ public class InitialDataCheckController : BaseController<InitialDataCheckControl
VerupNo = 1
});
}
var verupNo2 = new uint[] { 101 };
foreach (var i in verupNo2)
{
@ -70,8 +76,8 @@ public class InitialDataCheckController : BaseController<InitialDataCheckControl
verUp2.AryInformationDatas.AddRange(danData);
response.AryVerupNoData2s.Add(verUp2);
}
response.AryChassisFunctionIds = new uint[] {1,2,3};
response.AryChassisFunctionIds = new uint[] { 1, 2, 3 };
return Ok(response);
}

View File

@ -21,19 +21,22 @@ public class GameDataService : IGameDataService
private ImmutableDictionary<uint, GetSongIntroductionResponse.SongIntroductionData> introDataDictionary =
ImmutableDictionary<uint, GetSongIntroductionResponse.SongIntroductionData>.Empty;
private ImmutableDictionary<uint, InitialdatacheckResponse.MovieData> movieDataDictionary =
ImmutableDictionary<uint, InitialdatacheckResponse.MovieData>.Empty;
private ImmutableDictionary<uint, MusicAttributeEntry> musicAttributes =
ImmutableDictionary<uint, MusicAttributeEntry>.Empty;
private ImmutableDictionary<uint, GetfolderResponse.EventfolderData> folderDictionary =
ImmutableDictionary<uint, GetfolderResponse.EventfolderData>.Empty;
private ImmutableDictionary<uint, GetShopFolderResponse.ShopFolderData> shopFolderDictionary =
ImmutableDictionary<uint, GetShopFolderResponse.ShopFolderData>.Empty;
private List<uint> musics = new();
private List<uint> musicsWithUra = new();
private List<uint> lockedSongsList = new();
private Dictionary<string, uint> tokenDataDictionary = new();
@ -75,16 +78,21 @@ public class GameDataService : IGameDataService
return introDataDictionary;
}
public ImmutableDictionary<uint, InitialdatacheckResponse.MovieData> GetMovieDataDictionary()
{
return movieDataDictionary;
}
public ImmutableDictionary<uint, GetfolderResponse.EventfolderData> GetFolderDictionary()
{
return folderDictionary;
}
public ImmutableDictionary<uint, GetShopFolderResponse.ShopFolderData> GetShopFolderDictionary()
{
return shopFolderDictionary;
}
public Dictionary<string, uint> GetTokenDataDictionary()
{
return tokenDataDictionary;
@ -104,6 +112,7 @@ public class GameDataService : IGameDataService
var compressedMusicAttributePath = Path.Combine(dataPath, Constants.MUSIC_ATTRIBUTE_COMPRESSED_FILE_NAME);
var danDataPath = Path.Combine(dataPath, settings.DanDataFileName);
var songIntroDataPath = Path.Combine(dataPath, settings.IntroDataFileName);
var movieDataPath = Path.Combine(dataPath, settings.MovieDataFileName);
var eventFolderDataPath = Path.Combine(dataPath, settings.EventFolderDataFileName);
var shopFolderDataPath = Path.Combine(dataPath, settings.ShopFolderDataFileName);
var tokenDataPath = Path.Combine(dataPath, settings.TokenDataFileName);
@ -121,6 +130,7 @@ public class GameDataService : IGameDataService
await using var musicAttributeFile = File.OpenRead(musicAttributePath);
await using var danDataFile = File.OpenRead(danDataPath);
await using var songIntroDataFile = File.OpenRead(songIntroDataPath);
await using var movieDataFile = File.OpenRead(movieDataPath);
await using var eventFolderDataFile = File.OpenRead(eventFolderDataPath);
await using var shopFolderDataFile = File.OpenRead(shopFolderDataPath);
await using var tokenDataFile = File.OpenRead(tokenDataPath);
@ -130,6 +140,7 @@ public class GameDataService : IGameDataService
var attributesData = await JsonSerializer.DeserializeAsync<MusicAttributes>(musicAttributeFile);
var danData = await JsonSerializer.DeserializeAsync<List<DanData>>(danDataFile);
var introData = await JsonSerializer.DeserializeAsync<List<SongIntroductionData>>(songIntroDataFile);
var movieData = await JsonSerializer.DeserializeAsync<List<MovieData>>(movieDataFile);
var eventFolderData = await JsonSerializer.DeserializeAsync<List<EventFolderData>>(eventFolderDataFile);
var shopFolderData = await JsonSerializer.DeserializeAsync<List<ShopFolderData>>(shopFolderDataFile);
var tokenData = await JsonSerializer.DeserializeAsync<Dictionary<string, uint>>(tokenDataFile);
@ -143,10 +154,12 @@ public class GameDataService : IGameDataService
InitializeIntroData(introData);
InitializeMovieData(movieData);
InitializeEventFolderData(eventFolderData);
InitializeShopFolderData(shopFolderData);
InitializeTokenData(tokenData);
InitializeLockedSongsData(lockedSongsData);
@ -182,6 +195,12 @@ public class GameDataService : IGameDataService
introDataDictionary = introData.ToImmutableDictionary(data => data.SetId, ToResponseIntroData);
}
private void InitializeMovieData(List<MovieData>? movieData)
{
movieData.ThrowIfNull("Shouldn't happen!");
movieDataDictionary = movieData.ToImmutableDictionary(data => data.MovieId, ToResponseMovieData);
}
private void InitializeDanData(List<DanData>? danData)
{
danData.ThrowIfNull("Shouldn't happen!");
@ -216,7 +235,7 @@ public class GameDataService : IGameDataService
.ToList();
musics.Sort();
}
private void InitializeShopFolderData(List<ShopFolderData>? shopFolderData)
{
shopFolderData.ThrowIfNull("Shouldn't happen!");
@ -234,7 +253,7 @@ public class GameDataService : IGameDataService
lockedSongsData.ThrowIfNull("Shouldn't happen!");
lockedSongsList = lockedSongsData["songNo"].ToList();
}
private static GetDanOdaiResponse.OdaiData ToResponseOdaiData(DanData data)
{
var responseOdaiData = new GetDanOdaiResponse.OdaiData
@ -255,7 +274,7 @@ public class GameDataService : IGameDataService
private static GetSongIntroductionResponse.SongIntroductionData ToResponseIntroData(SongIntroductionData data)
{
var responseOdaiData = new GetSongIntroductionResponse.SongIntroductionData
var responseIntroData = new GetSongIntroductionResponse.SongIntroductionData
{
SetId = data.SetId,
VerupNo = data.VerupNo,
@ -263,7 +282,18 @@ public class GameDataService : IGameDataService
SubSongNoes = data.SubSongNo
};
return responseOdaiData;
return responseIntroData;
}
private static InitialdatacheckResponse.MovieData ToResponseMovieData(MovieData data)
{
var responseMovieData = new InitialdatacheckResponse.MovieData
{
MovieId = data.MovieId,
EnableDays = data.EnableDays
};
return responseMovieData;
}
private static GetfolderResponse.EventfolderData ToResponseEventFolderData(EventFolderData data)
@ -278,7 +308,7 @@ public class GameDataService : IGameDataService
return responseEventFolderData;
}
private static GetShopFolderResponse.ShopFolderData ToResponseShopFolderData(ShopFolderData data)
{
var responseShopFolderData = new GetShopFolderResponse.ShopFolderData

View File

@ -18,12 +18,14 @@ public interface IGameDataService
public ImmutableDictionary<uint, GetSongIntroductionResponse.SongIntroductionData> GetSongIntroDictionary();
public ImmutableDictionary<uint, InitialdatacheckResponse.MovieData> GetMovieDataDictionary();
public ImmutableDictionary<uint, GetfolderResponse.EventfolderData> GetFolderDictionary();
public ImmutableDictionary<uint, GetShopFolderResponse.ShopFolderData> GetShopFolderDictionary();
public Dictionary<string, uint> GetTokenDataDictionary();
public List<uint> GetLockedSongsList();
}

View File

@ -2,15 +2,17 @@
public class DataSettings
{
public string DanDataFileName { get; set; } = "dan_data.json";
public string DanDataFileName { get; set; } = "dan_data.json";
public string EventFolderDataFileName { get; set; } = "event_folder_data.json";
public string EventFolderDataFileName { get; set; } = "event_folder_data.json";
public string IntroDataFileName { get; set; } = "intro_data.json";
public string ShopFolderDataFileName { get; set; } = "shop_folder_data.json";
public string IntroDataFileName { get; set; } = "intro_data.json";
public string TokenDataFileName { get; set; } = "token_data.json";
public string MovieDataFileName { get; set; } = "movie_data.json";
public string LockedSongsDataFileName { get; set; } = "locked_songs_data.json";
public string ShopFolderDataFileName { get; set; } = "shop_folder_data.json";
public string TokenDataFileName { get; set; } = "token_data.json";
public string LockedSongsDataFileName { get; set; } = "locked_songs_data.json";
}

View File

@ -58,12 +58,24 @@
<None Include="Configurations\Logging.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<Content Update="wwwroot\data\locked_songs_data.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Update="wwwroot\data\movie_data.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Update="wwwroot\data\music_order.bin">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Update="wwwroot\data\musicinfo.bin">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Update="wwwroot\data\shop_folder_data.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Update="wwwroot\data\token_data.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Update="wwwroot\data\wordlist.bin">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>

View File

@ -0,0 +1,6 @@
[
{
"movie_id": 0,
"enable_days": 0
}
]