Skip to content

Commit c522ef1

Browse files
committed
3.0.4
1 parent 225af45 commit c522ef1

11 files changed

Lines changed: 202 additions & 51 deletions

Snowcloak/Snowcloak.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<Project Sdk="Dalamud.NET.Sdk/15.0.0">
33
<PropertyGroup>
44
<AssemblyName>Snowcloak</AssemblyName>
5-
<Version>3.0.3.0</Version>
5+
<Version>3.0.4.0</Version>
66
<PackageProjectUrl>https://github.com/Eauldane/SnowcloakClient/</PackageProjectUrl>
77
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
88
<Configurations>Release;Debug</Configurations>
@@ -18,7 +18,7 @@
1818
<ItemGroup>
1919
<PackageReference Include="Blake3" Version="2.2.1" />
2020
<PackageReference Include="Brio.API" Version="3.0.1" />
21-
<PackageReference Include="ElezenTools" Version="15.5.5" />
21+
<PackageReference Include="ElezenTools" Version="15.5.6" />
2222
<PackageReference Include="ElezenTools.Core" Version="15.5.5" />
2323
<PackageReference Include="Glamourer.Api" Version="2.8.2" />
2424
<PackageReference Include="K4os.Compression.LZ4.Legacy" Version="1.3.8" />

Snowcloak/UI/CompactUI.Sidebar.cs

Lines changed: 117 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,23 @@ namespace Snowcloak.UI;
3636

