Beispiel #1
0
        private void SortMailList()
        {
            this.sortedList.Clear();
            A3_MailModel instance = ModelBase <A3_MailModel> .getInstance();

            foreach (KeyValuePair <uint, A3_MailSimple> current in instance.mail_simple)
            {
                this.sortedList.Add(current.Value);
            }
            int count = this.sortedList.Count;

            for (int i = 0; i < count; i++)
            {
                for (int j = i + 1; j < count; j++)
                {
                    bool flag = this.sortedList[i].tm < this.sortedList[j].tm;
                    if (flag)
                    {
                        A3_MailSimple value = this.sortedList[i];
                        this.sortedList[i] = this.sortedList[j];
                        this.sortedList[j] = value;
                    }
                }
            }
        }
Beispiel #2
0
        private void SortMailList()
        {
            sortedList.Clear();

            A3_MailModel mm = A3_MailModel.getInstance();

            foreach (var mail in mm.mail_simple)
            {
                sortedList.Add(mail.Value);
            }
            int count = sortedList.Count;

            for (int i = 0; i < count; i++)
            {
                for (int j = i + 1; j < count; j++)
                {
                    if (sortedList[i].tm < sortedList[j].tm)
                    {
                        A3_MailSimple temp = sortedList[i];
                        sortedList[i] = sortedList[j];
                        sortedList[j] = temp;
                    }
                }
            }
        }
Beispiel #3
0
        private void OnDeleteAll(Variant data)
        {
            A3_MailModel instance = ModelBase <A3_MailModel> .getInstance();

            Variant variant = data["ids"];

            using (List <Variant> .Enumerator enumerator = variant._arr.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    uint key  = enumerator.Current;
                    bool flag = instance.mail_simple.ContainsKey(key);
                    if (flag)
                    {
                        instance.mail_simple.Remove(key);
                    }
                    bool flag2 = instance.mail_details.ContainsKey(key);
                    if (flag2)
                    {
                        instance.mail_details[key].ms.got_itm = true;
                    }
                }
            }
            base.dispatchEvent(GameEvent.Create(A3_MailProxy.MAIL_DELETE_ALL, this, data, false));
        }
Beispiel #4
0
        private void OnMailTitleClick(GameObject evt_go)//点击邮件列表
        {
            GameObject go;

            if (read_id != -1)
            {
                go = null;
                title_gos.TryGetValue((uint)read_id, out go);
                if (go != null)
                {
                    go.transform.FindChild("select").gameObject.SetActive(false);
                }
            }

            read_id = int.Parse(evt_go.name);
            go      = null;
            title_gos.TryGetValue((uint)read_id, out go);
            if (go != null)
            {
                go.transform.FindChild("select").gameObject.SetActive(true);
                getTransformByPath("right2/scroll_view/contain").localPosition = containPos;
            }

            if (A3_MailModel.getInstance().mail_details.ContainsKey((uint)read_id))
            {
                RefreshMailContent(read_id);
            }
            else
            {
                A3_MailProxy.getInstance().GetMailContent((uint)read_id);
            }
        }
Beispiel #5
0
        private void OnGetAll(Variant data)
        {
            A3_MailModel instance = ModelBase <A3_MailModel> .getInstance();

            Variant variant = data["ids"];

            using (List <Variant> .Enumerator enumerator = variant._arr.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    uint key = enumerator.Current;
                    instance.mail_simple[key].got_itm = true;
                    bool flag = instance.mail_details.ContainsKey(key);
                    if (flag)
                    {
                        instance.mail_details[key].ms.got_itm = true;
                    }
                }
            }
            bool flag2 = variant._arr.Count > 0 || data["itm"]["itm"]._arr.Count > 0;

            if (flag2)
            {
                flytxt.instance.fly(ContMgr.getCont("mail_hint_7", null), 0, default(Color), null);
            }
            base.dispatchEvent(GameEvent.Create(A3_MailProxy.MAIL_GET_ALL, this, null, false));
        }
