Exemple #1
0
        public uint Execute(PacketDistributed ipacket)
        {
            GC_MAIL_UPDATE packet = (GC_MAIL_UPDATE)ipacket;

            if (null == packet)
            {
                return((uint)PACKET_EXE.PACKET_EXE_ERROR);
            }
            MailData.UpdateMailData(packet);
            if (FunctionButtonLogic.Instance() != null)
            {
                FunctionButtonLogic.Instance().UpdateNewFunctionButtonState(FunctionButtonLogic.DynamicLogo.Mail);
            }
            return((uint)PACKET_EXE.PACKET_EXE_CONTINUE);
        }
Exemple #2
0
    public static void UpdateMailData(GC_MAIL_UPDATE data)
    {
        MailUpdateType curUpdateType = MailUpdateType.UPDATE;

        if (m_curPlayGuid != PlayerPreferenceData.LastRoleGUID)
        {
            UserMailMap.Clear();
        }

        m_curPlayGuid = PlayerPreferenceData.LastRoleGUID;

        UserMail curMail = null;

        if (UserMailMap.ContainsKey(data.MailGuid))
        {
            curMail       = UserMailMap[data.MailGuid];
            curUpdateType = MailUpdateType.UPDATE;
        }
        else
        {
            curMail = new UserMail();
            UserMailMap.Add(data.MailGuid, curMail);
            curUpdateType = MailUpdateType.ADD;
        }

        if (RelationLogic.Instance())
        {
            RelationLogic.Instance().ShowNewEmailBigRed();
        }

        if (null == curMail)
        {
            return;
        }

        curMail.key        = data.MailGuid;
        curMail.senderType = (GC_MAIL_UPDATE.MailSender)data.SenderType;
        curMail.SenderID   = data.SenderGuid;
        if (curMail.senderType == GC_MAIL_UPDATE.MailSender.MAILSENDER_SYS)
        {
            if (data.HasOrigin && data.Origin == GlobeVar.MAIL_GUILDMAIL_ORIGIN)
            {
                curMail.SenderName = Utils.GetDicByID(4017);
            }
            else
            {
                curMail.SenderName = Utils.GetDicByID(1363);
            }
            if (!string.IsNullOrEmpty(data.TextContent))
            {
                char firstChar = data.TextContent[0];
                if (firstChar != '#')
                {
                    curMail.text = data.TextContent;
                }
                else
                {
                    curMail.text = StrDictionary.GetServerDictionaryFormatString(data.TextContent);
                }
            }
            else
            {
                curMail.text = "";
            }
        }
        else
        {
            curMail.SenderName = data.SenderName;
            curMail.text       = data.TextContent;
        }

        if (!string.IsNullOrEmpty(curMail.text))
        {
            curMail.text = Utils.StrFilter_Mail(curMail.text);
            curMail.text = Utils.StrFilter_Abuse(curMail.text);
        }


        DateTime startTime = new DateTime(1970, 1, 1);
        DateTime sendDate  = new DateTime((long)data.SendTime * 10000000L + startTime.Ticks, DateTimeKind.Unspecified);

        sendDate           = sendDate.ToLocalTime();
        curMail.time       = sendDate.ToString("yyyy-MM-dd");
        curMail.bReaded    = data.ReadTime > 0;
        curMail.itemID     = data.HasItemID ? data.ItemID : -1;
        curMail.itemCount  = data.HasItemCount ? data.ItemCount : 0;
        curMail.moneyType  = data.HasMoneyType ? data.MoneyType : -1;
        curMail.moneyCount = data.HasMoneyCount ? data.MoneyCount : 0;
        curMail.sortTime   = data.SendTime;

        if (null != delMailUpdate)
        {
            delMailUpdate(curUpdateType, data.MailGuid);
        }
    }