From 2b8db843a18b89593287b4fa32676a5f54e405d6 Mon Sep 17 00:00:00 2001 From: RisaDev <151885272+RisaDev@users.noreply.github.com> Date: Mon, 8 Jan 2024 05:31:25 +0300 Subject: [PATCH] Some changes to incognito for debug stuff --- .../Extensions/ActorIdentifierExtensions.cs | 10 +++--- .../Core/Extensions/StringExtensions.cs | 6 ++-- CustomizePlus/CustomizePlus.csproj | 8 +++++ .../Tabs/Debug/StateMonitoringTab.cs | 32 +++++++++++++++---- 4 files changed, 42 insertions(+), 14 deletions(-) diff --git a/CustomizePlus.GameData/Extensions/ActorIdentifierExtensions.cs b/CustomizePlus.GameData/Extensions/ActorIdentifierExtensions.cs index 38b2ad5..4b66e1a 100644 --- a/CustomizePlus.GameData/Extensions/ActorIdentifierExtensions.cs +++ b/CustomizePlus.GameData/Extensions/ActorIdentifierExtensions.cs @@ -13,10 +13,10 @@ public static class ActorIdentifierExtensions /// public static string ToNameWithoutOwnerName(this ActorIdentifier identifier) { - if (identifier == ActorIdentifier.Invalid) + if (!identifier.IsValid) return "Invalid"; - if (!identifier.IsValid || identifier.Type != IdentifierType.Owned) + if (identifier.Type != IdentifierType.Owned) return identifier.ToName(); if (ActorIdentifier.Manager == null) @@ -32,12 +32,12 @@ public static class ActorIdentifierExtensions /// public static string IncognitoDebug(this ActorIdentifier identifier) { - if (identifier == ActorIdentifier.Invalid) + if (!identifier.IsValid) return "Invalid"; try { -#if DEBUG +#if !INCOGNIFY_STRINGS return identifier.ToString(); #else return identifier.Incognito(null); @@ -60,7 +60,7 @@ public static class ActorIdentifierExtensions /// public static bool IsAllowedForProfiles(this ActorIdentifier identifier) { - if (identifier == ActorIdentifier.Invalid) + if (!identifier.IsValid) return false; switch (identifier.Type) diff --git a/CustomizePlus/Core/Extensions/StringExtensions.cs b/CustomizePlus/Core/Extensions/StringExtensions.cs index 9513052..c77a3fb 100644 --- a/CustomizePlus/Core/Extensions/StringExtensions.cs +++ b/CustomizePlus/Core/Extensions/StringExtensions.cs @@ -12,7 +12,7 @@ namespace CustomizePlus.Core.Extensions if (str.IsNullOrWhitespace()) return str; -#if DEBUG +#if !INCOGNIFY_STRINGS return str; #endif @@ -21,12 +21,12 @@ namespace CustomizePlus.Core.Extensions var split = str.Split(' '); if (split.Length > 2) - return $"{str[..2]}..."; + return $"{str[..5]}..."; return $"{split[0][0]}.{split[1][0]}"; } - return $"{str[..2]}..."; + return $"{str[..5]}..."; } } } diff --git a/CustomizePlus/CustomizePlus.csproj b/CustomizePlus/CustomizePlus.csproj index bcdfb5d..d0b51e1 100644 --- a/CustomizePlus/CustomizePlus.csproj +++ b/CustomizePlus/CustomizePlus.csproj @@ -88,4 +88,12 @@ PreserveNewest + + + + + INCOGNIFY_STRINGS + diff --git a/CustomizePlus/UI/Windows/MainWindow/Tabs/Debug/StateMonitoringTab.cs b/CustomizePlus/UI/Windows/MainWindow/Tabs/Debug/StateMonitoringTab.cs index 806b93f..ba5efcf 100644 --- a/CustomizePlus/UI/Windows/MainWindow/Tabs/Debug/StateMonitoringTab.cs +++ b/CustomizePlus/UI/Windows/MainWindow/Tabs/Debug/StateMonitoringTab.cs @@ -9,6 +9,8 @@ using CustomizePlus.Profiles.Data; using CustomizePlus.Templates.Data; using CustomizePlus.GameData.Extensions; using CustomizePlus.GameData.Services; +using CustomizePlus.Core.Extensions; +using System.Numerics; namespace CustomizePlus.UI.Windows.MainWindow.Tabs.Debug; @@ -124,7 +126,15 @@ public class StateMonitoringTab private void DrawSingleProfile(string prefix, Profile profile) { - var show = ImGui.CollapsingHeader($"[{(profile.Enabled ? "E" : "D")}] {profile.Name} on {profile.CharacterName} [{(profile.IsTemporary ? "Temporary" : "Permanent")}]###{prefix}-profile-{profile.UniqueId}"); + string name = profile.Name; + string characterName = profile.CharacterName; + +#if INCOGNIFY_STRINGS + name = name.Incognify(); + characterName = characterName.Incognify(); +#endif + + var show = ImGui.CollapsingHeader($"[{(profile.Enabled ? "E" : "D")}] {name} on {characterName} [{(profile.IsTemporary ? "Temporary" : "Permanent")}] [{profile.UniqueId}]###{prefix}-profile-{profile.UniqueId}"); if (!show) return; @@ -152,7 +162,13 @@ public class StateMonitoringTab private void DrawSingleTemplate(string prefix, Template template) { - var show = ImGui.CollapsingHeader($"{template.Name}###{prefix}-template-{template.UniqueId}"); + string name = template.Name; + +#if INCOGNIFY_STRINGS + name = name.Incognify(); +#endif + + var show = ImGui.CollapsingHeader($"{name} [{template.UniqueId}]###{prefix}-template-{template.UniqueId}"); if (!show) return; @@ -162,7 +178,11 @@ public class StateMonitoringTab ImGui.Text($"Bones:"); foreach (var kvPair in template.Bones) { - ImGui.Text($"{kvPair.Key}: p:{kvPair.Value.Translation} | r: {kvPair.Value.Rotation} | s: {kvPair.Value.Scaling}"); +#if !INCOGNIFY_STRINGS + ImGui.Text($"{kvPair.Key}: p: {kvPair.Value.Translation} | r: {kvPair.Value.Rotation} | s: {kvPair.Value.Scaling}"); +#else + ImGui.Text($"{kvPair.Key}: p: {(kvPair.Value.Translation.IsApproximately(Vector3.Zero) ? "Approx. not changed" : "Changed")} | r: {(kvPair.Value.Rotation.IsApproximately(Vector3.Zero) ? "Approx. not changed" : "Changed")} | s: {(kvPair.Value.Scaling.IsApproximately(Vector3.One) ? "Not changed" : "Changed")}"); +#endif } } @@ -180,8 +200,8 @@ public class StateMonitoringTab ImGui.Text($"Root bone: {armature.MainRootBone}"); } - ImGui.Text($"Profile: {armature.Profile.Name} ({armature.Profile.UniqueId})"); - ImGui.Text($"Actor: {armature.ActorIdentifier}"); + ImGui.Text($"Profile: {armature.Profile.Name.Text.Incognify()} ({armature.Profile.UniqueId})"); + ImGui.Text($"Actor: {armature.ActorIdentifier.IncognitoDebug()}"); ImGui.Text($"Protection: {(armature.ProtectedUntil >= DateTime.UtcNow ? "Active" : "NOT active")} [{armature.ProtectedUntil} (UTC)]"); //ImGui.Text("Profile:"); //DrawSingleProfile($"armature-{armature.GetHashCode()}", armature.Profile); @@ -189,7 +209,7 @@ public class StateMonitoringTab ImGui.Text($"Bone template bindings:"); foreach (var kvPair in armature.BoneTemplateBinding) { - ImGui.Text($"{kvPair.Key} -> {kvPair.Value.Name} ({kvPair.Value.UniqueId})"); + ImGui.Text($"{kvPair.Key} -> {kvPair.Value.Name.Text.Incognify()} ({kvPair.Value.UniqueId})"); } } }