fix some shit, add triangle count

This commit is contained in:
rootdarkarchon
2024-03-20 15:12:19 +01:00
parent f62e8675e7
commit 1d99102c73
22 changed files with 196 additions and 46 deletions

View File

@@ -242,8 +242,14 @@ public class DrawUserPair
if (_pair.LastAppliedDataSize >= 0)
{
userPairText += UiSharedService.TooltipSeparator + (!_pair.IsVisible ? "(Last) " : string.Empty) +
"Loaded Mods Size: " + UiSharedService.ByteToString(_pair.LastAppliedDataSize, true);
userPairText += UiSharedService.TooltipSeparator;
userPairText += ((!_pair.IsPaired) ? "(Last) " : string.Empty) + "Mods Info" + Environment.NewLine;
userPairText += "Files Size: " + UiSharedService.ByteToString(_pair.LastAppliedDataSize, true);
if (_pair.LastAppliedDataTris >= 0)
{
userPairText += Environment.NewLine + "Triangle Count (excl. Vanilla): "
+ (_pair.LastAppliedDataTris > 1000 ? (_pair.LastAppliedDataTris / 1000d).ToString("0.0'k'") : _pair.LastAppliedDataTris);
}
}
if (_syncedGroups.Any())

View File

@@ -11,15 +11,13 @@ namespace MareSynchronos.UI.Components.Popup;
public class BanUserPopupHandler : IPopupHandler
{
private readonly ApiController _apiController;
private readonly UiSharedService _uiSharedService;
private string _banReason = string.Empty;
private GroupFullInfoDto _group = null!;
private Pair _reportedPair = null!;
public BanUserPopupHandler(ApiController apiController, UiSharedService uiSharedService)
public BanUserPopupHandler(ApiController apiController)
{
_apiController = apiController;
_uiSharedService = uiSharedService;
}
public Vector2 PopupSize => new(500, 250);

View File

@@ -13,11 +13,10 @@ public class PopupHandler : WindowMediatorSubscriberBase
{
protected bool _openPopup = false;
private readonly HashSet<IPopupHandler> _handlers;
private readonly UiSharedService _uiSharedService;
private IPopupHandler? _currentHandler = null;
public PopupHandler(ILogger<PopupHandler> logger, MareMediator mediator, IEnumerable<IPopupHandler> popupHandlers, PerformanceCollectorService performanceCollectorService,
UiSharedService uiSharedService)
public PopupHandler(ILogger<PopupHandler> logger, MareMediator mediator, IEnumerable<IPopupHandler> popupHandlers,
PerformanceCollectorService performanceCollectorService)
: base(logger, mediator, "MarePopupHandler", performanceCollectorService)
{
Flags = ImGuiWindowFlags.NoBringToFrontOnFocus
@@ -54,7 +53,6 @@ public class PopupHandler : WindowMediatorSubscriberBase
_currentHandler = _handlers.OfType<CensusPopupHandler>().Single();
IsOpen = true;
});
_uiSharedService = uiSharedService;
}
protected override void DrawInternal()

View File

