Added fonts and text scaling

This commit is contained in:
Pasha Bibko
2026-04-21 14:35:01 +01:00
parent c930588071
commit bbb419d3ff
8 changed files with 718 additions and 52 deletions

View File

@@ -44,9 +44,12 @@ namespace Fruitomation.UI
private void Awake()
{
AttachedText = gameObject.GetComponentInChildren<Text>();
AttachedText.fontSize = 30;
const int TEXT_SCALAR = 5;
AttachedText = gameObject.GetComponentInChildren<Text>();
AttachedText.transform.localScale = new Vector3(1f / TEXT_SCALAR, 1f / TEXT_SCALAR, 1f);
AttachedText.fontSize = BigText ? 50 * TEXT_SCALAR : 35 * TEXT_SCALAR;
AttachedButton = GetComponent<Button>();
AttachedButton.onClick.AddListener(() => { UpgradeManager.Unlock(Upgrade); });
@@ -145,7 +148,8 @@ namespace Fruitomation.UI
}
// https://stackoverflow.com/questions/27040325/c-sharp-regex-to-convert-camelcase-to-sentence-case
string formatted = Regex.Replace(Upgrade.ToString(), @"[A-Z]", " $0");
string formatted = Regex.Replace(Upgrade.ToString(), @"[A-Z]", " $0")[1..];
AttachedText.text = State == UpgradeState.Hidden
? "???"
: $"{formatted}\n{Cost.AsString()}";
@@ -153,4 +157,4 @@ namespace Fruitomation.UI
private bool IsUnlocked => State == UpgradeState.Unlocked;
}
}
}