TigerEmu/Communication/Messages/Outgoing/Landingview/PromoArticlesMessageCompose...

32 lines
1.1 KiB
C#
Raw Normal View History

2023-10-06 19:23:27 +00:00
using Tiger.Communication.Messages.Interfaces;
using Tiger.Communication.Messages.Types;
using Tiger.Game.LandingView;
namespace Tiger.Communication.Messages.Outgoing.Landingview;
public class PromoArticlesMessageComposer : IMessageComposer
2023-10-06 19:23:27 +00:00
{
private readonly ICollection<PromoArticle> _promoArticles;
public PromoArticlesMessageComposer(ICollection<PromoArticle> promoArticles)
2023-10-06 19:23:27 +00:00
{
_promoArticles = promoArticles;
}
public OutgoingHeaders Header => OutgoingHeaders.PromoArticles;
2023-10-06 19:23:27 +00:00
public void Compose(ServerMessage message)
{
message.AppendInt32(_promoArticles.Count);
foreach (var promoArticle in _promoArticles)
{
message.AppendInt32(promoArticle.Id);
message.AppendString(promoArticle.Title);
message.AppendString(promoArticle.BodyText);
message.AppendString(promoArticle.ButtonText);
message.AppendInt32((int)promoArticle.LinkType);
message.AppendString(promoArticle.LinkContent);
message.AppendString(promoArticle.ImageUrl);
}
}
}