fix emblem taking into account
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user