feat: better extrachat integration
This commit is contained in:
parent
04cb133613
commit
506baaf96d
|
@ -5,14 +5,14 @@ namespace ChatTwo.Ipc;
|
|||
internal sealed class ExtraChat : IDisposable {
|
||||
private Plugin Plugin { get; }
|
||||
|
||||
private ICallGateSubscriber<string?, object> OverrideChannelGate { get; }
|
||||
private ICallGateSubscriber<(string, ushort, uint)?, object> OverrideChannelGate { get; }
|
||||
|
||||
internal string? ChannelOverride { get; set; }
|
||||
internal (string, uint)? ChannelOverride { get; set; }
|
||||
|
||||
internal ExtraChat(Plugin plugin) {
|
||||
this.Plugin = plugin;
|
||||
|
||||
this.OverrideChannelGate = this.Plugin.Interface.GetIpcSubscriber<string?, object>("ExtraChat.OverrideChannel");
|
||||
this.OverrideChannelGate = this.Plugin.Interface.GetIpcSubscriber<(string, ushort, uint)?, object>("ExtraChat.OverrideChannelColour");
|
||||
|
||||
this.OverrideChannelGate.Subscribe(this.OnOverrideChannel);
|
||||
}
|
||||
|
@ -21,7 +21,12 @@ internal sealed class ExtraChat : IDisposable {
|
|||
this.OverrideChannelGate.Unsubscribe(this.OnOverrideChannel);
|
||||
}
|
||||
|
||||
private void OnOverrideChannel(string? channel) {
|
||||
this.ChannelOverride = channel;
|
||||
private void OnOverrideChannel((string, ushort, uint)? info) {
|
||||
if (info == null) {
|
||||
this.ChannelOverride = null;
|
||||
return;
|
||||
}
|
||||
|
||||
this.ChannelOverride = (info.Value.Item1, info.Value.Item3);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -470,8 +470,8 @@ internal sealed class ChatLog : IUiComponent {
|
|||
}
|
||||
} else if (activeTab is { Channel: { } channel }) {
|
||||
ImGui.TextUnformatted(channel.ToChatType().Name());
|
||||
} else if (this.Ui.Plugin.ExtraChat.ChannelOverride is { } overriden) {
|
||||
ImGui.TextUnformatted(overriden);
|
||||
} else if (this.Ui.Plugin.ExtraChat.ChannelOverride is var (overrideName, _)) {
|
||||
ImGui.TextUnformatted(overrideName);
|
||||
} else {
|
||||
this.DrawChunks(this.Ui.Plugin.Functions.Chat.Channel.name);
|
||||
}
|
||||
|
@ -532,6 +532,10 @@ internal sealed class ChatLog : IUiComponent {
|
|||
? inputCol
|
||||
: inputType.DefaultColour();
|
||||
|
||||
if (this.Ui.Plugin.ExtraChat.ChannelOverride is var (_, overrideColour)) {
|
||||
inputColour = overrideColour;
|
||||
}
|
||||
|
||||
if (inputColour != null) {
|
||||
ImGui.PushStyleColor(ImGuiCol.Text, ColourUtil.RgbaToAbgr(inputColour.Value));
|
||||
}
|
||||
|
@ -548,7 +552,7 @@ internal sealed class ChatLog : IUiComponent {
|
|||
if (ImGui.IsKeyDown(ImGui.GetKeyIndex(ImGuiKey.Escape))) {
|
||||
this.Chat = chatCopy;
|
||||
}
|
||||
|
||||
|
||||
var enter = ImGui.IsKeyDown(ImGui.GetKeyIndex(ImGuiKey.Enter))
|
||||
|| ImGui.IsKeyDown(ImGui.GetKeyIndex(ImGuiKey.KeyPadEnter));
|
||||
if (enter) {
|
||||
|
|
Loading…
Reference in New Issue