Beispiel #1
0
 // Use this for initialization
 public void AddItem(TabBarItemInfo info)
 {
     if (listItem == null)
     {
         listItem = new List <TabBarItemInfo>();
     }
     listItem.Add(info);
     uiTabBar.AddItem(info, listItem.Count - 1);
 }
Beispiel #2
0
 public void UpdateItem(TabBarItemInfo info)
 {
     textTitle.text = info.title;
     // textTitle.color = GetColorOfKey("TabBarTitle");
     if (!Common.isBlankString(info.pic))
     {
         imageBg.UpdateImage(info.pic, imageBg.keyImage);
     }
     this.LayOut();
 }
Beispiel #3
0
    public TabBarItemInfo GetItem(int idx)
    {
        if (listItem == null)
        {
            return(null);
        }
        if ((idx < 0) || (idx >= listItem.Count))
        {
            return(null);
        }

        TabBarItemInfo info = listItem[idx];

        return(info);
    }
Beispiel #4
0
    public void SelectItem(int idx)
    {
        if (selectIndex == idx)
        {
            Debug.Log("tabbar click the same item selectIndex=" + idx);
            return;
        }
        TabBarItemInfo info = GetItem(idx);

        if (info == null)
        {
            Debug.Log("SelectItem null,idx=" + idx);
            return;
        }

        DestroyController();

        selectIndex = idx;
        //info.controller.CreateView(sizeCanvas);
        info.controller.SetViewParent(objContent);
        rootController = info.controller;
    }
Beispiel #5
0
    public void DestroyController()
    {
        if (objController == null)
        {
            return;
        }

        TabBarItemInfo info = GetItem(selectIndex);

        if (info == null)
        {
            Debug.Log("DestroyController null,selectIndex=" + selectIndex);
            return;
        }

        info.controller.DestroyObjController();

        // foreach (Transform child in objView.transform)
        // {
        //     GameObject objtmp = child.gameObject;
        //     GameObject.DestroyImmediate(objtmp);
        //     objtmp = null;
        // }
    }
Beispiel #6
0
 public void AddItem(TabBarItemInfo info, int idx)
 {
     CreateTabItem();
     uiTabBarItem.index = idx;
     uiTabBarItem.UpdateItem(info);
 }
Beispiel #7
0
 public void UpdateItem(TabBarItemInfo info)
 {
     textTitle.text = info.title;
 }