mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-31 21:03:43 +01:00
refactor: change chat message API to pass parsed SeString
This commit is contained in:
parent
3c4dad437e
commit
24cb7f014e
7 changed files with 32 additions and 36 deletions
|
|
@ -50,6 +50,8 @@ namespace Dalamud.Game.Chat.SeStringHandling.Payloads
|
|||
// unk
|
||||
bytes.AddRange(new byte[] { 0x02, 0x01, END_BYTE });
|
||||
|
||||
|
||||
|
||||
return bytes.ToArray();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ namespace Dalamud.Game.Chat.SeStringHandling.Payloads
|
|||
{
|
||||
public override PayloadType Type => PayloadType.RawText;
|
||||
|
||||
public string Text { get; private set; }
|
||||
public string Text { get; set; }
|
||||
|
||||
public TextPayload() { }
|
||||
|
||||
|
|
|
|||
|
|
@ -13,31 +13,8 @@ namespace Dalamud.Game.Chat.SeStringHandling
|
|||
/// </summary>
|
||||
public class SeString
|
||||
{
|
||||
private Dictionary<PayloadType, List<Payload>> mappedPayloads_ = null;
|
||||
|
||||
public List<Payload> Payloads { get; }
|
||||
|
||||
public Dictionary<PayloadType, List<Payload>> MappedPayloads
|
||||
{
|
||||
get
|
||||
{
|
||||
if (mappedPayloads_ == null)
|
||||
{
|
||||
mappedPayloads_ = new Dictionary<PayloadType, List<Payload>>();
|
||||
foreach (var p in Payloads)
|
||||
{
|
||||
if (!mappedPayloads_.ContainsKey(p.Type))
|
||||
{
|
||||
mappedPayloads_[p.Type] = new List<Payload>();
|
||||
}
|
||||
mappedPayloads_[p.Type].Add(p);
|
||||
}
|
||||
}
|
||||
|
||||
return mappedPayloads_;
|
||||
}
|
||||
}
|
||||
|
||||
public SeString(List<Payload> payloads)
|
||||
{
|
||||
Payloads = payloads;
|
||||
|
|
@ -93,10 +70,10 @@ namespace Dalamud.Game.Chat.SeStringHandling
|
|||
/// </summary>
|
||||
/// <param name="payloads"></param>
|
||||
/// <returns>The bytes of the message.</returns>
|
||||
public static byte[] Encode(List<Payload> payloads)
|
||||
public byte[] Encode()
|
||||
{
|
||||
var messageBytes = new List<byte>();
|
||||
foreach (var p in payloads)
|
||||
foreach (var p in Payloads)
|
||||
{
|
||||
messageBytes.AddRange(p.Encode());
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue