Exemplo n.º 1
0
    void OnClickMailItem(GameObject games)
    {
        XXMailItemUI mailItem = games.GetComponent <XXMailItemUI>();

        if (mailItem != null)
        {
            itemContent.InMailData = mailItem.InMailData;
            if (mailItem.InMailData.IsRead || !mailItem.InMailData.IsNewContent)
            {
                GameCenter.mailBoxMng.C2S_ReadMail(mailItem.InMailData.id);
            }
            itemContent.gameObject.SetActive(true);
        }
    }
Exemplo n.º 2
0
    void CreateMailItem()
    {
        InItPanel();

        XXMailItemUI mailItemUI = null;
        int          i          = 0;

        Dictionary <int, MailData> list = GameCenter.mailBoxMng.MailDic((XXMailMng.MailState)uiTogType);

        CreatePages(list.Count);

        noThing.SetActive(list.Count <= 0);

        foreach (MailData data in list.Values)
        {
            if (!listMail.ContainsKey(data.id))
            {
                GameObject go = (GameObject)GameObject.Instantiate(etyItems.gameObject);
                go.transform.parent        = etyItems.transform.parent;
                go.transform.localPosition = new Vector3(i / 4 * etyItemWidth, i % 4 * etyItemHeiht, etyItems.transform.localPosition.z);
                go.transform.localScale    = Vector3.one;

                mailItemUI = go.GetComponent <XXMailItemUI>();

                if (mailItemUI != null)
                {
                    mailItemUI.InMailData = data;
                    listMail[data.id]     = mailItemUI;
                }
                go.SetActive(true);

                UIEventListener.Get(go).onClick = OnClickMailItem;
                UIEventListener.Get(go).onPress = OnPressItemPanel;
            }
            else
            {
                listMail[data.id].transform.localPosition = new Vector3(i / 4 * etyItemWidth, i % 4 * etyItemHeiht, etyItems.transform.localPosition.z);
                listMail[data.id].InMailData = data;
                listMail[data.id].gameObject.SetActive(true);
            }
            i++;
        }
    }