UI替换与对应代码进行调整

This commit is contained in:
YiHan0621
2025-09-13 16:25:35 +08:00
parent fe0b8cec77
commit db68c377bd
106 changed files with 6559 additions and 1151 deletions

View File

@@ -15,6 +15,12 @@ namespace TcgEngine.UI
public Color on_color = Color.yellow;
public Color off_color = Color.white;
public int on_size = 42;
public int off_size = 36;
[Header("判断启用文字颜色选中还是文字大小选中")]
public bool is_color = true;
private Toggle toggle;
private Text toggle_txt;
@@ -28,6 +34,8 @@ namespace TcgEngine.UI
private void Start()
{
on_size = toggle_txt.fontSize;
off_size = (int)(toggle_txt.fontSize * 0.8f);
Refresh();
}
@@ -39,8 +47,17 @@ namespace TcgEngine.UI
private void Refresh()
{
toggle_txt.color = toggle.isOn ? on_color : off_color;
if (is_color)
{
toggle_txt.color = toggle.isOn ? on_color : off_color;
}
else
{
toggle_txt.fontSize = toggle.isOn ? on_size : off_size;
toggle_txt.fontStyle = toggle.isOn ? FontStyle.Bold : FontStyle.Normal;
}
previous = toggle.isOn;
}
}
}