UI 系统
This commit is contained in:
@@ -118,6 +118,17 @@ namespace BaseGames.UI.Inventory
|
||||
/// <summary>切换到指定 Tab。无效索引或与当前相同则忽略。</summary>
|
||||
public void SelectTab(int index) => SelectTab(index, raise: true, animateEntry: false);
|
||||
|
||||
/// <summary>
|
||||
/// 按内容根名(如 "Content_Map" / "Content_Inventory" / "Content_Quests")选中对应 Tab;找不到则忽略。
|
||||
/// 供"快速直达键"用:与数字索引解耦,Tab 重排后仍正确。
|
||||
/// </summary>
|
||||
public void SelectTabByContentName(string contentName)
|
||||
{
|
||||
if (_tabs == null || string.IsNullOrEmpty(contentName)) return;
|
||||
for (int i = 0; i < _tabs.Length; i++)
|
||||
if (_tabs[i].content != null && _tabs[i].content.name == contentName) { SelectTab(i); return; }
|
||||
}
|
||||
|
||||
private void SelectTab(int index, bool raise, bool animateEntry)
|
||||
{
|
||||
if (_tabs == null || _tabs.Length == 0) return;
|
||||
|
||||
Reference in New Issue
Block a user