Improved upgrade menu look

This commit is contained in:
Pasha Bibko
2026-04-21 13:58:28 +01:00
parent 34f2169607
commit c930588071
12 changed files with 826 additions and 241 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 403 B

View File

@@ -0,0 +1,132 @@
fileFormatVersion: 2
guid: fd64923844b14084ead7988cb85f3f18
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 13
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
flipGreenChannel: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMipmapLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 0
aniso: 1
mipBias: 0
wrapU: 1
wrapV: 1
wrapW: 0
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 0
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 3
spriteBorder: {x: 6, y: 6, z: 6, w: 6}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
swizzle: 50462976
cookieLightType: 0
platformSettings:
- serializedVersion: 4
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 0
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 4
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 4
buildTarget: WebGL
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
customData:
physicsShape: []
bones: []
spriteID: c8ef6e86da535ff46acabd12342bcda7
internalID: -702473764
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spriteCustomMetadata:
entries:
- key: SpriteEditor.SliceSettings
value: '{"sliceOnImport":false,"gridCellCount":{"x":1.0,"y":1.0},"gridSpriteSize":{"x":64.0,"y":64.0},"gridSpriteOffset":{"x":0.0,"y":0.0},"gridSpritePadding":{"x":0.0,"y":0.0},"pivot":{"x":0.5,"y":0.5},"pivotPixels":{"x":0.0,"y":0.0},"autoSlicingMethod":0,"spriteAlignment":0,"pivotUnitMode":0,"slicingType":1,"keepEmptyRects":false,"isAlternate":false}'
nameFileIdTable: {}
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -118,8 +118,8 @@ Material:
- _XRMotionVectorsPass: 1
- _ZWrite: 1
m_Colors:
- _BaseColor: {r: 0.509434, g: 0.29217535, b: 0.1273585, a: 0.3137255}
- _Color: {r: 0.509434, g: 0.29217532, b: 0.12735847, a: 0.3137255}
- _BaseColor: {r: 0.30980393, g: 0.19607843, b: 0.10980392, a: 1}
- _Color: {r: 0.3098039, g: 0.19607839, b: 0.10980389, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1}
m_BuildTextureStacks: []

View File