Beispiel #6
0
        private void OnRemoveMail(Variant data)
        {
            uint         num      = data["id"];
            A3_MailModel instance = ModelBase <A3_MailModel> .getInstance();

            instance.mail_simple.Remove(num);
            instance.mail_details.Remove(num);
            base.dispatchEvent(GameEvent.Create(A3_MailProxy.MAIL_REMOVE_ONE, this, num, false));
        }
        private void OnRemoveMail(Variant data)
        {
            uint         id = data["id"];
            A3_MailModel mm = A3_MailModel.getInstance();

            mm.mail_simple.Remove(id);
            mm.mail_details.Remove(id);

            dispatchEvent(GameEvent.Create(MAIL_REMOVE_ONE, this, id));
        }
Beispiel #8
0
 private void OnDeleteAllClick()
 {
     if (A3_MailModel.getInstance().HasItemInMails())
     {
         MsgBoxMgr.getInstance().showConfirm(ContMgr.getCont("mail_hint_3"), ConfirmDeleteAll);
     }
     else
     {
         ConfirmDeleteAll();
     }
 }
Beispiel #9
0
 private void OnRemoveClick()
 {
     if (A3_MailModel.getInstance().HasItemInMail((uint)read_id))
     {
         MsgBoxMgr.getInstance().showConfirm(ContMgr.getCont("mail_hint_4"), ConfirmDelete);
     }
     else
     {
         ConfirmDelete();
     }
 }
Beispiel #10
0
        private void OnGetAttachment(Variant data)
        {
            uint         num      = data["id"];
            A3_MailModel instance = ModelBase <A3_MailModel> .getInstance();

            A3_MailSimple a3_MailSimple = instance.mail_simple[num];
            A3_MailDetail a3_MailDetail = instance.mail_details[num];

            a3_MailSimple.got_itm    = true;
            a3_MailDetail.ms.got_itm = true;
            base.dispatchEvent(GameEvent.Create(A3_MailProxy.MAIL_GET_ATTACHMENT, this, num, false));
            BaseProxy <A3_MailProxy> .getInstance().RemoveMail(num);
        }
        private void OnGetAttachment(Variant data)
        {
            uint          id = data["id"];
            A3_MailModel  mm = A3_MailModel.getInstance();
            A3_MailSimple ms = mm.mail_simple[id];
            A3_MailDetail md = mm.mail_details[id];

            ms.got_itm    = true;
            md.ms.got_itm = true;

            dispatchEvent(GameEvent.Create(MAIL_GET_ATTACHMENT, this, id));

            A3_MailProxy.getInstance().RemoveMail(id);
        }
Beispiel #12
0
        private void OnGetAttachment(GameEvent e)
        {
            flytxt.instance.fly(ContMgr.getCont("mail_hint_5"));
            uint mailid = (uint)e.orgdata;

            RefreshMailContent((int)mailid);
            RefreshMailTitle(mailid);

            A3_MailDetail mdetail = A3_MailModel.getInstance().mail_details[(uint)mailid];

            for (int i = 0; i < mdetail.itms.Count; i++)
            {
                a3_BagItemData data = mdetail.itms[i];
                flytxt.instance.fly(a3_BagModel.getInstance().getItemDataById(data.tpid).item_name + "*" + (data.num <= 1?1:data.num));
            }
        }
