UI相关优化补充

This commit is contained in:
2026-05-25 13:21:41 +08:00
parent 3c812cfb41
commit a1f9122153
54 changed files with 2008 additions and 112 deletions

View File

@@ -0,0 +1,46 @@
using UnityEngine;
using TMPro;
namespace BaseGames.UI.Theme
{
/// <summary>
/// 全局 UI 主题资产(架构 10_UIModule §1 视觉风格统一)。
///
/// 设计动机:避免每个 Prefab 各自硬编码颜色 / 字体,统一替换或本地化主题成本极低。
/// 通过 <see cref="UIThemeApplier"/> 在运行时拉取并应用到子节点。
///
/// 资产路径建议Assets/Data/UI/Themes/UI_Theme_Default.asset
/// </summary>
[CreateAssetMenu(menuName = "BaseGames/UI/Theme")]
public class UIThemeSO : ScriptableObject
{
[Header("Palette")]
public Color Primary = new Color(0.10f, 0.55f, 0.95f);
public Color Secondary = new Color(0.20f, 0.20f, 0.25f);
public Color Accent = new Color(1.00f, 0.78f, 0.20f);
public Color Background = new Color(0.06f, 0.07f, 0.10f);
public Color TextPrimary = Color.white;
public Color TextSecondary = new Color(0.75f, 0.78f, 0.82f);
public Color TextDisabled = new Color(0.40f, 0.42f, 0.45f);
public Color Success = new Color(0.30f, 0.85f, 0.45f);
public Color Warning = new Color(0.95f, 0.70f, 0.10f);
public Color Danger = new Color(0.95f, 0.30f, 0.30f);
[Header("Typography")]
public TMP_FontAsset HeaderFont;
public TMP_FontAsset BodyFont;
[Min(8)] public float HeaderFontSize = 36f;
[Min(8)] public float BodyFontSize = 20f;
[Min(8)] public float SmallFontSize = 14f;
[Header("Button States")]
public Color ButtonNormal = new Color(0.10f, 0.55f, 0.95f);
public Color ButtonHighlighted = new Color(0.20f, 0.65f, 1.00f);
public Color ButtonPressed = new Color(0.05f, 0.40f, 0.80f);
public Color ButtonDisabled = new Color(0.30f, 0.30f, 0.32f);
[Header("Audio (可选)")]
public AudioClip ClickSound;
public AudioClip HoverSound;
}
}