Merge branch '2.0.0' of https://git.lightless-sync.org/Lightless-Sync/LightlessClient into 2.0.0
This commit is contained in:
@@ -374,6 +374,7 @@ internal sealed class PairHandlerAdapter : DisposableMediatorSubscriberBase, IPa
|
|||||||
{
|
{
|
||||||
_needsCollectionRebuild = true;
|
_needsCollectionRebuild = true;
|
||||||
_forceFullReapply = true;
|
_forceFullReapply = true;
|
||||||
|
_forceApplyMods = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!releaseFromPenumbra || toRelease == Guid.Empty || !_ipcManager.Penumbra.APIAvailable)
|
if (!releaseFromPenumbra || toRelease == Guid.Empty || !_ipcManager.Penumbra.APIAvailable)
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -28,8 +28,10 @@ using LightlessSync.WebAPI;
|
|||||||
using LightlessSync.WebAPI.SignalR;
|
using LightlessSync.WebAPI.SignalR;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.IdentityModel.Tokens.Jwt;
|
using System.IdentityModel.Tokens.Jwt;
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
@@ -191,6 +193,99 @@ public partial class UiSharedService : DisposableMediatorSubscriberBase
|
|||||||
return addSuffix ? $"{dblSByte:0.00} {suffix[i]}" : $"{dblSByte:0.00}";
|
return addSuffix ? $"{dblSByte:0.00} {suffix[i]}" : $"{dblSByte:0.00}";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public readonly struct TabOption<T>
|
||||||
|
{
|
||||||
|
public string Label { get; }
|
||||||
|
public T Value { get; }
|
||||||
|
public bool Enabled { get; }
|
||||||
|
|
||||||
|
public TabOption(string label, T value, bool enabled = true)
|
||||||
|
{
|
||||||
|
Label = label;
|
||||||
|
Value = value;
|
||||||
|
Enabled = enabled;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool Tab<T>(string id, IReadOnlyList<TabOption<T>> options, ref T selectedValue) where T : struct
|
||||||
|
{
|
||||||
|
if (options.Count == 0)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
var pushIdValue = string.IsNullOrEmpty(id)
|
||||||
|
? $"UiSharedTab_{RuntimeHelpers.GetHashCode(options):X}"
|
||||||
|
: id;
|
||||||
|
using var tabId = ImRaii.PushId(pushIdValue);
|
||||||
|
|
||||||
|
var selectedIndex = -1;
|
||||||
|
for (var i = 0; i < options.Count; i++)
|
||||||
|
{
|
||||||
|
if (!EqualityComparer<T>.Default.Equals(options[i].Value, selectedValue))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
selectedIndex = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (selectedIndex == -1 || !options[selectedIndex].Enabled)
|
||||||
|
selectedIndex = GetFirstEnabledTabIndex(options);
|
||||||
|
|
||||||
|
if (selectedIndex == -1)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
var changed = DrawTabsInternal(options, ref selectedIndex);
|
||||||
|
selectedValue = options[Math.Clamp(selectedIndex, 0, options.Count - 1)].Value;
|
||||||
|
return changed;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static int GetFirstEnabledTabIndex<T>(IReadOnlyList<TabOption<T>> options)
|
||||||
|
{
|
||||||
|
for (var i = 0; i < options.Count; i++)
|
||||||
|
{
|
||||||
|
if (options[i].Enabled)
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static bool DrawTabsInternal<T>(IReadOnlyList<TabOption<T>> options, ref int selectedIndex)
|
||||||
|
{
|
||||||
|
selectedIndex = Math.Clamp(selectedIndex, 0, Math.Max(0, options.Count - 1));
|
||||||
|
|
||||||
|
var style = ImGui.GetStyle();
|
||||||
|
var availableWidth = ImGui.GetContentRegionAvail().X;
|
||||||
|
var spacingX = style.ItemSpacing.X;
|
||||||
|
var buttonWidth = options.Count > 0 ? Math.Max(1f, (availableWidth - spacingX * (options.Count - 1)) / options.Count) : availableWidth;
|
||||||
|
var buttonHeight = Math.Max(ImGui.GetFrameHeight() + style.FramePadding.Y, 28f * ImGuiHelpers.GlobalScale);
|
||||||
|
var changed = false;
|
||||||
|
|
||||||
|
for (var i = 0; i < options.Count; i++)
|
||||||
|
{
|
||||||
|
if (i > 0)
|
||||||
|
ImGui.SameLine();
|
||||||
|
|
||||||
|
var tab = options[i];
|
||||||
|
var isSelected = i == selectedIndex;
|
||||||
|
|
||||||
|
using (ImRaii.Disabled(!tab.Enabled))
|
||||||
|
{
|
||||||
|
using var tabIndexId = ImRaii.PushId(i);
|
||||||
|
using var selectedButton = isSelected ? ImRaii.PushColor(ImGuiCol.Button, style.Colors[(int)ImGuiCol.TabActive]) : null;
|
||||||
|
using var selectedHover = isSelected ? ImRaii.PushColor(ImGuiCol.ButtonHovered, style.Colors[(int)ImGuiCol.TabHovered]) : null;
|
||||||
|
using var selectedActive = isSelected ? ImRaii.PushColor(ImGuiCol.ButtonActive, style.Colors[(int)ImGuiCol.TabActive]) : null;
|
||||||
|
|
||||||
|
if (ImGui.Button(tab.Label, new Vector2(buttonWidth, buttonHeight)))
|
||||||
|
{
|
||||||
|
selectedIndex = i;
|
||||||
|
changed = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return changed;
|
||||||
|
}
|
||||||
|
|
||||||
public static void CenterNextWindow(float width, float height, ImGuiCond cond = ImGuiCond.None)
|
public static void CenterNextWindow(float width, float height, ImGuiCond cond = ImGuiCond.None)
|
||||||
{
|
{
|
||||||
var center = ImGui.GetMainViewport().GetCenter();
|
var center = ImGui.GetMainViewport().GetCenter();
|
||||||
|
|||||||
@@ -1153,7 +1153,7 @@ public sealed class ZoneChatUi : WindowMediatorSubscriberBase
|
|||||||
}
|
}
|
||||||
if (ImGui.IsItemHovered())
|
if (ImGui.IsItemHovered())
|
||||||
{
|
{
|
||||||
ImGui.SetTooltip("Adjusts the scale of chat message text.\nRight-click to reset.");
|
ImGui.SetTooltip("Adjust scale of chat message text.\nRight-click to reset to default.");
|
||||||
}
|
}
|
||||||
|
|
||||||
var windowOpacity = Math.Clamp(chatConfig.ChatWindowOpacity, MinWindowOpacity, MaxWindowOpacity);
|
var windowOpacity = Math.Clamp(chatConfig.ChatWindowOpacity, MinWindowOpacity, MaxWindowOpacity);
|
||||||
@@ -1173,7 +1173,7 @@ public sealed class ZoneChatUi : WindowMediatorSubscriberBase
|
|||||||
|
|
||||||
if (ImGui.IsItemHovered())
|
if (ImGui.IsItemHovered())
|
||||||
{
|
{
|
||||||
ImGui.SetTooltip("Adjust transparency of the chat window.\nRight-click to reset to default.");
|
ImGui.SetTooltip("Adjust chat window transparency.\nRight-click to reset to default.");
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui.EndPopup();
|
ImGui.EndPopup();
|
||||||
|
|||||||
Reference in New Issue
Block a user