Beispiel #1
0
    public void InitMail(int threenum, Text content)
    {
        if (Addres == null)
        {
            Addres        = Addresser_txt.GetComponent <RectTransform>();
            MailWard      = MailWardContent_txt.GetComponent <RectTransform>();
            threetallmrec = Currency_trf.GetComponent <RectTransform>();
            mailitemrec   = MailItem_trf.GetComponent <RectTransform>();
            Adjunct       = Adjunct_obj.GetComponent <RectTransform>();
            Content       = Content_obj.GetComponent <RectTransform>();
            //NoticeMatter = NoticeMatter_txt.GetComponent<RectTransform>();
            //NoticeAddresser = NoticeAddresser_txt.GetComponent<RectTransform>();
            //Notice = Notice_obj.GetComponent<RectTransform>();
            //NoticeName = NoticeName_obj.GetComponent<RectTransform>();
        }
        string ids = content.text;

        content.text = string.Empty;
        height       = content.preferredHeight; //一行文字的高度
        content.text = ids;
        float line = content.preferredHeight / height;

        MailWard.offsetMin             = new Vector2(0, -line * height);
        Addres.anchoredPosition        = new Vector2(0, MailWard.offsetMin.y * 1.1f);
        Adjunct.anchoredPosition       = new Vector2(0, Addres.anchoredPosition.y + -height + -Addres.rect.size.y);
        threetallmrec.anchoredPosition = new Vector2(0, -height);
        mailitemrec.anchoredPosition   = new Vector2(0, -(threenum * ThreeTall) + -height);
        Content.offsetMin = new Vector2(0, Addres.anchoredPosition.y);
        Content.offsetMax = Vector2.zero;
    }
Beispiel #2
0
    public void OpenMail(MailView _mail)
    {
        if (MailList.Count == 0)
        {
            return;
        }
        Close(true, null);
        for (int idx = 0; idx < PostBoxMgr.Instance.MailData.Count; idx++)
        {
            if (PostBoxMgr.Instance.MailData[idx].mail_id == _mail.MailId)
            {
                MailWardName_txt.text    = PostBoxMgr.Instance.MailData[idx].mailname;
                MailWardContent_txt.text = PostBoxMgr.Instance.MailData[idx].content;
                Addresser_txt.text       = PostBoxMgr.Instance.MailData[idx].addresser;
                if (PostBoxMgr.Instance.MailData[idx].mailitem.Count > 0)
                {
                    Found(PostBoxMgr.Instance.MailData[idx].mail_id, PostBoxMgr.Instance.MailData[idx].mailitem);
                    Adjunct_obj.SetActive(true);
                    Get_btn.gameObject.SetActive(true);
                    Draw_btn.gameObject.SetActive(false);
                    deletea_btn.gameObject.SetActive(false);
                }
                else
                {
                    deletea_btn.gameObject.SetActive(true);
                    Draw_btn.gameObject.SetActive(true);
                    Get_btn.gameObject.SetActive(false);
                    _mail.Shade.SetActive(true);
                    _mail.RedDot.SetActive(false);
                    Adjunct_obj.SetActive(false);
                    InitMail(0, MailWardContent_txt);
                    PostBoxMgr.Instance.MailData[idx].isRead = -1;
                }

                MailaWard_btn.gameObject.SetActive(true);
                ZEventSystem.Dispatch(EventConst.OnMailItemIncident, true, PostBoxMgr.Instance.MailData[idx]);
            }
        }
    }