| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091 | 
							
- using UI.Mail;
 
- using FairyGUI;
 
- using UI.CommonGame;
 
- namespace GFGGame
 
- {
 
-     public class MailContentView : BaseWindow
 
-     {
 
-         private UI_MailContentUI _ui;
 
-         private int _childIndex;
 
-         private MailInfo mailInfo;
 
-         public override void Dispose()
 
-         {
 
-             base.Dispose();
 
-         }
 
-         protected override void OnInit()
 
-         {
 
-             base.OnInit();
 
-             _ui = UI_MailContentUI.Create();
 
-             this.viewCom = _ui.target;
 
-             this.viewCom.Center();
 
-             this.modal = true;
 
-             viewAnimationType = EnumViewAnimationType.ZOOM_CENTER;
 
-             _ui.m_listReward.itemRenderer = RenderListRewardItem;
 
-             _ui.m_btnGet.onClick.Add(OnClickBtnGet);
 
-             _ui.m_btnDelete.onClick.Add(OnClickBtnDelete);
 
-         }
 
-         protected override void OnShown()
 
-         {
 
-             base.OnShown();
 
-             // EventAgent.AddEventListener(ConstMessage.MAIL_CHANGE, UpdateNormal);
 
-             _childIndex = (int)this.viewData;
 
-             mailInfo = MailDataManager.Instance.mailInfos[_childIndex];
 
-             _ui.m_c1.selectedIndex = mailInfo.rewards.Count == 0 ? 0 : 1;
 
-             _ui.m_txtTitle.text = mailInfo.title;
 
-             _ui.m_ComContent.target.scrollPane.ScrollTop();
 
-             _ui.m_ComContent.m_txtContent.text = mailInfo.content;
 
-             UpdateNormal();
 
-         }
 
-         private void UpdateNormal()
 
-         {
 
-             _ui.m_btnGet.visible = (ConstMailStatus)mailInfo.state == ConstMailStatus.ReadedButNotGet ? true : false;
 
-             _ui.m_btnDelete.visible = _ui.m_btnGet.visible == true ? false : true;
 
-             _ui.m_listReward.numItems = mailInfo.rewards.Count;
 
-         }
 
-         private void RenderListRewardItem(int index, GObject obj)
 
-         {
 
-             ItemData reward = mailInfo.rewards[index];
 
-             if (obj.data == null)
 
-             {
 
-                 obj.data = new ItemView(obj as GComponent);
 
-             }
 
-             (obj.data as ItemView).SetData(reward);
 
-             (obj.data as ItemView).ImgGotVisible = (ConstMailStatus)mailInfo.state == ConstMailStatus.ReadedAndGot ? true : false;
 
-         }
 
-         private async void OnClickBtnGet()
 
-         {
 
-             bool result = await MailSProxy.ReqMailReward(mailInfo.mailId);
 
-             if (result)
 
-             {
 
-                 mailInfo = MailDataManager.Instance.GetMailInfoById(mailInfo.mailId);
 
-                 UpdateNormal();
 
-             }
 
-         }
 
-         private async void OnClickBtnDelete()
 
-         {
 
-             bool result = await MailSProxy.ReqDeleteMail(mailInfo.mailId);
 
-             if (result)
 
-             {
 
-                 this.Hide();
 
-             }
 
-         }
 
-         // protected override void OnHide()
 
-         // {
 
-         //     base.OnHide();
 
-         //     // EventAgent.RemoveEventListener(ConstMessage.MAIL_CHANGE, UpdateNormal);
 
-         // }
 
-     }
 
- }
 
 
  |