Beispiel #13
0
        private void RefreshMailTitle(uint id)//更新邮件的标题栏
        {
            GameObject go = null;

            title_gos.TryGetValue(id, out go);
            if (go == null)
            {
                return;
            }

            Image icon   = go.transform.FindChild("icon").GetComponent <Image>();
            Image icon03 = go.transform.FindChild("icon").GetComponent <Image>();
            Text  title  = go.transform.FindChild("title").GetComponent <Text>();
            Text  from   = go.transform.FindChild("from").GetComponent <Text>();

            A3_MailSimple mdata = A3_MailModel.getInstance().mail_simple[id];

            if (mdata.has_itm)
            {
                if (mdata.got_itm)
                {//!--有附件已领
                    icon.sprite   = GAMEAPI.ABUI_LoadSprite("icon_itemborder_b039_03");
                    icon03.sprite = GAMEAPI.ABUI_LoadSprite("icon_mail_mail_sign2");
                }
                else
                {//!--有附件未领
                    icon.sprite   = GAMEAPI.ABUI_LoadSprite("icon_itemborder_b039_04");
                    icon03.sprite = GAMEAPI.ABUI_LoadSprite("icon_mail_mail_sign1");
                }
            }
            else
            {//!--无附件
                icon.sprite = GAMEAPI.ABUI_LoadSprite("icon_itemborder_b039_01");
            }

            if (mdata.flag)
            {//!--已读
                title.text = "<color=#808080>" + mdata.title + "</color>";
                from.text  = "<color=#808080>" + mdata.tp + "</color>";
            }
            else
            {//!--未读
                title.text = "<color=#FFFFFF>" + mdata.title + "</color>";
                from.text  = "<color=#FFFFFF>" + mdata.tp + "</color>";
            }
        }
        private void OnDeleteAll(Variant data)
        {
            A3_MailModel mm      = A3_MailModel.getInstance();
            Variant      get_ids = data["ids"];

            foreach (uint id in get_ids._arr)
            {
                if (mm.mail_simple.ContainsKey(id))
                {
                    mm.mail_simple.Remove(id);
                }
                if (mm.mail_details.ContainsKey(id))
                {
                    mm.mail_details[id].ms.got_itm = true;
                }
            }
            dispatchEvent(GameEvent.Create(MAIL_DELETE_ALL, this, data));
        }
        private void OnGetAll(Variant data)
        {
            A3_MailModel mm      = A3_MailModel.getInstance();
            Variant      get_ids = data["ids"];

            foreach (uint id in get_ids._arr)
            {
                mm.mail_simple[id].got_itm = true;
                if (mm.mail_details.ContainsKey(id))
                {
                    mm.mail_details[id].ms.got_itm = true;
                }
            }
            if (get_ids._arr.Count > 0 || data["itm"]["itm"]._arr.Count > 0)
            {
                flytxt.instance.fly(ContMgr.getCont("mail_hint_7"));
            }
            dispatchEvent(GameEvent.Create(MAIL_GET_ALL, this, null));
        }
        private void OnNewMail(Variant mail)
        {
            A3_MailModel  mm    = A3_MailModel.getInstance();
            A3_MailSimple mdata = new A3_MailSimple();

            mdata.id      = mail["id"];
            mdata.tm      = mail["tm"];
            mdata.tp      = ContMgr.getCont("mail_type_" + mail["tp"]);
            mdata.got_itm = false;
            mdata.flag    = mail["flag"];
            mdata.title   = ConvertString(mail["title"], "mail_title_");
            mdata.has_itm = mail["has_itm"];
            if (mm.mail_simple.ContainsKey(mdata.id))
            {
                mm.mail_simple.Remove(mdata.id);
            }
            mm.mail_simple[mdata.id] = mdata;
            dispatchEvent(GameEvent.Create(MAIL_NEW_MAIL, this, mdata));
            a3_mail.expshowid = (int)mdata.id;
        }
