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

32 lines
1.1 KiB
C#

using Tiger.Communication.Messages.Interfaces;
using Tiger.Communication.Messages.Types;
using Tiger.Game.LandingView;
namespace Tiger.Communication.Messages.Outgoing.Landingview;
public class PromoArticlesMessageComposer : IMessageComposer
{
private readonly ICollection<PromoArticle> _promoArticles;
public PromoArticlesMessageComposer(ICollection<PromoArticle> promoArticles)
{
_promoArticles = promoArticles;
}
public OutgoingHeaders Header => OutgoingHeaders.PromoArticles;
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);
}
}
}