From 3545b86b97fed5a47283bd2f50d757614ba1c733 Mon Sep 17 00:00:00 2001 From: Pixsaoul Date: Sat, 11 Oct 2025 01:02:52 +0200 Subject: [PATCH] fix emblem taking into account --- Assets/UI/TraitDisplayInfo.cs | 24 +++++++++++++++++++----- Assets/prefabs/emblemsBase.prefab | 8 ++++---- 2 files changed, 23 insertions(+), 9 deletions(-) diff --git a/Assets/UI/TraitDisplayInfo.cs b/Assets/UI/TraitDisplayInfo.cs index 1070e9b..e98f623 100644 --- a/Assets/UI/TraitDisplayInfo.cs +++ b/Assets/UI/TraitDisplayInfo.cs @@ -10,7 +10,7 @@ namespace UI private TMP_Text _traitName; [SerializeField] - private TMP_Text _traitEmblemCount; + private TMP_InputField _traitEmblemCount; public string DisplayName { get; } @@ -25,10 +25,24 @@ namespace UI public int GetEmblemCount() { - int count; - int.TryParse(_traitEmblemCount.text, out count); - if(count != 0) - Debug.Log($"Trait {Trait} has count {count}"); + int count = 0; + + // Check if the text field has valid content + if (!string.IsNullOrEmpty(_traitEmblemCount.text)) + { + // Try to parse the text to an integer + if (int.TryParse(_traitEmblemCount.text, out count)) + { + if (count != 0) + Debug.Log($"Trait {Trait} has count {count}"); + } + else + { + Debug.LogWarning($"Failed to parse emblem count text '{_traitEmblemCount.text}' for trait {Trait}"); + count = 0; // Ensure count is 0 if parsing fails + } + } + return count; } } diff --git a/Assets/prefabs/emblemsBase.prefab b/Assets/prefabs/emblemsBase.prefab index 0d6ff0b..35fe7ea 100644 --- a/Assets/prefabs/emblemsBase.prefab +++ b/Assets/prefabs/emblemsBase.prefab @@ -418,14 +418,14 @@ MonoBehaviour: m_VerticalScrollbarEventHandler: {fileID: 0} m_LayoutGroup: {fileID: 0} m_ScrollSensitivity: 1 - m_ContentType: 0 + m_ContentType: 2 m_InputType: 0 m_AsteriskChar: 42 - m_KeyboardType: 0 + m_KeyboardType: 4 m_LineType: 0 m_HideMobileInput: 0 m_HideSoftKeyboard: 0 - m_CharacterValidation: 0 + m_CharacterValidation: 2 m_RegexValue: m_GlobalPointSize: 14 m_CharacterLimit: 0 @@ -614,7 +614,7 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: _traitName: {fileID: 4029719132024568495} - _traitEmblemCount: {fileID: 6579458243723793249} + _traitEmblemCount: {fileID: 5836336683357219304} --- !u!1 &6898134698727560530 GameObject: m_ObjectHideFlags: 0