protected void OnDestroy() { GameEventDispatcher.Inst.removeEventListener(GameEventID.UI_MailRefresh, RefreshItemInfo); GameEventDispatcher.Inst.removeEventListener(GameEventID.UI_MailReceiveListData, ReceiveListData); GameEventDispatcher.Inst.removeEventListener(GameEventID.UI_MailReceiveMore, AddMoreItem); GameEventDispatcher.Inst.removeEventListener(GameEventID.UI_MailDel, ClearSelectItemData); ObjectSelf.GetInstance().CurGetDataType = EM_GETMAIL_TYPE.GETNEW; Inst = null; }
private bool IsReceive = false; //判段是不是在领取 public override void InitUIData() { base.InitUIData(); if (Inst == null) { Inst = this; } ObjectSelf.GetInstance().GetManager().RequestSeverListData(0); m_BackBtn = selfTransform.FindChild("UI_Top/BackBtn").GetComponent <Button>(); m_BackBtn.onClick.AddListener(new UnityEngine.Events.UnityAction(OnClickBackBtn)); m_ReceiveBtn = selfTransform.FindChild("haveMail/UI_IconList/Button").GetComponent <Button>(); m_ReceiveBtn.onClick.AddListener(new UnityEngine.Events.UnityAction(OnClickReceiveBtn)); m_DelBtn = selfTransform.FindChild("haveMail/leftBottom/Button").GetComponent <Button>(); m_DelBtn.onClick.AddListener(new UnityEngine.Events.UnityAction(OnClickDelBtn)); EmailSystem = selfTransform.FindChild("UI_Top/Name").GetComponent <Text>(); ShangLaText = selfTransform.FindChild("haveMail/LeftWindow/MoreText").GetComponent <Text>(); DeleteReadEmailText = selfTransform.FindChild("haveMail/leftBottom/Button/Text").GetComponent <Text>(); EmailTotalText = selfTransform.FindChild("haveMail/leftBottom/mailTotal").GetComponent <Text>(); EmailTotalNumText = selfTransform.FindChild("haveMail/leftBottom/mailTotalNum").GetComponent <Text>(); EmailList = selfTransform.FindChild("haveMail/LeftWindow/VerticalList/ListLayOut").GetComponent <RectTransform>();//左侧 邮件列表的父节点 GridLayout = selfTransform.FindChild("haveMail/LeftWindow/VerticalList").GetComponent <ScrollRect>(); m_MailBannerLayout = selfTransform.FindChild("haveMail/LeftWindow/VerticalList/ListLayOut").GetComponent <LoopLayout>(); EmailFuJianList = selfTransform.FindChild("haveMail/UI_IconList/GoodList/GoodsLayout").GetComponent <RectTransform>();//右侧 附件列表的父节点 m_FuJianContentSizeFitter = selfTransform.FindChild("haveMail/UI_IconList/GoodList/GoodsLayout").GetComponent <ContentSizeFitter>(); m_GoodList = selfTransform.FindChild("haveMail/UI_IconList/GoodList").GetComponent <ScrollRect>(); //邮件内容Lable EmailTitleText = selfTransform.FindChild("haveMail/RightWindow/HeadText").GetComponent <Text>(); EmailSenderText = selfTransform.FindChild("haveMail/RightWindow/SenderText").GetComponent <Text>(); SenderText = selfTransform.FindChild("haveMail/RightWindow/Sender").GetComponent <Text>(); EmailInfoText = selfTransform.FindChild("haveMail/UI_IconList/info").GetComponent <Text>(); EmailSafeDaysText = selfTransform.FindChild("haveMail/RightWindow/PromptOBJ/Text").GetComponent <Text>(); ReceiveText = selfTransform.FindChild("haveMail/UI_IconList/Button/Text").GetComponent <Text>(); NoMailText = selfTransform.FindChild("NoMail/LeftWindow/Text").GetComponent <Text>(); AwardIcon = selfTransform.FindChild("haveMail/UI_IconList").gameObject; ReceiveButton = selfTransform.FindChild("haveMail/UI_IconList/Button").gameObject; RightWindow = selfTransform.FindChild("haveMail/RightWindow").gameObject; VerticalList = selfTransform.FindChild("haveMail/LeftWindow/VerticalList").gameObject; LoadImage = selfTransform.FindChild("haveMail/LeftWindow/JiaZaiText").gameObject; HaveMail = selfTransform.FindChild("haveMail").gameObject; NoMail = selfTransform.FindChild("NoMail").gameObject; EventTriggerListener.Get(GridLayout.gameObject).onEndDrag = OnGridLayoutEndDrag; EventTriggerListener.Get(GridLayout.gameObject).onDrag = OnGridLayoutDrag; // EventTriggerListener.Get(GridLayout.gameObject).onExit = OnGridLayoutExit; GameEventDispatcher.Inst.addEventListener(GameEventID.UI_MailRefresh, RefreshItemInfo); GameEventDispatcher.Inst.addEventListener(GameEventID.UI_MailReceiveListData, ReceiveListData); GameEventDispatcher.Inst.addEventListener(GameEventID.UI_MailReceiveMore, AddMoreItem); GameEventDispatcher.Inst.addEventListener(GameEventID.UI_MailDel, ClearSelectItemData); }