Beispiel #17
0
        private void OnGetMailList(Variant data)
        {
            A3_MailModel instance = ModelBase <A3_MailModel> .getInstance();

            instance.mail_simple.Clear();
            Variant variant = data["mails"];

            foreach (Variant current in variant._arr)
            {
                A3_MailSimple a3_MailSimple = new A3_MailSimple();
                a3_MailSimple.id      = current["id"];
                a3_MailSimple.tm      = current["tm"];
                a3_MailSimple.tp      = ContMgr.getCont("mail_type_" + current["tp"], null);
                a3_MailSimple.got_itm = current["got_itm"];
                a3_MailSimple.flag    = current["flag"];
                a3_MailSimple.title   = this.ConvertString(current["title"], "mail_title_");
                a3_MailSimple.has_itm = current["has_itm"];
                instance.mail_simple[a3_MailSimple.id] = a3_MailSimple;
            }
        }
        private void OnGetMailList(Variant data)
        {
            A3_MailModel mm = A3_MailModel.getInstance();

            mm.mail_simple.Clear();

            Variant mails = data["mails"];

            foreach (var mail in mails._arr)
            {
                A3_MailSimple mdata = new A3_MailSimple();
                mdata.id                 = mail["id"];
                mdata.tm                 = mail["tm"];
                mdata.tp                 = ContMgr.getCont("mail_type_" + mail["tp"]);
                mdata.got_itm            = mail["got_itm"];
                mdata.flag               = mail["flag"];
                mdata.title              = ConvertString(mail["title"], "mail_title_");
                mdata.has_itm            = mail["has_itm"];
                mm.mail_simple[mdata.id] = mdata;
            }
        }
Beispiel #19
0
        private void OnNewMail(Variant mail)
        {
            A3_MailModel instance = ModelBase <A3_MailModel> .getInstance();

            A3_MailSimple a3_MailSimple = new A3_MailSimple();

            a3_MailSimple.id      = mail["id"];
            a3_MailSimple.tm      = mail["tm"];
            a3_MailSimple.tp      = ContMgr.getCont("mail_type_" + mail["tp"], null);
            a3_MailSimple.got_itm = false;
            a3_MailSimple.flag    = mail["flag"];
            a3_MailSimple.title   = this.ConvertString(mail["title"], "mail_title_");
            a3_MailSimple.has_itm = mail["has_itm"];
            bool flag = instance.mail_simple.ContainsKey(a3_MailSimple.id);

            if (flag)
            {
                instance.mail_simple.Remove(a3_MailSimple.id);
            }
            instance.mail_simple[a3_MailSimple.id] = a3_MailSimple;
            base.dispatchEvent(GameEvent.Create(A3_MailProxy.MAIL_NEW_MAIL, this, a3_MailSimple, false));
            a3_mail.expshowid = (int)a3_MailSimple.id;
        }
