+5
-2
@@ -135,8 +135,11 @@ internal class Message
|
|||||||
private List<Chunk> CheckMessageContent(List<Chunk> oldChunks)
|
private List<Chunk> CheckMessageContent(List<Chunk> oldChunks)
|
||||||
{
|
{
|
||||||
var newChunks = new List<Chunk>();
|
var newChunks = new List<Chunk>();
|
||||||
void AddChunkWithMessage(Chunk chunk)
|
void AddChunkWithMessage(TextChunk chunk)
|
||||||
{
|
{
|
||||||
|
if (string.IsNullOrEmpty(chunk.Content))
|
||||||
|
return;
|
||||||
|
|
||||||
chunk.Message = this;
|
chunk.Message = this;
|
||||||
newChunks.Add(chunk);
|
newChunks.Add(chunk);
|
||||||
}
|
}
|
||||||
@@ -198,7 +201,7 @@ internal class Message
|
|||||||
AddContentAfterURLCheck(builder.ToString(), text, chunk);
|
AddContentAfterURLCheck(builder.ToString(), text, chunk);
|
||||||
builder.Clear();
|
builder.Clear();
|
||||||
|
|
||||||
newChunks.Add(new TextChunk(chunk.Source, EmotePayload.ResolveEmote(word), word));
|
AddChunkWithMessage(new TextChunk(chunk.Source, EmotePayload.ResolveEmote(word), word));
|
||||||
builder.Append(' ');
|
builder.Append(' ');
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1482,13 +1482,17 @@ public sealed class ChatLogWindow : Window
|
|||||||
using var style = ImRaii.PushStyle(ImGuiStyleVar.ItemSpacing, Vector2.Zero);
|
using var style = ImRaii.PushStyle(ImGuiStyleVar.ItemSpacing, Vector2.Zero);
|
||||||
for (var i = 0; i < chunks.Count; i++)
|
for (var i = 0; i < chunks.Count; i++)
|
||||||
{
|
{
|
||||||
if (chunks[i] is TextChunk text && string.IsNullOrEmpty(text.Content))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
DrawChunk(chunks[i], wrap, handler, lineWidth);
|
DrawChunk(chunks[i], wrap, handler, lineWidth);
|
||||||
|
|
||||||
if (i < chunks.Count - 1)
|
if (i < chunks.Count - 1)
|
||||||
ImGui.SameLine();
|
ImGui.SameLine();
|
||||||
|
else if (chunks[i].Link is EmotePayload) {
|
||||||
|
// Emote payloads seem to not automatically put newlines, which
|
||||||
|
// is an issue when modern mode is disabled.
|
||||||
|
ImGui.SameLine();
|
||||||
|
// Use default ImGui behavior for newlines.
|
||||||
|
ImGui.TextUnformatted("");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1517,17 +1521,17 @@ public sealed class ChatLogWindow : Window
|
|||||||
if (chunk is not TextChunk text)
|
if (chunk is not TextChunk text)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (chunk.Link?.Type == (PayloadType)0x53)
|
if (chunk.Link is EmotePayload emotePayload)
|
||||||
{
|
{
|
||||||
var emoteSize = ImGui.CalcTextSize("W");
|
var emoteSize = ImGui.CalcTextSize("W");
|
||||||
emoteSize = emoteSize with { Y = emoteSize.X } * 1.5f;
|
emoteSize = emoteSize with { Y = emoteSize.X } * 1.5f;
|
||||||
|
|
||||||
var emotePayload = (EmotePayload) chunk.Link;
|
|
||||||
var image = EmoteCache.GetEmote(emotePayload.Code);
|
var image = EmoteCache.GetEmote(emotePayload.Code);
|
||||||
if (image is { IsLoaded: true })
|
if (image is { IsLoaded: true })
|
||||||
image.Draw(emoteSize);
|
image.Draw(emoteSize);
|
||||||
else
|
else
|
||||||
ImGui.Dummy(emoteSize);
|
ImGui.Dummy(emoteSize);
|
||||||
|
ImGui.SetTooltip(emotePayload.Code);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user