Some changes to incognito for debug stuff

This commit is contained in:
RisaDev
2024-01-08 05:31:25 +03:00
parent 33b51b1756
commit 2b8db843a1
4 changed files with 42 additions and 14 deletions

View File

@@ -13,10 +13,10 @@ public static class ActorIdentifierExtensions
/// <exception cref="Exception"></exception> /// <exception cref="Exception"></exception>
public static string ToNameWithoutOwnerName(this ActorIdentifier identifier) public static string ToNameWithoutOwnerName(this ActorIdentifier identifier)
{ {
if (identifier == ActorIdentifier.Invalid) if (!identifier.IsValid)
return "Invalid"; return "Invalid";
if (!identifier.IsValid || identifier.Type != IdentifierType.Owned) if (identifier.Type != IdentifierType.Owned)
return identifier.ToName(); return identifier.ToName();
if (ActorIdentifier.Manager == null) if (ActorIdentifier.Manager == null)
@@ -32,12 +32,12 @@ public static class ActorIdentifierExtensions
/// <returns></returns> /// <returns></returns>
public static string IncognitoDebug(this ActorIdentifier identifier) public static string IncognitoDebug(this ActorIdentifier identifier)
{ {
if (identifier == ActorIdentifier.Invalid) if (!identifier.IsValid)
return "Invalid"; return "Invalid";
try try
{ {
#if DEBUG #if !INCOGNIFY_STRINGS
return identifier.ToString(); return identifier.ToString();
#else #else
return identifier.Incognito(null); return identifier.Incognito(null);
@@ -60,7 +60,7 @@ public static class ActorIdentifierExtensions
/// <returns></returns> /// <returns></returns>
public static bool IsAllowedForProfiles(this ActorIdentifier identifier) public static bool IsAllowedForProfiles(this ActorIdentifier identifier)
{ {
if (identifier == ActorIdentifier.Invalid) if (!identifier.IsValid)
return false; return false;
switch (identifier.Type) switch (identifier.Type)

View File

@@ -12,7 +12,7 @@ namespace CustomizePlus.Core.Extensions
if (str.IsNullOrWhitespace()) if (str.IsNullOrWhitespace())
return str; return str;
#if DEBUG #if !INCOGNIFY_STRINGS
return str; return str;
#endif #endif
@@ -21,12 +21,12 @@ namespace CustomizePlus.Core.Extensions
var split = str.Split(' '); var split = str.Split(' ');
if (split.Length > 2) if (split.Length > 2)
return $"{str[..2]}..."; return $"{str[..5]}...";
return $"{split[0][0]}.{split[1][0]}"; return $"{split[0][0]}.{split[1][0]}";
} }
return $"{str[..2]}..."; return $"{str[..5]}...";
} }
} }
} }

View File

@@ -88,4 +88,12 @@
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None> </None>
</ItemGroup> </ItemGroup>
<!-- <PropertyGroup Condition="'$(Configuration)'=='Debug'">
<DefineConstants>INCOGNIFY_STRINGS</DefineConstants>
</PropertyGroup>-->
<PropertyGroup Condition="'$(Configuration)'=='Release'">
<DefineConstants>INCOGNIFY_STRINGS</DefineConstants>
</PropertyGroup>
</Project> </Project>

View File

@@ -9,6 +9,8 @@ using CustomizePlus.Profiles.Data;
using CustomizePlus.Templates.Data; using CustomizePlus.Templates.Data;
using CustomizePlus.GameData.Extensions; using CustomizePlus.GameData.Extensions;
using CustomizePlus.GameData.Services; using CustomizePlus.GameData.Services;
using CustomizePlus.Core.Extensions;
using System.Numerics;
namespace CustomizePlus.UI.Windows.MainWindow.Tabs.Debug; namespace CustomizePlus.UI.Windows.MainWindow.Tabs.Debug;
@@ -124,7 +126,15 @@ public class StateMonitoringTab
private void DrawSingleProfile(string prefix, Profile profile) 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) if (!show)
return; return;
@@ -152,7 +162,13 @@ public class StateMonitoringTab
private void DrawSingleTemplate(string prefix, Template template) 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) if (!show)
return; return;
@@ -162,7 +178,11 @@ public class StateMonitoringTab
ImGui.Text($"Bones:"); ImGui.Text($"Bones:");
foreach (var kvPair in template.Bones) foreach (var kvPair in template.Bones)
{ {
#if !INCOGNIFY_STRINGS
ImGui.Text($"{kvPair.Key}: p: {kvPair.Value.Translation} | r: {kvPair.Value.Rotation} | s: {kvPair.Value.Scaling}"); 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($"Root bone: {armature.MainRootBone}");
} }
ImGui.Text($"Profile: {armature.Profile.Name} ({armature.Profile.UniqueId})"); ImGui.Text($"Profile: {armature.Profile.Name.Text.Incognify()} ({armature.Profile.UniqueId})");
ImGui.Text($"Actor: {armature.ActorIdentifier}"); ImGui.Text($"Actor: {armature.ActorIdentifier.IncognitoDebug()}");
ImGui.Text($"Protection: {(armature.ProtectedUntil >= DateTime.UtcNow ? "Active" : "NOT active")} [{armature.ProtectedUntil} (UTC)]"); ImGui.Text($"Protection: {(armature.ProtectedUntil >= DateTime.UtcNow ? "Active" : "NOT active")} [{armature.ProtectedUntil} (UTC)]");
//ImGui.Text("Profile:"); //ImGui.Text("Profile:");
//DrawSingleProfile($"armature-{armature.GetHashCode()}", armature.Profile); //DrawSingleProfile($"armature-{armature.GetHashCode()}", armature.Profile);
@@ -189,7 +209,7 @@ public class StateMonitoringTab
ImGui.Text($"Bone template bindings:"); ImGui.Text($"Bone template bindings:");
foreach (var kvPair in armature.BoneTemplateBinding) 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})");
} }
} }
} }