Beispiel #20
0
        private void OnGetOneMail(Variant data)
        {
            A3_MailModel instance = ModelBase <A3_MailModel> .getInstance();

            uint num  = data["id"];
            bool flag = instance.mail_details.ContainsKey(num);

            if (flag)
            {
                instance.mail_details.Remove(num);
            }
            A3_MailDetail a3_MailDetail = new A3_MailDetail();

            a3_MailDetail.ms         = instance.mail_simple[num];
            a3_MailDetail.ms.id      = num;
            a3_MailDetail.ms.tp      = ContMgr.getCont("mail_type_" + data["tp"], null);
            a3_MailDetail.ms.tm      = data["tm"];
            a3_MailDetail.ms.got_itm = data["got_itm"];
            a3_MailDetail.ms.flag    = true;
            a3_MailDetail.msg        = this.ConvertString(data["msg"], "mail_content_");
            a3_MailDetail.itms       = new List <a3_BagItemData>();
            bool flag2 = data.ContainsKey("itm");

            if (flag2)
            {
                Variant variant = data["itm"];
                bool    flag3   = variant.ContainsKey("money");
                if (flag3)
                {
                    a3_MailDetail.money = variant["money"];
                }
                bool flag4 = variant.ContainsKey("yb");
                if (flag4)
                {
                    a3_MailDetail.yb = variant["yb"];
                }
                bool flag5 = variant.ContainsKey("bndyb");
                if (flag5)
                {
                    a3_MailDetail.bndyb = variant["bndyb"];
                }
                bool flag6 = variant.ContainsKey("itm");
                if (flag6)
                {
                    Variant variant2 = variant["itm"];
                    foreach (Variant current in variant2._arr)
                    {
                        a3_BagItemData a3_BagItemData = default(a3_BagItemData);
                        a3_BagItemData.tpid     = current["tpid"];
                        a3_BagItemData.num      = current["cnt"];
                        a3_BagItemData.confdata = ModelBase <a3_BagModel> .getInstance().getItemDataById(a3_BagItemData.tpid);

                        a3_MailDetail.itms.Add(a3_BagItemData);
                    }
                }
                bool flag7 = variant.ContainsKey("eqp");
                if (flag7)
                {
                    Variant variant3 = variant["eqp"];
                    foreach (Variant current2 in variant3._arr)
                    {
                        a3_BagItemData a3_BagItemData2 = default(a3_BagItemData);
                        bool           flag8           = current2.ContainsKey("tpid");
                        if (flag8)
                        {
                            a3_BagItemData2.tpid = current2["tpid"];
                        }
                        bool flag9 = current2.ContainsKey("bnd");
                        if (flag9)
                        {
                            a3_BagItemData2.bnd = current2["bnd"];
                        }
                        a3_BagItemData2 = ModelBase <a3_EquipModel> .getInstance().equipData_read(a3_BagItemData2, current2);

                        a3_BagItemData2.confdata = ModelBase <a3_BagModel> .getInstance().getItemDataById(a3_BagItemData2.tpid);

                        a3_MailDetail.itms.Add(a3_BagItemData2);
                    }
                }
            }
            instance.mail_details[num] = a3_MailDetail;
            base.dispatchEvent(GameEvent.Create(A3_MailProxy.MAIL_NEW_MAIL_CONTENT, this, num, false));
        }
        private void OnGetOneMail(Variant data)
        {
            A3_MailModel mm = A3_MailModel.getInstance();

            uint mailid = data["id"];

            if (mm.mail_details.ContainsKey(mailid))
            {
                mm.mail_details.Remove(mailid);
            }

            A3_MailDetail mdetail = new A3_MailDetail();

            mdetail.ms         = mm.mail_simple[mailid];
            mdetail.ms.id      = mailid;
            mdetail.ms.tp      = ContMgr.getCont("mail_type_" + data["tp"]);
            mdetail.ms.tm      = data["tm"];
            mdetail.ms.got_itm = data["got_itm"];
            mdetail.ms.flag    = true;
            mdetail.msg        = ConvertString(data["msg"], "mail_content_");
            mdetail.itms       = new List <a3_BagItemData>();

            if (data.ContainsKey("itm"))
            {
                Variant itms = data["itm"];

                if (itms.ContainsKey("money"))
                {
                    mdetail.money = itms["money"];
                }

                if (itms.ContainsKey("yb"))
                {
                    mdetail.yb = itms["yb"];
                }

                if (itms.ContainsKey("bndyb"))
                {
                    mdetail.bndyb = itms["bndyb"];
                }

                if (itms.ContainsKey("itm"))
                {
                    Variant itmary = itms["itm"];
                    foreach (var itm in itmary._arr)
                    {
                        a3_BagItemData itemData = new a3_BagItemData();
                        itemData.tpid     = itm["tpid"];
                        itemData.num      = itm["cnt"];
                        itemData.confdata = a3_BagModel.getInstance().getItemDataById(itemData.tpid);
                        mdetail.itms.Add(itemData);
                    }
                }
                if (itms.ContainsKey("eqp"))
                {
                    Variant eqpary = itms["eqp"];
                    foreach (var itm in eqpary._arr)
                    {
                        a3_BagItemData itemData = new a3_BagItemData();
                        if (itm.ContainsKey("tpid"))
                        {
                            itemData.tpid = itm["tpid"];
                        }

                        if (itm.ContainsKey("bnd"))
                        {
                            itemData.bnd = itm["bnd"];
                        }

                        a3_EquipModel.getInstance().equipData_read(itemData, itm);
                        itemData.confdata = a3_BagModel.getInstance().getItemDataById(itemData.tpid);
                        mdetail.itms.Add(itemData);
                    }
                }
            }
            mm.mail_details[mailid] = mdetail;
            dispatchEvent(GameEvent.Create(MAIL_NEW_MAIL_CONTENT, this, mailid));
        }
