新增菜单all和列表标题功能
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
// 本脚本只在不存在时会生成一次。组件逻辑写在当前脚本内。已存在不会再次生成覆盖
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
using FairyGUI;
|
||||
using NBC;
|
||||
@@ -27,22 +28,29 @@ namespace NBF
|
||||
base.Dispose();
|
||||
}
|
||||
|
||||
public void SetData<T>(List<T> list) where T : class
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="tabItemList"></param>
|
||||
/// <param name="showAll">是否显示全部页签</param>
|
||||
/// <param name="showListTitle">是否列表页显示分类标题</param>
|
||||
public void SetData(List<TabItemData> tabItemList, bool showAll = false, bool showListTitle = true)
|
||||
{
|
||||
_tabList.Clear();
|
||||
_currentTab = null;
|
||||
var tabList = ItemDataHelper.GetItemTabDataList(list);
|
||||
style.selectedIndex = 0; //一级菜单
|
||||
foreach (var tabItemData in tabList)
|
||||
if (tabItemList.Any(tabItem => tabItem.Children.Count > 0))
|
||||
{
|
||||
if (tabItemData.Children.Count > 0)
|
||||
{
|
||||
style.selectedIndex = 1; //有二级菜单
|
||||
break;
|
||||
}
|
||||
style.selectedIndex = 1; //有二级菜单
|
||||
}
|
||||
|
||||
_tabList.AddRange(tabList);
|
||||
_tabList.AddRange(tabItemList);
|
||||
if (showAll)
|
||||
{
|
||||
_tabList.AddAllTabItem(showListTitle);
|
||||
}
|
||||
|
||||
Menu.SetTabs(_tabList);
|
||||
}
|
||||
|
||||
private void ChangeTab(int index)
|
||||
|
||||
Reference in New Issue
Block a user