/// <summary> /// 等级奖励 /// </summary> private void LevelRewards() { int index = 0; if (m_RewarList.Count == 0) { m_RewardContainer.gameObject.SetActive(false); return; } m_RewardContainer.gameObject.SetActive(true); for (; index < m_RewarList.Count; index++) { RewardDateVO mailReward = m_RewarList[index]; Transform node = index < m_RewardContainer.childCount ? m_RewardContainer.GetChild(index) : Object.Instantiate(m_RewardContainer.GetChild(0), m_RewardContainer); Image icon = FindComponent <Image>(node, "Icon"); Image quality = FindComponent <Image>(node, "Quality"); TMP_Text num = FindComponent <TMP_Text>(node, "label_Num"); num.text = mailReward.Num.ToString(); quality.color = ColorUtil.GetColorByItemQuality(mailReward.Quality); string iconName = TableUtil.GetItemSquareIconImage(mailReward.Id); UIUtil.SetIconImage(icon, TableUtil.GetItemIconBundle(mailReward.Id), iconName); node.gameObject.SetActive(true); } for (; index < m_RewardContainer.childCount; index++) { m_RewardContainer.GetChild(index).gameObject.SetActive(false); } }
/// <summary> /// 同步手表升级奖励列表 /// </summary> /// <param name="buf"></param> private void OnRewardList(KProtoBuf buf) { S2C_LEVELUP_REWARD_LIST respond = buf as S2C_LEVELUP_REWARD_LIST; List <RewardDateVO> list = new List <RewardDateVO>(); foreach (RewardInfo reward in respond.rewards) { var item = new RewardDateVO(); item.Id = (uint)reward.id; item.Num = reward.count; item.Quality = TableUtil.GetItemQuality(item.Id); list.Add(item); } GameFacade.Instance.SendNotification(NotificationName.MSG_LEVELUP_REWARD_LIST, list); }
/// <summary> /// pve 结算奖励 /// </summary> /// <param name="buf"></param> private void OnPveReward(KProtoBuf buf) { var msg = buf as S2C_REWARD_LIST; var list = new List <RewardDateVO>(); foreach (var reward in msg.rewards) { var item = new RewardDateVO(); item.Id = (uint)reward.id; item.Num = reward.count; list.Add(item); } PveProxy pveProxy = (PveProxy)GameFacade.Instance.RetrieveProxy(ProxyName.PveProxy); pveProxy.SetSettlementRewards((int)msg.result, list); }
/// <summary> /// /// </summary> /// <param name="view"></param> /// <param name="data"></param> private void LayoutMailTip(GameObject view, MailDataVO data) { int index = 0; Transform m_TipsTransform = FindComponent <Transform>(view.transform, "TipsScrollView/ALL"); TextMeshProUGUI m_Title = FindComponent <TextMeshProUGUI>(view.transform, "TipsScrollView/ALL/Content/NameType/Label_Name"); TextMeshProUGUI m_Sender = FindComponent <TextMeshProUGUI>(view.transform, "TipsScrollView/ALL/Content/NameType/Type/Label_Type"); TextMeshProUGUI m_Describe = FindComponent <TextMeshProUGUI>(view.transform, "TipsScrollView/ALL/Content/Describe/Label_Describe"); Transform itemRootTf = FindComponent <Transform>(view.transform, "TipsScrollView/ALL/Content/Materials"); m_Title.text = data.Title; m_Sender.text = data.Sender; m_Describe.text = data.Content; m_Describe.text = m_Describe.text.Replace("\\n", "\n"); if (data.Items == null) { return; } for (; index < data.Items.Count; index++) { RewardDateVO mailReward = data.Items[index]; Transform node = index < itemRootTf.childCount ? itemRootTf.GetChild(index) : Object.Instantiate(itemRootTf.GetChild(0), itemRootTf); Image icon = FindComponent <Image>(node, "Content/Icon/Icon"); Image quality = FindComponent <Image>(node, "Content/Icon/Quality"); TMP_Text name = FindComponent <TMP_Text>(node, "Content/Label_Name"); TMP_Text num = FindComponent <TMP_Text>(node, "Content/Label_Num"); name.text = TableUtil.GetItemName((int)mailReward.Id); num.text = mailReward.Num.ToString(); quality.color = ColorUtil.GetColorByItemQuality(mailReward.Quality); string iconName = TableUtil.GetItemSquareIconImage(mailReward.Id); UIUtil.SetIconImage(icon, TableUtil.GetItemIconBundle(mailReward.Id), iconName); if (data.Got == 1) { icon.color = Color.gray; } else { icon.color = Color.white; } node.gameObject.SetActive(true); } for (; index < itemRootTf.childCount; index++) { itemRootTf.GetChild(index).gameObject.SetActive(false); } }
/// <summary> /// 邮件 返回邮件详细信息 /// </summary> /// <param name="buf"></param> private void MailDetailInfo(KProtoBuf buf) { S2C_MAIL_DETAIL_INFO msg = buf as S2C_MAIL_DETAIL_INFO; string m_MailId = msg.id; if (GetMailProxy().GetMails().Count == 0) { return; } if (!GetMailProxy().GetMails().TryGetValue(m_MailId, out MailDataVO mailData)) { return; } if (mailData.Readed == 0) { GetMailProxy().ReadMail(m_MailId); } if (mailData.Items == null) { List <RewardDateVO> m_List = new List <RewardDateVO>(); for (int t = 0; t < msg.items.Count; t++) { RewardDateVO rdata = new RewardDateVO(); if (msg.items[t].id <= 0) { continue; } rdata.Id = msg.items[t].id; rdata.Num = msg.items[t].num; rdata.Quality = TableUtil.GetItemQuality(rdata.Id); m_List.Add(rdata); } mailData.Items = m_List; GameFacade.Instance.SendNotification(NotificationName.MSG_EMAIL_RENDERLIST); } }