예제 #1
0
    void CreateItem(List <SlgPB.Notify> dataList)
    {
        _mailItemDic.Clear();
        _Grid.DestoryAllChildren();
        int dataCount = dataList.Count;

        for (int i = 0; i < dataCount; i++)
        {
            GameObject prefab   = (GameObject)Resources.Load(AppConfig.FOLDER_PROFAB_UI + "mail/mailItemContainer");
            GameObject item     = NGUITools.AddChild(_Grid.gameObject, prefab);
            MailItem   playitem = item.GetComponent <MailItem>();
            playitem.Init(dataList[i]);
            _mailItemDic.Add(dataList[i].notifyId, playitem);
            item.name = "0" + i;
        }
        _Grid.Reposition();
    }
예제 #2
0
    void OnUpateItem(GameObject go, int index, int realIndex, List <SlgPB.Notify> dataList, Dictionary <int, MailItem> dataDic)
    {
        int      dataCount = dataList.Count;
        int      indexList = Mathf.Abs(realIndex);
        MailItem Item1     = go.GetComponent <MailItem>();
        int      index_    = indexList;

        if (index_ > (dataCount - 1))
        {
            Item1.gameObject.SetActive(false);

            return;
        }
        else
        {
            Item1.gameObject.SetActive(true);
            Item1.Init(dataList[index_]);
            if (!dataDic.ContainsKey(dataList[index_].notifyId))
            {
                dataDic.Add(dataList[index_].notifyId, Item1);
            }
        }
    }