예제 #1
0
    //刷新信息列表
    public void RefreshMsg()
    {
        _uipanel.alpha = 0;
        List <MegMailCellData> list_message = MailReveicer.Instance.list_message;

        #region 保证对象池够显示
        int cha = list_message.Count - ListCells.Count;
        if (cha > 0)
        {
            _logic.CreateCellObject(cha);
        }
        #endregion

        int i = 0;
        for (; i < list_message.Count; i++)
        {
            ListCells[i].gameObject.SetActive(true);
            //设置单个元素的显示
            ListCells[i].SetCellData(list_message[i]);
        }
        #region 隐藏对象池不用的子
        for (; i < ListCells.Count; i++)
        {
            ListCells[i].gameObject.SetActive(false);
        }
        #endregion
        _logic.uiguide.repositionNow = true;


        #region 刷新邮件状态
        if (MailReveicer.Instance.isHaveNewMail)
        {
            if (MailReveicer.Instance.mailState == MailState.newFight)
            {
                MailReveicer.Instance.mailState = MailState.AllNew;
            }
        }
        else
        {
            if (MailReveicer.Instance.mailState == MailState.AllNew)
            {
                MailReveicer.Instance.mailState = MailState.newFight;
            }
            else if (MailReveicer.Instance.mailState == MailState.newMsg)
            {
                MailReveicer.Instance.mailState = MailState.None;
            }
        }
        MailBox._mInstance._view.SetNewSgin(MailReveicer.Instance.mailState);
        #endregion



        StartCoroutine(PanelRepostion());
    }