예제 #1
0
    public void UpdateListElenment(GameObject element, CMail mail)
    {
        int                currentUTCTime   = CRoleInfo.GetCurrentUTCTime();
        Text               componetInChild  = Utility.GetComponetInChild <Text>(element, "Title");
        Text               componetInChild2 = Utility.GetComponetInChild <Text>(element, "MailTime");
        GameObject         obj              = Utility.FindChild(element, "New");
        GameObject         obj2             = Utility.FindChild(element, "ReadMailIcon");
        GameObject         obj3             = Utility.FindChild(element, "UnReadMailIcon");
        GameObject         obj4             = Utility.FindChild(element, "CoinImg");
        Text               componetInChild3 = Utility.GetComponetInChild <Text>(element, "From");
        CUIHttpImageScript componetInChild4 = Utility.GetComponetInChild <CUIHttpImageScript>(element, "HeadBg/imgHead");
        GameObject         obj5             = null;
        Text               text             = null;
        GameObject         gameObject       = Utility.FindChild(element, "OnlineBg");

        if (gameObject != null)
        {
            obj5 = gameObject.gameObject;
        }
        GameObject gameObject2 = Utility.FindChild(element, "Online");

        if (gameObject2 != null)
        {
            text = gameObject2.GetComponent <Text>();
        }
        componetInChild.set_text(mail.subject);
        componetInChild2.set_text(Utility.GetTimeBeforString((long)((ulong)mail.sendTime), (long)currentUTCTime));
        bool flag = mail.mailState == COM_MAIL_STATE.COM_MAIL_UNREAD;

        obj.CustomSetActive(flag);
        if (mail.mailType == CustomMailType.SYSTEM)
        {
            obj2.CustomSetActive(!flag);
            obj3.CustomSetActive(flag);
            componetInChild3.set_text(string.Empty);
            componetInChild4.gameObject.CustomSetActive(false);
            obj4.CustomSetActive(false);
            obj5.CustomSetActive(false);
            if (text != null)
            {
                text.gameObject.CustomSetActive(false);
            }
        }
        else if (mail.mailType == CustomMailType.FRIEND)
        {
            obj5.CustomSetActive(false);
            if (text != null)
            {
                text.gameObject.CustomSetActive(false);
            }
            obj2.CustomSetActive(false);
            obj3.CustomSetActive(false);
            componetInChild3.set_text(mail.from);
            componetInChild4.gameObject.CustomSetActive(true);
            if (mail.subType == 3)
            {
                obj4.CustomSetActive(false);
                componetInChild4.SetImageSprite(CGuildHelper.GetGuildHeadPath(), this.m_CUIForm);
            }
            else
            {
                obj4.CustomSetActive(true);
                if (!CSysDynamicBlock.bFriendBlocked)
                {
                    COMDT_FRIEND_INFO friendByName = Singleton <CFriendContoller> .instance.model.getFriendByName(mail.from, CFriendModel.FriendType.GameFriend);

                    if (friendByName == null)
                    {
                        friendByName = Singleton <CFriendContoller> .instance.model.getFriendByName(mail.from, CFriendModel.FriendType.SNS);
                    }
                    if (friendByName != null)
                    {
                        string url = Utility.UTF8Convert(friendByName.szHeadUrl);
                        componetInChild4.SetImageUrl(Singleton <ApolloHelper> .GetInstance().ToSnsHeadUrl(url));
                    }
                }
            }
        }
        else if (mail.mailType == CustomMailType.FRIEND_INVITE)
        {
            obj5.CustomSetActive(true);
            if (text != null)
            {
                text.gameObject.CustomSetActive(true);
            }
            obj2.CustomSetActive(false);
            obj3.CustomSetActive(false);
            componetInChild3.set_text(string.Empty);
            componetInChild4.gameObject.CustomSetActive(true);
            obj4.CustomSetActive(false);
            Transform  transform = element.transform.FindChild("invite_btn");
            GameObject obj6      = null;
            if (transform != null)
            {
                obj6 = transform.gameObject;
            }
            if (mail.relationType == 1)
            {
                GuildMemInfo guildMemberInfoByUid = CGuildHelper.GetGuildMemberInfoByUid(mail.uid);
                Singleton <CMailSys> .instance.AddGuildMemInfo(guildMemberInfoByUid);
            }
            this.SetEventParams(element, mail);
            string text2;
            string url2;
            bool   flag2             = !this.GetOtherPlayerState((COM_INVITE_RELATION_TYPE)mail.relationType, mail.uid, mail.dwLogicWorldID, out text2, out url2);
            string processTypeString = this.GetProcessTypeString((CMailSys.enProcessInviteType)mail.processType);
            componetInChild.set_text(string.Format("{0} {1}", mail.subject, processTypeString));
            if (text != null)
            {
                text.set_text(text2);
            }
            componetInChild4.SetImageUrl(Singleton <ApolloHelper> .GetInstance().ToSnsHeadUrl(url2));
            if (flag2)
            {
                CUIUtility.GetComponentInChildren <Image>(componetInChild4.gameObject).set_color(CUIUtility.s_Color_GrayShader);
            }
            else
            {
                CUIUtility.GetComponentInChildren <Image>(componetInChild4.gameObject).set_color(CUIUtility.s_Color_Full);
            }
            obj6.CustomSetActive(!flag2);
        }
        else if (mail.mailType == CustomMailType.ASK_FOR)
        {
            obj2.CustomSetActive(false);
            obj3.CustomSetActive(false);
            componetInChild3.set_text(mail.from);
            componetInChild4.gameObject.CustomSetActive(true);
            obj4.CustomSetActive(false);
            obj5.CustomSetActive(false);
            if (text != null)
            {
                text.gameObject.CustomSetActive(false);
            }
            if (!CSysDynamicBlock.bFriendBlocked)
            {
                CFriendModel.FriendType friendType    = CFriendModel.FriendType.GameFriend;
                COMDT_FRIEND_INFO       friendByName2 = Singleton <CFriendContoller> .instance.model.getFriendByName(mail.from, CFriendModel.FriendType.GameFriend);

                if (friendByName2 == null)
                {
                    friendType    = CFriendModel.FriendType.SNS;
                    friendByName2 = Singleton <CFriendContoller> .instance.model.getFriendByName(mail.from, CFriendModel.FriendType.SNS);
                }
                if (friendByName2 != null)
                {
                    string url3 = Utility.UTF8Convert(friendByName2.szHeadUrl);
                    componetInChild4.SetImageUrl(Singleton <ApolloHelper> .GetInstance().ToSnsHeadUrl(url3));
                    UT.ShowFriendData(friendByName2, element.GetComponent <FriendShower>(), FriendShower.ItemType.Normal, false, friendType, Singleton <CUIManager> .GetInstance().GetForm(CMailSys.MAIL_FORM_PATH), true);
                }
            }
        }
    }