From 65d966fffa832e13cf82f53dd79f8faaeb9c5c7a Mon Sep 17 00:00:00 2001 From: Chandler Cox Date: Fri, 15 Nov 2024 09:45:02 -0600 Subject: [PATCH] Add being able to obfuscate text in a text box with a character. --- Source/Engine/UI/GUI/Common/TextBox.cs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Source/Engine/UI/GUI/Common/TextBox.cs b/Source/Engine/UI/GUI/Common/TextBox.cs index f99d7140a..da8b299cb 100644 --- a/Source/Engine/UI/GUI/Common/TextBox.cs +++ b/Source/Engine/UI/GUI/Common/TextBox.cs @@ -24,6 +24,18 @@ namespace FlaxEngine.GUI get => _watermarkText; set => _watermarkText = value; } + + /// + /// Whether to Obfuscate the text with a different character. + /// + [EditorOrder(21), Tooltip("Whether to Obfuscate the text with a different character.")] + public bool ObfuscateText = false; + + /// + /// The character to Obfuscate the text. + /// + [EditorOrder(22), VisibleIf(nameof(ObfuscateText)), Tooltip("The character to Obfuscate the text.")] + public char ObfuscateCharacter = '\u25cf'; /// /// The text case. @@ -159,6 +171,9 @@ namespace FlaxEngine.GUI private string ConvertedText() { + if (ObfuscateText) + return new string(ObfuscateCharacter, _text.Length); + string text = _text; switch (CaseOption) {