UI系统
This commit is contained in:
@@ -359,6 +359,7 @@ namespace BaseGames.Editor.UI
|
||||
private static GameObject BuildSettingHeader(List<string> report)
|
||||
{
|
||||
var go = NewUI(PfSettingHeader, 480, 32);
|
||||
var hdrLe = go.AddComponent<LayoutElement>(); hdrLe.preferredHeight = 36f; hdrLe.minHeight = 32f;
|
||||
var lblGo = NewUIChild(go.transform, "Label", out var rt);
|
||||
Stretch(rt);
|
||||
var lbl = lblGo.AddComponent<TextMeshProUGUI>();
|
||||
@@ -414,6 +415,7 @@ namespace BaseGames.Editor.UI
|
||||
private static GameObject SettingRowRoot(string name, out TMP_Text label)
|
||||
{
|
||||
var go = NewUI(name, 480, 44);
|
||||
var rowLe = go.AddComponent<LayoutElement>(); rowLe.preferredHeight = 44f; rowLe.minHeight = 40f;
|
||||
var h = go.AddComponent<HorizontalLayoutGroup>();
|
||||
h.spacing = 12; h.childAlignment = TextAnchor.MiddleLeft;
|
||||
h.childForceExpandWidth = false; h.childForceExpandHeight = false;
|
||||
@@ -539,6 +541,10 @@ namespace BaseGames.Editor.UI
|
||||
if (s_theme != null) AssignRef(uiBtn, "_theme", s_theme);
|
||||
var view = go.AddComponent<MainMenuButtonView>();
|
||||
|
||||
// LayoutElement:放入竖排布局(VerticalLayoutGroup childControlHeight)时保持固定行高,避免被压扁
|
||||
var le = go.AddComponent<LayoutElement>();
|
||||
le.preferredHeight = 64f; le.minHeight = 56f;
|
||||
|
||||
var iconGo = NewUIChild(go.transform, "Icon", out var irt);
|
||||
irt.anchorMin = new Vector2(0, 0.5f); irt.anchorMax = new Vector2(0, 0.5f); irt.pivot = new Vector2(0, 0.5f);
|
||||
irt.anchoredPosition = new Vector2(14, 0); irt.sizeDelta = new Vector2(32, 32);
|
||||
|
||||
Reference in New Issue
Block a user