@@ -14,7 +14,6 @@ public class SelectTagForPairUi
{
private readonly TagHandler _tagHandler;
private readonly IdDisplayHandler _uidDisplayHandler;
private readonly UiSharedService _uiSharedService;
/// <summary>
/// The group UI is always open for a specific pair. This defines which pair the UI is open for.
@@ -32,13 +31,12 @@ public class SelectTagForPairUi
/// </summary>
private string _tagNameToAdd = "";
public SelectTagForPairUi(TagHandler tagHandler, IdDisplayHandler uidDisplayHandler, UiSharedService uiSharedService)
public SelectTagForPairUi(TagHandler tagHandler, IdDisplayHandler uidDisplayHandler)
{
_show = false;
_pair = null;
_tagHandler = tagHandler;
_uidDisplayHandler = uidDisplayHandler;
_uiSharedService = uiSharedService;
}
public void Draw()

View File

@@ -161,7 +161,7 @@ public class DataAnalysisUi : WindowMediatorSubscriberBase
ImGui.TextUnformatted("Total size (compressed):");
ImGui.SameLine();
ImGui.TextUnformatted(UiSharedService.ByteToString(_cachedAnalysis!.Sum(c => c.Value.Sum(c => c.Value.CompressedSize))));
ImGui.TextUnformatted($"Total modded model triangles: {_cachedAnalysis.Sum(c => c.Value.Sum(f => f.Value.Triangles))}");
ImGui.Separator();
using var tabbar = ImRaii.TabBar("objectSelection");
@@ -198,6 +198,7 @@ public class DataAnalysisUi : WindowMediatorSubscriberBase
ImGui.TextUnformatted($"{kvp.Key} size (compressed):");
ImGui.SameLine();
ImGui.TextUnformatted(UiSharedService.ByteToString(kvp.Value.Sum(c => c.Value.CompressedSize)));
ImGui.TextUnformatted($"{kvp.Key} modded model triangles: {kvp.Value.Sum(f => f.Value.Triangles)}");
ImGui.Separator();
if (_selectedObjectTab != kvp.Key)
@@ -337,8 +338,10 @@ public class DataAnalysisUi : WindowMediatorSubscriberBase
private void DrawTable(IGrouping<string, CharacterAnalyzer.FileDataEntry> fileGroup)
{
using var table = ImRaii.Table("Analysis", string.Equals(fileGroup.Key, "tex", StringComparison.Ordinal) ?
(_enableBc7ConversionMode ? 7 : 6) : 5, ImGuiTableFlags.Sortable | ImGuiTableFlags.RowBg | ImGuiTableFlags.ScrollY | ImGuiTableFlags.SizingFixedFit,
var tableColumns = string.Equals(fileGroup.Key, "tex", StringComparison.Ordinal)
? (_enableBc7ConversionMode ? 7 : 6)
: (string.Equals(fileGroup.Key, "mdl", StringComparison.Ordinal) ? 6 : 5);
using var table = ImRaii.Table("Analysis", tableColumns, ImGuiTableFlags.Sortable | ImGuiTableFlags.RowBg | ImGuiTableFlags.ScrollY | ImGuiTableFlags.SizingFixedFit,
new Vector2(0, 300));
if (!table.Success) return;
ImGui.TableSetupColumn("Hash");
@@ -351,6 +354,10 @@ public class DataAnalysisUi : WindowMediatorSubscriberBase
ImGui.TableSetupColumn("Format");
if (_enableBc7ConversionMode) ImGui.TableSetupColumn("Convert to BC7");
}
if (string.Equals(fileGroup.Key, "mdl", StringComparison.Ordinal))
{
ImGui.TableSetupColumn("Triangles");
}
ImGui.TableSetupScrollFreeze(0, 1);
ImGui.TableHeadersRow();
@@ -444,6 +451,12 @@ public class DataAnalysisUi : WindowMediatorSubscriberBase
}
}
}
if (string.Equals(fileGroup.Key, "mdl", StringComparison.Ordinal))
{
ImGui.TableNextColumn();
ImGui.TextUnformatted(item.Triangles.ToString());
if (ImGui.IsItemClicked()) _selectedHash = item.Hash;
}
}
}
}

View File

@@ -12,7 +12,6 @@ namespace MareSynchronos.UI;
public class GposeUi : WindowMediatorSubscriberBase
{
private readonly MareConfigService _configService;
private readonly UiSharedService _uiSharedService;
private readonly DalamudUtilService _dalamudUtil;
private readonly FileDialogManager _fileDialogManager;
private readonly MareCharaFileManager _mareCharaFileManager;
@@ -21,15 +20,13 @@ public class GposeUi : WindowMediatorSubscriberBase
public GposeUi(ILogger<GposeUi> logger, MareCharaFileManager mareCharaFileManager,
DalamudUtilService dalamudUtil, FileDialogManager fileDialogManager, MareConfigService configService,
MareMediator mediator, PerformanceCollectorService performanceCollectorService,
UiSharedService uiSharedService)
MareMediator mediator, PerformanceCollectorService performanceCollectorService)
: base(logger, mediator, "Mare Synchronos Gpose Import UI###MareSynchronosGposeUI", performanceCollectorService)
{
_mareCharaFileManager = mareCharaFileManager;
_dalamudUtil = dalamudUtil;
_fileDialogManager = fileDialogManager;
_configService = configService;
_uiSharedService = uiSharedService;
Mediator.Subscribe<GposeStartMessage>(this, (_) => StartGpose());
Mediator.Subscribe<GposeEndMessage>(this, (_) => EndGpose());
IsOpen = _dalamudUtil.IsInGpose;