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

@@ -49,7 +49,7 @@ TextureImporter:
alignment: 0 alignment: 0
spritePivot: {x: 0.5, y: 0.5} spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 3 spritePixelsToUnits: 3
spriteBorder: {x: 6, y: 6, z: 6, w: 6} spriteBorder: {x: 8, y: 8, z: 8, w: 8}
spriteGenerateFallbackPhysicsShape: 1 spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1 alphaUsage: 1
alphaIsTransparency: 1 alphaIsTransparency: 1

8
Assets/Fonts.meta Normal file
View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 210940a104e948648bb2633dee5b3daa
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

BIN
Assets/Fonts/editundo.ttf Normal file

Binary file not shown.

View File

@@ -0,0 +1,21 @@
fileFormatVersion: 2
guid: 25598a8975ed29243bb850b56f191920
TrueTypeFontImporter:
externalObjects: {}
serializedVersion: 4
fontSize: 16
forceTextureCase: -2
characterSpacing: 0
characterPadding: 1
includeFontData: 1
fontNames:
- Edit Undo BRK
fallbackFontReferences: []
customCharacters:
fontRenderingMode: 0
ascentCalculationMode: 1
useLegacyBoundsCalculation: 0
shouldRoundAdvanceValue: 1
userData:
assetBundleName:
assetBundleVariant:

BIN
Assets/Fonts/ka1.ttf Normal file

Binary file not shown.

21
Assets/Fonts/ka1.ttf.meta Normal file
View File

@@ -0,0 +1,21 @@
fileFormatVersion: 2
guid: 32565b2e72182494c8e58dae1ee512b0
TrueTypeFontImporter:
externalObjects: {}
serializedVersion: 4
fontSize: 16
forceTextureCase: -2
characterSpacing: 0
characterPadding: 1
includeFontData: 1
fontNames:
- Karmatic Arcade
fallbackFontReferences: []
customCharacters:
fontRenderingMode: 0
ascentCalculationMode: 1
useLegacyBoundsCalculation: 0
shouldRoundAdvanceValue: 1
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load Diff

View File

@@ -44,9 +44,12 @@ namespace Fruitomation.UI
private void Awake() private void Awake()
{ {
AttachedText = gameObject.GetComponentInChildren<Text>(); const int TEXT_SCALAR = 5;
AttachedText.fontSize = 30;
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 = GetComponent<Button>();
AttachedButton.onClick.AddListener(() => { UpgradeManager.Unlock(Upgrade); }); 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 // 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 AttachedText.text = State == UpgradeState.Hidden
? "???" ? "???"
: $"{formatted}\n{Cost.AsString()}"; : $"{formatted}\n{Cost.AsString()}";
@@ -153,4 +157,4 @@ namespace Fruitomation.UI
private bool IsUnlocked => State == UpgradeState.Unlocked; private bool IsUnlocked => State == UpgradeState.Unlocked;
} }
} }