设置扩展

This commit is contained in:
SoulliesOfficial
2026-07-19 16:44:58 -04:00
parent dda354ebb9
commit 9fd5f098ab
110 changed files with 8386 additions and 2311 deletions

View File

@@ -12,9 +12,9 @@ namespace Ichni.UI
public int selectedIndex;
public string selectedOption;
public void SetUp(int initialValue, List<string> options, string title = "")
public void SetUp(int initialValue, List<string> options, string title = "", bool preservePrefabTitle = false)
{
base.SetUp(title);
base.SetUp(title, preservePrefabTitle: preservePrefabTitle);
this.options = options;
this.dropdown.items = new List<CustomDropdown.Item>();
@@ -45,4 +45,4 @@ namespace Ichni.UI
dropdown.UpdateItemLayout();
}
}
}
}

View File

@@ -19,8 +19,18 @@ namespace Ichni.UI
public UnityAction updateValueAction;
public virtual void SetUp(string title = "", string subTitle = "")
/// <summary>
/// 初始化设置控件的标题区域。
/// <paramref name="preservePrefabTitle"/> 用于已经由 Unity Localization 直接驱动标题的控件:
/// 运行时代码不会覆盖或隐藏 Prefab 中的本地化标题。
/// </summary>
public virtual void SetUp(string title = "", string subTitle = "", bool preservePrefabTitle = false)
{
if (preservePrefabTitle)
{
return;
}
if (title != "")
{
SetTitle(title, subTitle);
@@ -51,4 +61,4 @@ namespace Ichni.UI
}
}
}
}
}

View File

@@ -7,9 +7,9 @@ namespace Ichni.UI
public bool value;
public SwitchManager switchManager;
public void SetUp(bool initialValue, string title = "")
public void SetUp(bool initialValue, string title = "", bool preservePrefabTitle = false)
{
base.SetUp(title);
base.SetUp(title, preservePrefabTitle: preservePrefabTitle);
switchManager.onValueChanged.AddListener(isOn =>
{
@@ -34,4 +34,4 @@ namespace Ichni.UI
return value;
}
}
}
}