修改设置界面
This commit is contained in:
@@ -11,6 +11,7 @@ namespace NBF
|
||||
{
|
||||
public const string URL = "ui://6hgkvlaufcfggr";
|
||||
|
||||
public Controller showType;
|
||||
public GList List;
|
||||
public GButton BtnUserHead;
|
||||
public BtnInputControl BtnPrev;
|
||||
@@ -20,6 +21,7 @@ namespace NBF
|
||||
{
|
||||
base.ConstructFromXML(xml);
|
||||
|
||||
showType = GetController("showType");
|
||||
List = (GList)GetChild("List");
|
||||
BtnUserHead = (GButton)GetChild("BtnUserHead");
|
||||
BtnPrev = (BtnInputControl)GetChild("BtnPrev");
|
||||
|
||||
@@ -39,25 +39,25 @@ namespace NBF
|
||||
}
|
||||
}
|
||||
|
||||
public void SetTabs(List<TabListData> tabList, int selectIndex = 0)
|
||||
public void SetTabs<T>(List<T> tabList, int selectIndex = 0) where T : TabListData
|
||||
{
|
||||
List.RemoveChildrenToPool();
|
||||
var width = 0f;
|
||||
var listWidth = 0f;
|
||||
for (int i = 0; i < tabList.Count; i++)
|
||||
{
|
||||
var tabData = tabList[i];
|
||||
var tabItem = List.AddItemFromPool().asButton;
|
||||
tabItem.title = tabData.Tab.Name;
|
||||
width += tabItem.width;
|
||||
listWidth += tabItem.width;
|
||||
if (i > 0)
|
||||
{
|
||||
width += List.columnGap;
|
||||
listWidth += List.columnGap;
|
||||
}
|
||||
}
|
||||
|
||||
Log.Info($"Set tab index={List.selectedIndex}");
|
||||
List.selectedIndex = selectIndex;
|
||||
List.width = width;
|
||||
List.width = listWidth;
|
||||
OnClickItem();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user