示例#1
0
 //AscOrDes:true 升序  false 降序
 public MegMailCellData[] SortMail(MegMailCellData[] arr, bool AscOrDes = true)
 {
     for (int i = 1; i < arr.Length; i++)
     {
         MegMailCellData t = arr[i];
         int             j = i;
         if (AscOrDes)
         {
             while ((j > 0) && (arr[j - 1].ctm > t.ctm))
             {
                 arr[j] = arr[j - 1];
                 --j;
             }
         }
         else
         {
             while ((j > 0) && (arr[j - 1].ctm < t.ctm))
             {
                 arr[j] = arr[j - 1];
                 --j;
             }
         }
         arr[j] = t;
     }
     return(arr);
 }
示例#2
0
    public void SetMailState(int id, int operation)
    {
        MegMailCellData tempcell = null;

        foreach (MegMailCellData cell in list_message)
        {
            if (cell.id == id)
            {
                tempcell = cell;
                break;
            }
        }

        if (operation == 1)
        {
            if (tempcell != null)
            {
                tempcell.status = 1;
            }
        }
        else if (operation == 2)
        {
            if (tempcell != null)
            {
                list_message.Remove(tempcell);
            }
        }
        HaveNewMsg();
    }
示例#3
0
    public MegMailCellData GetMegCellData(int id)
    {
        MegMailCellData data = null;

        foreach (MegMailCellData cell in list_message)
        {
            if (cell.id == id)
            {
                data = cell;
                return(data);
            }
        }
        return(data);
    }
示例#4
0
 void OnClick()
 {
     if (cellType == CellType.Msg)
     {
         //查看邮件
         MegMailCellData celldata = MailReveicer.Instance.GetMegCellData(gameObject.name);
         UIMessageMail.OpenUI(celldata);
     }
     else if (cellType == CellType.Fight)
     {
         FightMegCellData celldata = MailReveicer.Instance.GetFightMegCellData(gameObject.name);
         if (celldata != null)
         {
             if (Core.Data.playerManager.revengeData == null)
             {
                 //如果本地没有复仇进度数据缓存
                 FinalTrialMgr.GetInstance().OnRevengeProgress = (RevengeProgressData rpdata) =>
                 {
                     //网络回调
                     if (rpdata != null)
                     {
                         Core.Data.playerManager.revengeData = rpdata;
                         UIMessageTag.OpenUI(celldata, !System.Convert.ToBoolean(celldata.islost), rpdata);
                     }
                     else
                     {
                         SQYAlertViewMove.CreateAlertViewMove("Server Data Error! revengeData=null");
                     }
                 };
                 FinalTrialMgr.GetInstance().GetRevengeProgress(celldata.id);
             }
             else
             {
                 UIMessageTag.OpenUI(celldata, !System.Convert.ToBoolean(celldata.islost), Core.Data.playerManager.revengeData);
             }
         }
     }
 }
示例#5
0
    //提取附件
    public void GetMailAttachment(int id)
    {
        MegMailCellData tempcell = null;

        foreach (MegMailCellData cell in list_message)
        {
            if (cell.id == id)
            {
                tempcell = cell;
                break;
            }
        }
        Debug.Log(" get mail   attach  ");
        if (tempcell != null)
        {
            Debug.Log(" change state ");
            tempcell.status = 2;
        }
        else
        {
            SQYAlertViewMove.CreateAlertViewMove("find not local mail [" + id.ToString() + "]");
        }
        HaveNewMsg();
    }
