Example #1
0
        public void SetData()
        {
            recvPlusText.text = "";

            ListMailPlusNum.DataSource.BeginUpdate();
            ListMailPlusNum.DataSource.Clear();

            ListMailPlusNum.transform.localPosition = new UnityEngine.Vector3(-1.2f, 90.3f, 0f);

            if (LogicDataCenter.mailDataManager.SumPlusMoney > 0 || LogicDataCenter.mailDataManager.SumPlusExp > 0)
            {
                int nIndex = 1;
                UIWidgets.ObservableList <UListItemMailPlusData> dataSource = new UIWidgets.ObservableList <UListItemMailPlusData>();

                if (LogicDataCenter.mailDataManager.SumPlusMoney > 0)
                {
                    UListItemMailPlusData itemMoney = new UListItemMailPlusData();
                    itemMoney.nIndex = nIndex;
                    itemMoney.szName = ULocalizationService.Instance.Get("UIView", "Mail", "MailPlusMoneyDesc");
                    itemMoney.nCount = LogicDataCenter.mailDataManager.SumPlusMoney;

                    dataSource.Add(itemMoney);

                    ++nIndex;
                }

                if (LogicDataCenter.mailDataManager.SumPlusExp > 0)
                {
                    UListItemMailPlusData itemExp = new UListItemMailPlusData();
                    itemExp.nIndex = nIndex;
                    itemExp.szName = ULocalizationService.Instance.Get("UIView", "Mail", "MailPlusExpDesc");
                    itemExp.nCount = LogicDataCenter.mailDataManager.SumPlusExp;

                    dataSource.Add(itemExp);
                }

                ListMailPlusNum.DataSource = dataSource;
            }

            ListMailPlusNum.DataSource.EndUpdate();

            ListMailGoods.DataSource.BeginUpdate();
            ListMailGoods.DataSource.Clear();

            int nTmpGoodsNum = LogicDataCenter.mailDataManager.FastRecvGoodsList.Count;

            if (nTmpGoodsNum > 0)
            {
                int nGoodsIndex = 1;
                UIWidgets.ObservableList <UListItemMailGoods> goodsDataSource = new UIWidgets.ObservableList <UListItemMailGoods>();
                foreach (var item in LogicDataCenter.mailDataManager.FastRecvGoodsList)
                {
                    if (nGoodsIndex > m_GoodsMaxNum)
                    {
                        break;
                    }

                    UListItemMailGoods itemGoods = new UListItemMailGoods();
                    itemGoods.nIndex   = nGoodsIndex;
                    itemGoods.nGoodsID = item.Key;
                    itemGoods.nCount   = item.Value.nCount;

                    goodsDataSource.Add(itemGoods);

                    ++nGoodsIndex;
                }

                ListMailGoods.DataSource = goodsDataSource;
            }

            ListMailGoods.DataSource.EndUpdate();

            if (ListMailGoods.DataSource.Count == 0)
            {
                ListMailPlusNum.transform.localPosition = new UnityEngine.Vector3(-1.2f, 25.1f, 0f);
            }

            if (nTmpGoodsNum > m_GoodsMaxNum)
            {
                recvPlusText.text = ULocalizationService.Instance.Get("UIView", "Mail", "FastRecvPlusBoxDesc");
            }
        }
Example #2
0
        public void SetMailContentData(String strMailTitle, String strSenderName, GameLogic.gameview_mail_rsp_detaildata detailData)
        {
            m_nMailID = detailData.nMailID;

            recvConfirmDesc.text = ULocalizationService.Instance.Get("UIView", "Mail", "RecvConfirmDes");

            recvBtn.gameObject.SetActive(false);
            recvConfirmDesc.gameObject.SetActive(false);

            mailTitle.text   = ULocalizationService.Instance.Get("UIView", "Mail", "MailTitleDesc") + strMailTitle;
            senderName.text  = ULocalizationService.Instance.Get("UIView", "Mail", "SenderNameDesc") + strSenderName;
            mailContent.text = "    " + ULocalizationService.Instance.Get("UIView", "Mail", "MailContentDesc") + detailData.szContext;

            ListMailPlusNum.DataSource.BeginUpdate();
            ListMailPlusNum.DataSource.Clear();
            ListMailGoods.DataSource.BeginUpdate();
            ListMailGoods.DataSource.Clear();

            bool bHavePlus = false;

            if (detailData.nPlusMoney > 0 || detailData.nPlusExp > 0)
            {
                bHavePlus = true;
                int nIndex = 1;
                UIWidgets.ObservableList <UListItemMailPlusData> dataSource = new UIWidgets.ObservableList <UListItemMailPlusData>();
                if (detailData.nPlusMoney > 0)
                {
                    UListItemMailPlusData itemMoney = new UListItemMailPlusData();
                    itemMoney.nIndex = nIndex;
                    itemMoney.szName = ULocalizationService.Instance.Get("UIView", "Mail", "MailPlusMoneyDesc");
                    itemMoney.nCount = detailData.nPlusMoney;

                    dataSource.Add(itemMoney);

                    ++nIndex;
                }

                if (detailData.nPlusExp > 0)
                {
                    UListItemMailPlusData itemExp = new UListItemMailPlusData();
                    itemExp.nIndex = nIndex;
                    itemExp.szName = ULocalizationService.Instance.Get("UIView", "Mail", "MailPlusExpDesc");
                    itemExp.nCount = detailData.nPlusExp;

                    dataSource.Add(itemExp);
                }

                ListMailPlusNum.DataSource = dataSource;
            }

            if (detailData.nPlusGoodsNum > 0)
            {
                int nGoodsIndex = 1;
                UIWidgets.ObservableList <UListItemMailGoods> goodsDataSource = new UIWidgets.ObservableList <UListItemMailGoods>();
                for (int i = 0; i < detailData.nPlusGoodsNum; ++i)
                {
                    int nGoodsID = detailData.sGoodsList[i].nGoodsID;
                    if (nGoodsID > 0)
                    {
                        UListItemMailGoods itemGoods = new UListItemMailGoods();
                        itemGoods.nIndex   = nGoodsIndex;
                        itemGoods.nGoodsID = nGoodsID;
                        itemGoods.nCount   = detailData.sGoodsList[i].nCount;

                        goodsDataSource.Add(itemGoods);

                        bHavePlus = true;

                        ++nGoodsIndex;
                    }
                }

                ListMailGoods.DataSource = goodsDataSource;
            }

            ListMailPlusNum.DataSource.EndUpdate();
            ListMailGoods.DataSource.EndUpdate();

            int nMailType = LogicDataCenter.mailDataManager.GetMailType(m_nMailID);

            if (bHavePlus && (nMailType == (int)EMMailType.emMailType_Player || nMailType == (int)EMMailType.emMailType_System))
            {
                if (LogicDataCenter.mailDataManager.PlusMailList.Contains(m_nMailID))
                {
                    recvBtn.gameObject.SetActive(true);
                }
                else
                {
                    recvConfirmDesc.gameObject.SetActive(true);
                }
            }
        }