3737
public partial class CompactUi
3838
{
39-
private const float ExpandedSidebarWidth = ModernSidebar.ExpandedWidth;
39+
private const float ExpandedSidebarWidth = ModernSidebar.ExpandedWidth - 15f;
4040
private const float CollapsedSidebarWidth = 28f;
4141
private const float CollapseToggleRowHeight = 26f;
42+
private const float SidebarItemSpacingY = 4f;
43+
private const float SidebarSeparatorHeight = 9f;
44+
private const float SidebarTopGap = 4f;
45+
private const float CollapsedSidebarPaddingX = 4f;
46+
private const float CollapsedSidebarButtonHeight = 26f;
4247

43-
private static void DrawSidebarSeparator() => ModernSidebar.DrawSeparator();
48+
private static void DrawSidebarSeparator()
49+
{
50+
var scale = ImGuiHelpers.GlobalScale;
51+
var start = ImGui.GetCursorScreenPos() + new Vector2(8f * scale, 4f * scale);
52+
var end = start with { X = start.X + ImGui.GetContentRegionAvail().X - 16f * scale };
53+
ImGui.GetWindowDrawList().AddLine(start, end, Colour.Vector4ToColour(SnowcloakColours.CompactBorderSubtle), 1f * scale);
54+
ImGui.Dummy(new Vector2(1f, SidebarSeparatorHeight * scale));
55+
}
4456

4557
private void DrawSidebarButton(Menu menu, FontAwesomeIcon icon, string label)
4658
{
@@ -75,7 +87,10 @@ private void DrawSidebar()
7587
var sidebarWidth = (collapsed ? CollapsedSidebarWidth : ExpandedSidebarWidth) * ImGuiHelpers.GlobalScale;
7688

7789
using var childBg = ImRaii.PushColor(ImGuiCol.ChildBg, SnowcloakColours.CompactPanel);
78-
using var childPadding = ImRaii.PushStyle(ImGuiStyleVar.WindowPadding, new Vector2(14f, 12f) * ImGuiHelpers.GlobalScale);
90+
var childPaddingValue = collapsed
91+
? new Vector2(CollapsedSidebarPaddingX, 12f)
92+
: new Vector2(14f, 12f);
93+
using var childPadding = ImRaii.PushStyle(ImGuiStyleVar.WindowPadding, childPaddingValue * ImGuiHelpers.GlobalScale);
7994
using (var child = ImRaii.Child("Sidebar", new Vector2(sidebarWidth, -1), false))
8095
{
8196
if (collapsed)
@@ -85,8 +100,8 @@ private void DrawSidebar()
85100
}
86101

87102
using var sidebarPadding = ImRaii.PushStyle(ImGuiStyleVar.FramePadding, new Vector2(10f, 9f) * ImGuiHelpers.GlobalScale);
88-
using var sidebarSpacing = ImRaii.PushStyle(ImGuiStyleVar.ItemSpacing, new Vector2(ImGui.GetStyle().ItemSpacing.X, 8f * ImGuiHelpers.GlobalScale));
89-
ImGuiHelpers.ScaledDummy(9);
103+
using var sidebarSpacing = ImRaii.PushStyle(ImGuiStyleVar.ItemSpacing, new Vector2(ImGui.GetStyle().ItemSpacing.X, SidebarItemSpacingY * ImGuiHelpers.GlobalScale));
104+
ImGuiHelpers.ScaledDummy(SidebarTopGap);
90105

91106
// Buttons with state change
92107
DrawSidebarButton(Menu.IndividualPairs, FontAwesomeIcon.User, "Direct Pairs");
@@ -143,6 +158,42 @@ private void DrawSidebar()
143158

144159
private void DrawCollapsedSidebar()
145160
{
161+
using var sidebarSpacing = ImRaii.PushStyle(ImGuiStyleVar.ItemSpacing, new Vector2(0f, SidebarItemSpacingY * ImGuiHelpers.GlobalScale));
162+
ImGuiHelpers.ScaledDummy(SidebarTopGap);
163+
164+
DrawCollapsedSidebarButton(Menu.IndividualPairs, FontAwesomeIcon.User, "Direct Pairs");
165+
DrawCollapsedSidebarButton(Menu.Syncshells, FontAwesomeIcon.PeopleGroup, "Syncshells");
166+
if (_configService.Current.ShowCompactUiPerformanceTab)
167+
{
168+
DrawCollapsedSidebarButton(Menu.Performance, FontAwesomeIcon.ChartBar, "Performance");
169+
}
170+
DrawCollapsedSidebarSeparator();
171+
if (_apiController.ServerState is ServerState.Connected)
172+
{
173+
DrawCollapsedSidebarButton(Menu.Frostbrand, FontAwesomeIcon.Snowflake, GetFrostbrandSidebarLabel());
174+
}
175+
DrawCollapsedSidebarSeparator();
176+
DrawCollapsedSidebarAction(FontAwesomeIcon.ChartBar, "Character Analysis",
177+
() => Mediator.Publish(new UiToggleMessage(typeof(DataAnalysisUi))));
178+
DrawCollapsedSidebarAction(FontAwesomeIcon.UserFriends, "Character Hub",
179+
() => Mediator.Publish(new UiToggleMessage(typeof(CharaDataHubUi))));
180+
DrawCollapsedSidebarAction(FontAwesomeIcon.MapMarkedAlt, "Venues",
181+
() => Mediator.Publish(new UiToggleMessage(typeof(VenueAdsWindow))));
182+
DrawCollapsedSidebarAction(FontAwesomeIcon.Comments, "Chat [BETA]",
183+
() => Mediator.Publish(new UiToggleMessage(typeof(ChatWindow))));
184+
DrawCollapsedSidebarAction(FontAwesomeIcon.Cog, "Settings",
185+
() => Mediator.Publish(new UiToggleMessage(typeof(SettingsUi))));
186+
DrawCollapsedSidebarSeparator();
187+
188+
if (_apiController.ServerState is ServerState.Connected)
189+
{
190+
DrawCollapsedSidebarAction(FontAwesomeIcon.UserCircle, "Edit Profile",
191+
() => Mediator.Publish(new UiToggleMessage(typeof(EditProfileUi))));
192+
}
193+
194+
DrawCollapsedSidebarAction(FontAwesomeIcon.Book, "User Guide",
195+
() => Util.OpenLink("https://docs.snowcloak-sync.com"));
196+
146197
var availableSpace = ImGui.GetContentRegionAvail().Y;
147198
var toggleHeight = CollapseToggleRowHeight * ImGuiHelpers.GlobalScale;
148199
if (availableSpace > toggleHeight)
@@ -153,6 +204,67 @@ private void DrawCollapsedSidebar()
153204
DrawSidebarCollapseToggle(collapsed: true);
154205
}
155206

207+
private static void DrawCollapsedSidebarSeparator()
208+
{
209+
var scale = ImGuiHelpers.GlobalScale;
210+
var min = ImGui.GetCursorScreenPos();
211+
var width = ImGui.GetContentRegionAvail().X;
212+
var y = min.Y + 4f * scale;
213+
ImGui.GetWindowDrawList().AddLine(new Vector2(min.X + 3f * scale, y), new Vector2(min.X + width - 3f * scale, y),
214+
Colour.Vector4ToColour(SnowcloakColours.CompactBorderSubtle), 1f * scale);
215+
ImGui.Dummy(new Vector2(1f, SidebarSeparatorHeight * scale));
216+
}
217+
218+
private void DrawCollapsedSidebarButton(Menu menu, FontAwesomeIcon icon, string label)
219+
{
220+
if (DrawCollapsedSidebarIcon(icon, label, _selectedMenu == menu))
221+
{
222+
_selectedMenu = menu;
223+
}
224+
}
225+
226+
private static void DrawCollapsedSidebarAction(FontAwesomeIcon icon, string label, Action onClick)
227+
{
228+
if (DrawCollapsedSidebarIcon(icon, label, active: false))
229+
{
230+
onClick();
231+
}
232+
}
233+
234+
private static bool DrawCollapsedSidebarIcon(FontAwesomeIcon icon, string tooltip, bool active)
235+
{
236+
var scale = ImGuiHelpers.GlobalScale;
237+
var width = ImGui.GetContentRegionAvail().X;
238+
var height = CollapsedSidebarButtonHeight * scale;
239+
var min = ImGui.GetCursorScreenPos();
240+
241+
ImGui.InvisibleButton($"##collapsed-sidebar-{tooltip}", new Vector2(width, height));
242+
var clicked = ImGui.IsItemClicked(ImGuiMouseButton.Left);
243+
var hovered = ImGui.IsItemHovered();
244+
var max = min + new Vector2(width, height);
245+
var drawList = ImGui.GetWindowDrawList();
246+
247+
if (active)
248+
{
249+
drawList.AddRectFilled(min, max, Colour.Vector4ToColour(new Vector4(SnowcloakUi.AccentColor.X, SnowcloakUi.AccentColor.Y, SnowcloakUi.AccentColor.Z, 0.24f)), 3f * scale);
250+
drawList.AddRectFilled(min, min + new Vector2(2f * scale, height), Colour.Vector4ToColour(SnowcloakUi.AccentColor), 0f);
251+
}
252+
else if (hovered)
253+
{
254+
drawList.AddRectFilled(min, max, Colour.Vector4ToColour(new Vector4(0.090f, 0.150f, 0.220f, 0.54f)), 3f * scale);
255+
}
256+
257+
var iconText = icon.ToIconString();
258+
ImGui.PushFont(UiBuilder.IconFont);
259+
var iconSize = ImGui.CalcTextSize(iconText);
260+
drawList.AddText(min + new Vector2((width - iconSize.X) * 0.5f, (height - iconSize.Y) * 0.5f),
261+
Colour.Vector4ToColour(active ? Vector4.One : SnowcloakColours.CompactTextMuted), iconText);
262+
ImGui.PopFont();
263+
264+
ElezenImgui.AttachTooltip(tooltip);
265+
return clicked;
266+
}
267+
156268
private void DrawSidebarCollapseToggle(bool collapsed)
157269
{
158270
var scale = ImGuiHelpers.GlobalScale;

Snowcloak/UI/CompactUI.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ public CompactUi(ILogger<CompactUi> logger, UiFontService fontService,
181181
}
182182
];
183183

184-
SetScaledSizeConstraints(new Vector2(560, 700), new Vector2(1200, 2000));
184+
SetScaledSizeConstraints(new Vector2(545, 640), new Vector2(1200, 2000));
185185
Size = new Vector2(860, 720);
186186
SizeCondition = ImGuiCond.FirstUseEver;
187187

Snowcloak/UI/Components/AnalysisBrowser.cs

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -208,16 +208,17 @@ private void DrawStatusAndStats(IAnalysisSource source, bool needAnalysis, bool
208208
var downloadSize = ElezenImgui.ByteToString(_cachedAnalysis.Files.Sum(f => f.CompressedSize));
209209
var triangles = ElezenImgui.TrisToString(totalTriangles);
210210

211-
var exceedsAutoPause = totalVramBytes > PerformanceBudgetPolicy.LegacyAutoBlockVramThresholdMiB * 1024L * 1024L
212-
|| totalTriangles > PerformanceBudgetPolicy.LegacyAutoBlockTrianglesThresholdThousands * 1000L;
211+
var exceedsVramAutoPause = ExceedsLegacyVramThreshold(totalVramBytes);
212+
var exceedsTrianglesAutoPause = ExceedsLegacyTrianglesThreshold(totalTriangles);
213+
var exceedsAutoPause = exceedsVramAutoPause || exceedsTrianglesAutoPause;
213214

214215
var cellSize = new Vector2(cellWidth, topHeight);
215216
DrawStatCell(new Vector2(tilesStart, origin.Y), cellSize, FontAwesomeIcon.FolderOpen, "Total files", totalFiles.ToString(CultureInfo.InvariantCulture), Vector4.One, false);
216217
DrawStatCell(new Vector2(tilesStart + cellWidth, origin.Y), cellSize, FontAwesomeIcon.Save, "Total size (actual)", actualSize, Vector4.One, false);
217218
DrawStatCell(new Vector2(tilesStart + cellWidth * 2f, origin.Y), cellSize, FontAwesomeIcon.Download, "Total size (download size)", downloadSize,
218219
needAnalysis ? ImGuiColors.DalamudYellow : Vector4.One, needAnalysis && !isAnalyzing);
219220
DrawStatCell(new Vector2(tilesStart + cellWidth * 3f, origin.Y), cellSize, FontAwesomeIcon.Cube, "Total modded triangles", triangles,
220-
exceedsAutoPause ? ImGuiColors.DalamudOrange : Vector4.One, false);
221+
exceedsTrianglesAutoPause ? ImGuiColors.DalamudOrange : Vector4.One, false);
221222

222223
ImGui.SetCursorScreenPos(new Vector2(origin.X, origin.Y + topHeight));
223224

@@ -439,7 +440,11 @@ private void DrawOverviewAndOptions(IReadOnlyDictionary<string, AnalysisFileEntr
439440
DrawPanelTitle(string.Format(CultureInfo.InvariantCulture, "{0} overview", kindLabel));
440441

441442
var vramGroup = groupedFiles.SingleOrDefault(v => string.Equals(v.Key, "tex", StringComparison.Ordinal));
442-
var vram = vramGroup != null ? ElezenImgui.ByteToString(vramGroup.Sum(f => f.OriginalSize)) : "-";
443+
var vramBytes = vramGroup?.Sum(f => f.OriginalSize) ?? 0;
444+
var vram = vramGroup != null ? ElezenImgui.ByteToString(vramBytes) : "-";
445+
var triangleCount = kindData.Sum(f => f.Value.Triangles);
446+
var vramColor = ExceedsLegacyVramThreshold(vramBytes) ? ImGuiColors.DalamudOrange : (Vector4?)null;
447+
var triangleColor = ExceedsLegacyTrianglesThreshold(triangleCount) ? ImGuiColors.DalamudOrange : (Vector4?)null;
443448

444449
using (ImRaii.Group())
445450
{
@@ -453,8 +458,8 @@ private void DrawOverviewAndOptions(IReadOnlyDictionary<string, AnalysisFileEntr
453458
ImGui.SameLine(0f, 40f * scale);
454459
using (ImRaii.Group())
455460
{
456-
DrawStat(kindLabel + " VRAM usage", vram);
457-
DrawStat(kindLabel + " modded model triangles", ElezenImgui.TrisToString(kindData.Sum(f => f.Value.Triangles)));
461+
DrawStat(kindLabel + " VRAM usage", vram, null, vramColor);
462+
DrawStat(kindLabel + " modded model triangles", ElezenImgui.TrisToString(triangleCount), null, triangleColor);
458463
}
459464
}
460465
}
@@ -675,6 +680,16 @@ private static void DrawPanelTitle(string title)
675680
ImGuiHelpers.ScaledDummy(new Vector2(0, 2));
676681
}
677682

683+
private static bool ExceedsLegacyVramThreshold(long vramBytes)
684+
{
685+
return vramBytes > PerformanceBudgetPolicy.LegacyAutoBlockVramThresholdMiB * 1024L * 1024L;
686+
}
687+
688+
private static bool ExceedsLegacyTrianglesThreshold(long triangleCount)
689+
{
690+
return triangleCount > PerformanceBudgetPolicy.LegacyAutoBlockTrianglesThresholdThousands * 1000L;
691+
}
692+
678693
private static void DrawStat(string label, string value, string? tooltip = null, Vector4? valueColor = null, bool warning = false)
679694
{
680695
ImGui.TextColored(SnowcloakColours.CompactTextMuted, label);

Snowcloak/UI/Components/FrostbrandPanel.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ public void Draw()
4949
using var itemSpacing = ImRaii.PushStyle(ImGuiStyleVar.ItemSpacing,
5050
new Vector2(ImGui.GetStyle().ItemSpacing.X, 7f * ImGuiHelpers.GlobalScale));
5151

52-
FrostbrandPanelChrome.DrawSectionTitle(FontAwesomeIcon.Snowflake, "Frostbrand Pairing");
5352
_enableFlow.Draw(state, _dispatcher);
5453

5554
if (state.PairingEnabled != _wasPairingEnabled)

Snowcloak/UI/Components/FrostbrandPendingRequestsView.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ public static void Draw(AvailabilityViewState state, IDispatcher dispatcher, str
1616
ArgumentNullException.ThrowIfNull(state);
1717
ArgumentNullException.ThrowIfNull(dispatcher);
1818

19-
FrostbrandPanelChrome.DrawSectionTitle(FontAwesomeIcon.UserPlus, "Pending pair requests");
2019
if (state.PendingRequestCount == 0)
2120
{
2221
DrawPendingEmptyState();
@@ -35,7 +34,7 @@ private static void DrawPendingEmptyState()
3534

3635
ImGuiHelpers.ScaledDummy(new Vector2(0, 22));
3736

38-
DrawCenteredBigIcon(FontAwesomeIcon.UserPlus, SnowcloakColours.CompactTextMuted, 2.0f);
37+
DrawCenteredBigIcon(FontAwesomeIcon.UserPlus, SnowcloakColours.CompactTextMuted, 1.6f);
3938
ImGuiHelpers.ScaledDummy(new Vector2(0, 12));
4039

4140
DrawCenteredLine("No pending pair requests right now.", Vector4.One, startX, fullWidth);

0 commit comments

Comments
 (0)