2023-02-12 18:46:08 +01:00
|
|
|
using Application.Common.Extensions;
|
|
|
|
using Application.Common.Models;
|
2023-02-13 17:38:19 +01:00
|
|
|
using Application.Dto;
|
2023-02-12 18:46:08 +01:00
|
|
|
using Application.Interfaces;
|
|
|
|
using Domain.Enums;
|
|
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
|
|
|
|
namespace Application.Game.Card.Read;
|
|
|
|
|
|
|
|
|
2023-02-12 19:12:26 +01:00
|
|
|
public record ReadSoundEffectQuery(long CardId) : IRequestWrapper<string>;
|
2023-02-12 18:46:08 +01:00
|
|
|
|
|
|
|
public class ReadSoundEffectQueryHandler : CardRequestHandlerBase<ReadSoundEffectQuery, string>
|
|
|
|
{
|
2023-02-13 17:38:19 +01:00
|
|
|
private const string SOUND_EFFECT_XPATH = "/root/sound_effect/record";
|
2023-02-12 18:46:08 +01:00
|
|
|
public ReadSoundEffectQueryHandler(ICardDependencyAggregate aggregate) : base(aggregate)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
public override Task<ServiceResult<string>> Handle(ReadSoundEffectQuery request, CancellationToken cancellationToken)
|
|
|
|
{
|
2023-02-13 17:38:19 +01:00
|
|
|
var count = Config.SeCount;
|
|
|
|
|
|
|
|
var list = new List<SoundEffectDto>();
|
|
|
|
for (int i = 0; i < count; i++)
|
|
|
|
{
|
|
|
|
var soundEffect = new SoundEffectDto
|
|
|
|
{
|
|
|
|
Id = i,
|
|
|
|
CardId = request.CardId,
|
|
|
|
SoundEffectId = i,
|
|
|
|
Created = "2013-01-01 08:00:00",
|
|
|
|
Modified = "2013-01-01 08:00:00",
|
|
|
|
NewFlag = 0,
|
|
|
|
UseFlag = 1
|
|
|
|
};
|
|
|
|
list.Add(soundEffect);
|
|
|
|
}
|
|
|
|
|
|
|
|
var result = list.SerializeCardDataList(SOUND_EFFECT_XPATH);
|
|
|
|
|
|
|
|
return Task.FromResult(new ServiceResult<string>(result));
|
2023-02-12 18:46:08 +01:00
|
|
|
}
|
|
|
|
}
|