public void UpdateMailView() { this.ClearMailPanel(); GameObject prefab = base.LoadPrefabCache("MailPanelItem"); this.mailDataList = ModelManager.Instance.Get_mailDataList_X(); if (this.mailDataList == null || this.mailDataList.Count == 0) { this.emptyShow.gameObject.SetActive(true); return; } this.emptyShow.gameObject.SetActive(false); this.mailDataList = this.SortList(this.mailDataList); for (int i = 0; i < this.mailDataList.Count; i++) { GameObject gameObject = NGUITools.AddChild(this.mailpanel_grid.gameObject, prefab); gameObject.transform.Find("Time").GetComponent <UILabel>().text = this.mailDataList[i].Time.ToString("MM/dd/yyyy"); if (this.mailDataList[i].TemplateId == 0) { string[] array = this.mailDataList[i].Mail_Param.Split(new char[] { '|' }); gameObject.transform.Find("Title/Label").GetComponent <UILabel>().text = array[0]; gameObject.transform.Find("Name").GetComponent <UILabel>().text = array[2]; } else { SysMailInfoVo dataById = BaseDataMgr.instance.GetDataById <SysMailInfoVo>(this.mailDataList[i].TemplateId.ToString()); gameObject.transform.Find("Title/Label").GetComponent <UILabel>().text = LanguageManager.Instance.GetStringById(dataById.mail_title); gameObject.transform.Find("Name").GetComponent <UILabel>().text = LanguageManager.Instance.GetStringById(dataById.addresser); } gameObject.name = this.mailDataList[i].Id.ToString(); gameObject.AddComponent <UIEventListener>(); UIEventListener expr_1E9 = UIEventListener.Get(gameObject.gameObject); expr_1E9.onClick = (UIEventListener.VoidDelegate)Delegate.Combine(expr_1E9.onClick, new UIEventListener.VoidDelegate(this.ShowInfoPanel)); gameObject.transform.Find("ReadState").gameObject.SetActive(false); gameObject.transform.Find("UnReadState").gameObject.SetActive(true); gameObject.transform.Find("Title/Label").GetComponent <UILabel>().color = new Color(1f, 1f, 1f, 1f); gameObject.transform.Find("Icon/New").gameObject.SetActive(true); gameObject.transform.GetComponent <BoxCollider>().enabled = true; } this.mailpanel_grid.Reposition(); this.mailpanel_grid.transform.parent.GetComponent <UIScrollView>().ResetPosition(); }
public void ShowInfoPanel(MailData mailData, GameObject obj) { this.moneyReward.gameObject.SetActive(false); this.dimReward.gameObject.SetActive(false); this.capReward.gameObject.SetActive(false); this.boxReward.gameObject.SetActive(false); if (mailData == null) { return; } if (mailData.TemplateId == 0) { string[] array = mailData.Mail_Param.Split(new char[] { '|' }); this.rd_title.text = array[0]; this.rd_content.text = array[1]; this.rd_addresser.text = array[2]; } else { SysMailInfoVo dataById = BaseDataMgr.instance.GetDataById <SysMailInfoVo>(mailData.TemplateId.ToString()); this.rd_title.text = LanguageManager.Instance.GetStringById(dataById.mail_title); string text = LanguageManager.Instance.GetStringById(dataById.mail_content); string[] array2 = mailData.Mail_Param.Split(new char[] { '|' }); string[] array3 = text.Split(new char[] { '*' }); text = string.Empty; for (int i = 0; i < array3.Length; i++) { if (i == array3.Length - 1) { text += array3[i]; } else { text = text + array3[i] + array2[i]; } } this.rd_content.text = text; this.rd_addresser.text = LanguageManager.Instance.GetStringById(dataById.addresser); } if (mailData.Mail_AwardList != null) { this.closeButton.gameObject.SetActive(false); this.getRewardButton.gameObject.SetActive(true); this.rd_main.gameObject.SetActive(true); foreach (RewardModel current in mailData.Mail_AwardList) { int type = current.Type; if (type != 1) { this.boxReward.gameObject.SetActive(true); } else if (current.Id == "1") { this.moneyCount.text = "x" + current.Count; this.moneyReward.gameObject.SetActive(true); } else if (current.Id == "2") { this.dimCount.text = "x" + current.Count; this.dimReward.gameObject.SetActive(true); } else if (current.Id == "9") { this.capCount.text = "x" + current.Count; this.capReward.gameObject.SetActive(true); } } } else { this.rd_main.gameObject.SetActive(false); this.closeButton.gameObject.SetActive(true); this.getRewardButton.gameObject.SetActive(false); } this.rewardTable.Reposition(); this.rewardChilden = this.rewardTable.children; if (this.rewardChilden.Count == 1) { this.rd_main.GetComponent <UISprite>().height = 121; } else if (this.rewardChilden.Count > 1) { this.rd_main.GetComponent <UISprite>().height = this.rewardChilden.Count * 100; } this.GetReward(mailData); }