@@ -0,0 +1,137 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 8
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: UI-WhiteText
m_Shader: {fileID: 4800000, guid: 933532a4fcc9baf4fa0491de14d08ed7, type: 3}
m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0
m_ValidKeywords: []
m_InvalidKeywords: []
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap:
RenderType: Opaque
disabledShaderPasses:
- MOTIONVECTORS
m_LockedProperties:
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BaseMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _SpecGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_Lightmaps:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_LightmapsInd:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_ShadowMasks:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- _AddPrecomputedVelocity: 0
- _AlphaClip: 0
- _AlphaToMask: 0
- _Blend: 0
- _BlendModePreserveSpecular: 1
- _BumpScale: 1
- _ClearCoatMask: 0
- _ClearCoatSmoothness: 0
- _Cull: 2
- _Cutoff: 0.5
- _DetailAlbedoMapScale: 1
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _DstBlendAlpha: 0
- _EnvironmentReflections: 1
- _GlossMapScale: 0
- _Glossiness: 0
- _GlossyReflections: 0
- _Metallic: 0
- _OcclusionStrength: 1
- _Parallax: 0.005
- _QueueOffset: 0
- _ReceiveShadows: 1
- _Smoothness: 0.5
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _SrcBlendAlpha: 1
- _Surface: 0
- _WorkflowMode: 1
- _XRMotionVectorsPass: 1
- _ZWrite: 1
m_Colors:
- _BaseColor: {r: 0.96862745, g: 0.94509804, b: 0.8862745, a: 1}
- _Color: {r: 0.9686274, g: 0.945098, b: 0.8862745, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1}
m_BuildTextureStacks: []
m_AllowLocking: 1
--- !u!114 &4849881747461813350
MonoBehaviour:
m_ObjectHideFlags: 11
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3}
m_Name:
m_EditorClassIdentifier: Unity.RenderPipelines.Universal.Editor::UnityEditor.Rendering.Universal.AssetVersion
version: 10

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 3ae1565c971ab08479d9a158f290bbb7
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -17,47 +17,173 @@ MonoBehaviour:
CustomBehaviour: 1
Prefab: {fileID: 4062657912758122058, guid: 23e3bfe33d8c6004c85fd638db567ab6,
type: 3}
MinMoney: 0.5
MaxMoney: 1.5
MinMoney: 1
MaxMoney: 5
- Type: 2
CustomBehaviour: 1
Prefab: {fileID: 8799415981405337049, guid: c21e0b5539573904cb10d979de4a3f72,
type: 3}
MinMoney: 3
MaxMoney: 7
MinMoney: 1
MaxMoney: 5
- Type: 3
CustomBehaviour: 1
Prefab: {fileID: 4062657912758122058, guid: 5e1f7f5d4294c1d4fa3e6f88dec0dfa6,
type: 3}
MinMoney: 12
MaxMoney: 18
MinMoney: 1
MaxMoney: 5
- Type: 4
CustomBehaviour: 1
Prefab: {fileID: 4062657912758122058, guid: b224b6df33529e64d83245d78e0feb9f,
type: 3}
MinMoney: 40
MaxMoney: 60
MinMoney: 1
MaxMoney: 5
- Type: 5
CustomBehaviour: 1
Prefab: {fileID: 4062657912758122058, guid: 7af455f1c1666e5409156598fe669f74,
type: 3}
MinMoney: 120
MaxMoney: 160
MinMoney: 1
MaxMoney: 5
- Type: 7
CustomBehaviour: 1
Prefab: {fileID: 4062657912758122058, guid: 13f2740b5ae396e40940587ab2effd65,
type: 3}
MinMoney: 250
MaxMoney: 350
MinMoney: 1
MaxMoney: 5
- Type: 8
CustomBehaviour: 1
Prefab: {fileID: 4062657912758122058, guid: ebddb1b81a288cc4c993a25bc9efe894,
type: 3}
MinMoney: 800
MaxMoney: 900
MinMoney: 1
MaxMoney: 5
- Type: 6
CustomBehaviour: 1
Prefab: {fileID: 4062657912758122058, guid: 2cf42dbc57bb6374b9e6ec700aad5854,
type: 3}
MinMoney: 2000
MaxMoney: 3000
MinMoney: 1
MaxMoney: 5
- Type: 9
CustomBehaviour: 0
Prefab: {fileID: 4485779862959683977, guid: 41d6fc24602553e48b206f2ea7d60bb5,
type: 3}
MinMoney: 1
MaxMoney: 5
- Type: 11
CustomBehaviour: 0
Prefab: {fileID: 4485779862959683977, guid: 044e3c59048f2ec4db0a06bcabc676b0,
type: 3}
MinMoney: 1
MaxMoney: 5
- Type: 19
CustomBehaviour: 0
Prefab: {fileID: 4485779862959683977, guid: 1d1c1945744668945abc5ea0f9a4c760,
type: 3}
MinMoney: 1
MaxMoney: 5
- Type: 20
CustomBehaviour: 0
Prefab: {fileID: 4485779862959683977, guid: f2420d92fef5dde46ba12236e8315458,
type: 3}
MinMoney: 1
MaxMoney: 5
- Type: 18
CustomBehaviour: 0
Prefab: {fileID: 4485779862959683977, guid: e1b896c45d0dc394eb584c739794ff21,
type: 3}
MinMoney: 1
MaxMoney: 5
- Type: 17
CustomBehaviour: 0
Prefab: {fileID: 4485779862959683977, guid: c5580241b3a654e47a270fc00407cbd4,
type: 3}
MinMoney: 1
MaxMoney: 5
- Type: 15
CustomBehaviour: 0
Prefab: {fileID: 4485779862959683977, guid: 2125bd42c9c45584b9c2ed2d6421e410,
type: 3}
MinMoney: 1
MaxMoney: 5
- Type: 10
CustomBehaviour: 0
Prefab: {fileID: 4485779862959683977, guid: 45b8d9d3353ed7c4e8fd11c6387d2364,
type: 3}
MinMoney: 1
MaxMoney: 5
- Type: 16
CustomBehaviour: 0
Prefab: {fileID: 4485779862959683977, guid: b2ad6f08a32678344aa95ae220e3d030,
type: 3}
MinMoney: 1
MaxMoney: 5
- Type: 29
CustomBehaviour: 0
Prefab: {fileID: 4485779862959683977, guid: 46e1f4f05a477b046a5d8121bb63388d,
type: 3}
MinMoney: 1
MaxMoney: 5
- Type: 28
CustomBehaviour: 0
Prefab: {fileID: 4485779862959683977, guid: 7ba70ccf373f1064a9911798bc1748ce,
type: 3}
MinMoney: 1
MaxMoney: 5
- Type: 12
CustomBehaviour: 0
Prefab: {fileID: 4485779862959683977, guid: 9fc502b6f85c8764ab181f64c646bcf1,
type: 3}
MinMoney: 1
MaxMoney: 5
- Type: 21
CustomBehaviour: 0
Prefab: {fileID: 4485779862959683977, guid: 0ff4ad3b26e30d14286f45c67ce8ea91,
type: 3}
MinMoney: 1
MaxMoney: 5
- Type: 23
CustomBehaviour: 0
Prefab: {fileID: 4485779862959683977, guid: eb6cbc0d308433642a3157f5afe2b17e,
type: 3}
MinMoney: 1
MaxMoney: 5
- Type: 22
CustomBehaviour: 0
Prefab: {fileID: 4485779862959683977, guid: 642bb664840379a46b4dff87e65e229d,
type: 3}
MinMoney: 1
MaxMoney: 5
- Type: 24
CustomBehaviour: 0
Prefab: {fileID: 4485779862959683977, guid: 5e2046530547f3a4f807e051d6e1da05,
type: 3}
MinMoney: 1
MaxMoney: 5
- Type: 26
CustomBehaviour: 0
Prefab: {fileID: 4485779862959683977, guid: e37376b2f30b7d64fa634df2233ff9ab,
type: 3}
MinMoney: 1
MaxMoney: 5
- Type: 14
CustomBehaviour: 0
Prefab: {fileID: 4485779862959683977, guid: 082386cfbe8dfc34189664a1dd37ede4,
type: 3}
MinMoney: 1
MaxMoney: 5
- Type: 25
CustomBehaviour: 0
Prefab: {fileID: 4485779862959683977, guid: d0fc612fb6777b14b88133b4cd485733,
type: 3}
MinMoney: 1
MaxMoney: 5
- Type: 27
CustomBehaviour: 0
Prefab: {fileID: 4485779862959683977, guid: f74988e3ad5daf64f8f6c6adab75c984,
type: 3}
MinMoney: 1
MaxMoney: 5
- Type: 13
CustomBehaviour: 0
Prefab: {fileID: 4485779862959683977, guid: 30a47cb0b048fe14aad8715a93340ea7,
type: 3}
MinMoney: 1
MaxMoney: 5

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,53 @@
using UnityEngine;
using System.Text;
using System;
namespace Fruitomation.Game
{
public enum CurrencyMagnitude
{
Ones,
Thousands,
Millions,
Billions,
Trillions
}
[Serializable] public class CurrencyAmount
{
[SerializeField] private CurrencyMagnitude Magnitude;
[SerializeField] private float Ammount;
public string AsString()
{
StringBuilder builder = new();
builder.Append(
Ammount > 10f
? $"${Ammount:I}"
: $"${Ammount:F1}"
);
switch (Magnitude)
{
case CurrencyMagnitude.Ones:
break;
case CurrencyMagnitude.Thousands:
builder.Append("K");
break;
case CurrencyMagnitude.Millions:
builder.Append("M");
break;
case CurrencyMagnitude.Billions:
builder.Append("B");
break;
case CurrencyMagnitude.Trillions:
builder.Append("T");
break;
default:
throw new ArgumentOutOfRangeException();
}
return builder.ToString();
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 7e9afb637ef14ed4b34fd226298272d5
timeCreated: 1776767993

View File

@@ -4,6 +4,7 @@ using UnityEngine.UI;
using UnityEngine;
using System.Linq;
using System;
using System.Text.RegularExpressions;
namespace Fruitomation.UI
{
@@ -24,8 +25,9 @@ namespace Fruitomation.UI
[Header("Settings")]
[SerializeField] private BasicUpgrade Upgrade;
[SerializeField] private int UpgradeCost;
[SerializeField] private bool DrawDefaultLines;
[SerializeField] private CurrencyAmount Cost;
[SerializeField] private bool BigText;
[Header("References")]
[SerializeField] private BasicUpgradeButton[] RequiredUpgrades;
@@ -43,6 +45,8 @@ namespace Fruitomation.UI
private void Awake()
{
AttachedText = gameObject.GetComponentInChildren<Text>();
AttachedText.fontSize = 30;
AttachedButton = GetComponent<Button>();
AttachedButton.onClick.AddListener(() => { UpgradeManager.Unlock(Upgrade); });
@@ -63,6 +67,7 @@ namespace Fruitomation.UI
LineRenderer lr = go.AddComponent<LineRenderer>();
lr.material = LineMaterial;
lr.widthMultiplier = 0.1f;
lr.positionCount = 2;
lines.Add((lr, required, null));
@@ -81,6 +86,7 @@ namespace Fruitomation.UI
LineRenderer lr = go.AddComponent<LineRenderer>();
lr.material = LineMaterial;
lr.widthMultiplier = 0.1f;
lines.Add((lr, null, line));
}
@@ -138,11 +144,11 @@ namespace Fruitomation.UI
State = UpgradeState.Hidden;
}
//
// https://stackoverflow.com/questions/27040325/c-sharp-regex-to-convert-camelcase-to-sentence-case
string formatted = Regex.Replace(Upgrade.ToString(), @"[A-Z]", " $0");
AttachedText.text = State == UpgradeState.Hidden
? "???"
: $"{Upgrade.ToString()} [{UpgradeCost}]";
: $"{formatted}\n{Cost.AsString()}";
}
private bool IsUnlocked => State == UpgradeState.Unlocked;