Fix linkshell rotation
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Version>1.26.2</Version>
|
<Version>1.26.3</Version>
|
||||||
<TargetFramework>net8.0-windows</TargetFramework>
|
<TargetFramework>net8.0-windows</TargetFramework>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
|
|||||||
@@ -30,4 +30,5 @@ changelog: |-
|
|||||||
- Fix flags not working in reply mode
|
- Fix flags not working in reply mode
|
||||||
- Force the main chat log to be always open
|
- Force the main chat log to be always open
|
||||||
- Prevent emotes inside auto translation
|
- Prevent emotes inside auto translation
|
||||||
- Make Linkshells appear in selection again
|
- Linkshells appear in selection again
|
||||||
|
- Fix rotate mode not working for CW and Normal Linkshells
|
||||||
|
|||||||
@@ -129,7 +129,7 @@ internal sealed unsafe class Chat : IDisposable
|
|||||||
if (lsInfo == null)
|
if (lsInfo == null)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
// TODO APIX: lsInfo type changed to Entry
|
// TODO APIX: use infoproxychat
|
||||||
var utf = instance->GetLinkshellName(*(ulong**)lsInfo);
|
var utf = instance->GetLinkshellName(*(ulong**)lsInfo);
|
||||||
return utf == null ? null : MemoryHelper.ReadStringNullTerminated((nint) utf);
|
return utf == null ? null : MemoryHelper.ReadStringNullTerminated((nint) utf);
|
||||||
}
|
}
|
||||||
@@ -140,29 +140,24 @@ internal sealed unsafe class Chat : IDisposable
|
|||||||
return utf == null ? null : utf->ToString();
|
return utf == null ? null : utf->ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static int GetRotateIdx(RotateMode mode) => mode switch
|
||||||
|
{
|
||||||
|
RotateMode.Forward => 1,
|
||||||
|
RotateMode.Reverse => -1,
|
||||||
|
_ => 0,
|
||||||
|
};
|
||||||
|
|
||||||
internal static int RotateLinkshellHistory(RotateMode mode)
|
internal static int RotateLinkshellHistory(RotateMode mode)
|
||||||
{
|
{
|
||||||
var uiModule = UIModule.Instance();
|
var uiModule = UIModule.Instance();
|
||||||
if (mode == RotateMode.None)
|
if (mode == RotateMode.None)
|
||||||
uiModule->LinkshellCycle = -1;
|
uiModule->LinkshellCycle = -1;
|
||||||
|
|
||||||
return RotateLinkshellHistoryInternal(uiModule->RotateLinkshellHistory, mode);
|
return uiModule->RotateLinkshellHistory(GetRotateIdx(mode));
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static int RotateCrossLinkshellHistory(RotateMode mode) =>
|
internal static int RotateCrossLinkshellHistory(RotateMode mode) =>
|
||||||
RotateLinkshellHistoryInternal(UIModule.Instance()->RotateCrossLinkshellHistory, mode);
|
UIModule.Instance()->RotateCrossLinkshellHistory(GetRotateIdx(mode));
|
||||||
|
|
||||||
private static int RotateLinkshellHistoryInternal(Func<int, int> func, RotateMode mode)
|
|
||||||
{
|
|
||||||
var idx = mode switch
|
|
||||||
{
|
|
||||||
RotateMode.Forward => 1,
|
|
||||||
RotateMode.Reverse => -1,
|
|
||||||
_ => 0,
|
|
||||||
};
|
|
||||||
|
|
||||||
return func(idx);
|
|
||||||
}
|
|
||||||
|
|
||||||
// This function looks up a channel's user-defined color.
|
// This function looks up a channel's user-defined color.
|
||||||
// If this function ever returns 0, it returns null instead.
|
// If this function ever returns 0, it returns null instead.
|
||||||
|
|||||||
@@ -188,7 +188,6 @@ public sealed class ChatLogWindow : Window
|
|||||||
}
|
}
|
||||||
|
|
||||||
var mode = prevTemp == null ? RotateMode.None : info.Rotate;
|
var mode = prevTemp == null ? RotateMode.None : info.Rotate;
|
||||||
|
|
||||||
if (info.Channel is InputChannel.Linkshell1 && info.Rotate != RotateMode.None)
|
if (info.Channel is InputChannel.Linkshell1 && info.Rotate != RotateMode.None)
|
||||||
{
|
{
|
||||||
var idx = GameFunctions.Chat.RotateLinkshellHistory(mode);
|
var idx = GameFunctions.Chat.RotateLinkshellHistory(mode);
|
||||||
@@ -692,15 +691,14 @@ public sealed class ChatLogWindow : Window
|
|||||||
var push = inputColour != null;
|
var push = inputColour != null;
|
||||||
using (ImRaii.PushColor(ImGuiCol.Text, push ? ColourUtil.RgbaToAbgr(inputColour!.Value) : 0, push))
|
using (ImRaii.PushColor(ImGuiCol.Text, push ? ColourUtil.RgbaToAbgr(inputColour!.Value) : 0, push))
|
||||||
{
|
{
|
||||||
if (Activate || FocusedPreview)
|
var isChatEnabled = activeTab is { InputDisabled: false };
|
||||||
|
if (isChatEnabled && (Activate || FocusedPreview))
|
||||||
{
|
{
|
||||||
FocusedPreview = false;
|
FocusedPreview = false;
|
||||||
ImGui.SetKeyboardFocusHere();
|
ImGui.SetKeyboardFocusHere();
|
||||||
}
|
}
|
||||||
|
|
||||||
var chatCopy = Chat;
|
var chatCopy = Chat;
|
||||||
|
|
||||||
var isChatEnabled = activeTab is { InputDisabled: false };
|
|
||||||
using (ImRaii.Disabled(!isChatEnabled))
|
using (ImRaii.Disabled(!isChatEnabled))
|
||||||
{
|
{
|
||||||
var flags = InputFlags | (!isChatEnabled ? ImGuiInputTextFlags.ReadOnly : ImGuiInputTextFlags.None);
|
var flags = InputFlags | (!isChatEnabled ? ImGuiInputTextFlags.ReadOnly : ImGuiInputTextFlags.None);
|
||||||
|
|||||||
Reference in New Issue
Block a user