示例#6
0
    //设置显示邮件
    public void SetCellData(MegMailCellData data)
    {
        mhead.atlas = AtlasMgr.mInstance.commonAtlas;

        cellType = CellType.Msg;
        if (FightOrMsg.activeSelf)
        {
            FightOrMsg.SetActive(false);
        }

        gameObject.name = data.id.ToString();

        if (data.cName != null)
        {
            mName.text = Core.Data.stringManager.getString(25042) + data.cName.ToString();
        }

        long timecha  = Core.TimerEng.curTime - (long)data.ctm;
        long showtime = timecha / 3600;

        if (showtime <= 0)
        {
            mTime.text = Core.Data.stringManager.getString(9041);
        }
        else if (showtime / 24 == 0)
        {
            mTime.text = Core.Data.stringManager.getString(25041).Replace("{0}", showtime.ToString());
        }
        else
        {
            mTime.text = Core.Data.stringManager.getString(25095).Replace("{0}", ((int)(showtime / 24f)).ToString());
        }


        mDescript.text = data.content.Length > 20  ? data.content.Substring(0, 20) + "..." : data.content;
        // 1:系统消息,2:玩家留言
        if (data.type == 1)
        {
            if (data.attachment != null && data.attachment.Length > 0)
            {
                mhead.spriteName = "common-1011";
                //有附件
                if (data.status == 0)
                {
                    mhead.color = new Color(1f, 1f, 1f, 1f);
                }
                // mhead.spriteName = "common-1011";
                else if (data.status == 2)
                {
                    //mhead.spriteName = "common-1014";
                    mhead.color = new Color(0, 0, 0, 1f);
                }
            }
            else
            {
                mhead.spriteName = "common-1013";
                //没有附件
                if (data.status == 0)                   //未读
                //mhead.spriteName = "common-1013";
                {
                    mhead.color = new Color(1f, 1f, 1f, 1f);
                }
                else if (data.status == 1 || data.status == 2)                  //已读
                // mhead.spriteName = "common-1014";
                {
                    mhead.color = new Color(0, 0, 0, 1f);
                }
            }
        }
        else if (data.type == 2)
        {
            mhead.spriteName = "common-1012";
            if (data.status == 0)              //未读
            {
                mhead.color = new Color(1f, 1f, 1f, 1f);
            }
            // mhead.spriteName = "common-1012";
            else if (data.status == 1)              //已读
            {
                mhead.color = new Color(0, 0, 0, 1f);
            }
            //mhead.spriteName = "common-10121";
        }

        mLevel.text = "Lv" + data.cLevel.ToString();

        mhead.MakePixelPerfect();
    }
示例#7
0
    //初始化读取邮件功能
    void InitReadMail(MegMailCellData data)
    {
        isShowAttachment = true;

        this.mailData = data;

        // 1:系统消息,2:玩家留言
        if (data.type == 1)
        {
            if (data.attachment != null && data.attachment.Length > 0)
            {
                //有附件
                if (data.status == 0)
                {
                    MailButton.name = "GetReward";
                    MailButton.GetComponentInChildren <UILabel>().text = Core.Data.stringManager.getString(9042);
                }
                else if (data.status == 2)
                {
                    //已提取
                    MailButton.name = "Delete";
                    MailButton.GetComponentInChildren <UILabel>().text = Core.Data.stringManager.getString(6089);
                }
            }
            else
            {
                //没有附件
                MailButton.name = "Delete";
                MailButton.GetComponentInChildren <UILabel>().text = Core.Data.stringManager.getString(6089);
            }
        }
        else if (data.type == 2)
        {
            isShowAttachment = false;
            //玩家留言
            MailButton.name = "Delete";
            MailButton.GetComponentInChildren <UILabel>().text = Core.Data.stringManager.getString(6089);
            MailButton.transform.localPosition = new Vector3(-125f, -250f, 0);
            ReplyButton.gameObject.SetActive(true);
            ReplyButton.transform.localPosition = new Vector3(125f, -250f, 0);

            SetMailRead(data.id);
        }

        mNum.gameObject.SetActive(false);
        mInput.GetComponent <BoxCollider>().enabled = false;
        mInput.characterLimit = 0;
        if (mInput.gameObject.activeSelf)
        {
            mInput.value = data.cName + ":\n    " + data.content;
        }
        else
        {
            SetLab_ShowMail(data.cName + ":\n    " + data.content);
        }



        //显示附件
        if (data.attachment != null)
        {
            if (data.status == 0)
            {
                for (int i = 0; i < data.attachment.Length; i++)
                {
                    list_Attachments[i].isReceived = false;
                    list_Attachments[i].SetData(data.attachment[i]);
                }
            }
            else if (data.status == 2)
            {
                for (int i = 0; i < data.attachment.Length; i++)
                {
                    list_Attachments[i].isReceived = true;
                    list_Attachments[i].SetData(data.attachment[i]);
                }
            }
        }
    }
示例#8
0
 public static UIMessageMail OpenUI(MegMailCellData data)
 {
     OpenUI(0);
     _this.InitReadMail(data);
     return(_this);
 }