2023-10-06 16:12:35 +00:00
|
|
|
using Tiger.Communication.Messages.Interfaces;
|
|
|
|
using Tiger.Communication.Messages.Types;
|
|
|
|
using Tiger.Game.Catalogue;
|
|
|
|
|
|
|
|
namespace Tiger.Communication.Messages.Outgoing.Catalog;
|
|
|
|
|
|
|
|
public class CatalogPageMessageComposer : IMessageComposer
|
|
|
|
{
|
|
|
|
private readonly CataloguePage _page;
|
|
|
|
private readonly int _offerId;
|
|
|
|
private readonly string _mode;
|
|
|
|
|
|
|
|
public CatalogPageMessageComposer(CataloguePage page, int offerId, string mode)
|
|
|
|
{
|
|
|
|
_page = page;
|
|
|
|
_offerId = offerId;
|
|
|
|
_mode = mode;
|
|
|
|
}
|
|
|
|
|
2023-10-14 16:21:53 +00:00
|
|
|
public OutgoingHeaders Header => OutgoingHeaders.CatalogPage;
|
2023-10-06 16:12:35 +00:00
|
|
|
public void Compose(ServerMessage message)
|
|
|
|
{
|
|
|
|
message.AppendInt32(_page.Id);
|
|
|
|
message.AppendString(_mode);
|
|
|
|
message.AppendString(_page.Layout);
|
|
|
|
message.AppendInt32(_page.Images.Count);
|
|
|
|
|
|
|
|
foreach (var image in _page.Images)
|
|
|
|
{
|
|
|
|
message.AppendString(image);
|
|
|
|
}
|
|
|
|
|
|
|
|
message.AppendInt32(_page.Texts.Count);
|
|
|
|
|
|
|
|
foreach (var text in _page.Texts)
|
|
|
|
{
|
|
|
|
message.AppendString(text);
|
|
|
|
}
|
|
|
|
|
|
|
|
message.AppendInt32(0);
|
|
|
|
message.AppendInt32(_offerId);
|
|
|
|
message.AppendBoolean(_page.SeasonalCurrency);
|
|
|
|
}
|
|
|
|
}
|