Beispiel #22
0
 private void RefreshMailCnt()
 {
     cnt.text = ContMgr.getCont("mail_cnt", new List <string> {
         A3_MailModel.getInstance().mail_simple.Count.ToString()
     });
 }
Beispiel #23
0
        private void RefreshMailContent(int id)//更新邮件的信息
        {
            mailtitle.gameObject.SetActive(false);
            mailcontent.gameObject.SetActive(false);
            fajianren2.gameObject.SetActive(false);
            time2.gameObject.SetActive(false);
            hint.gameObject.SetActive(false);
            del1.gameObject.SetActive(false);
            get.gameObject.SetActive(false);
            del2.gameObject.SetActive(false);
            tx_infos.gameObject.SetActive(false);
            for (int i = 0; i < itmGrid.transform.childCount; i++)
            {
                Destroy(itmGrid.transform.GetChild(i).gameObject);
            }
            for (int i = 0; i < coinGrid.transform.childCount; i++)//创造网格
            {
                Destroy(coinGrid.transform.GetChild(i).gameObject);
            }

            if (A3_MailModel.getInstance().mail_simple.Count == 0)
            {
                hint.gameObject.SetActive(true);
                hint.text = ContMgr.getCont("mail_hint_1");
                return;
            }

            if (id == -1 || !A3_MailModel.getInstance().mail_details.ContainsKey((uint)id))
            {//未选中邮件或邮件数据不存在
                hint.gameObject.SetActive(true);
                hint.text = ContMgr.getCont("mail_hint_2");
            }
            else
            {
                A3_MailDetail mdetail = A3_MailModel.getInstance().mail_details[(uint)id];

                mailtitle.gameObject.SetActive(true);
                mailtitle.text = mdetail.ms.title;

                fajianren2.gameObject.SetActive(true);
                fajianren2.text = mdetail.ms.tp;

                time2.gameObject.SetActive(true);
                string ts = MuGame.Globle.getStrTime((int)mdetail.ms.tm);
                time2.text = ts;

                mailcontent.gameObject.SetActive(true);
                mailcontent.text = mdetail.msg;

                if (!mdetail.ms.has_itm)
                {//!--没有附件
                    del2.gameObject.SetActive(true);
                }
                else
                {//!--有附件
                    GameObject icon;
                    if (mdetail.money != 0)
                    {
                        CreateCoinIcon("coin1", mdetail.money);
                    }
                    if (mdetail.yb != 0)
                    {
                        CreateCoinIcon("coin2", mdetail.yb);
                    }
                    if (mdetail.bndyb != 0)
                    {
                        CreateCoinIcon("coin3", mdetail.bndyb);
                    }
                    for (int i = 0; i < mdetail.itms.Count; i++)
                    {
                        a3_BagItemData data = mdetail.itms[i];
                        icon = IconImageMgr.getInstance().createA3ItemIcon(data, true, data.num);
                        icon.transform.SetParent(itmGrid.transform, false);
                        if (data.num <= 1)
                        {
                            icon.transform.FindChild("num").gameObject.SetActive(false);
                        }

                        BaseButton bs_bt = new BaseButton(icon.transform);
                        bs_bt.onClick = delegate(GameObject go) { this.onMailItemClick(data); };
                    }

                    if (mdetail.ms.got_itm)
                    {//!--已领取
                        del2.gameObject.SetActive(true);
                        tx_infos.gameObject.SetActive(true);
                        tx_infos.text = ContMgr.getCont("mail_hint_0");
                        for (int i = 0; i < itmGrid.transform.childCount; i++)
                        {
                            Destroy(itmGrid.transform.GetChild(i).gameObject);
                        }
                        for (int i = 0; i < coinGrid.transform.childCount; i++)//创造网格
                        {
                            Destroy(coinGrid.transform.GetChild(i).gameObject);
                        }
                    }
                    else
                    {//!--未领取
                        del1.gameObject.SetActive(true);
                        get.gameObject.SetActive(true);
                    }
                }
            }
        }