Пример #1
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;
                    }
                }
            }
        }
Пример #2
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;
                    }
                }
            }
        }
Пример #3
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);
        }
Пример #4
0
        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);
        }
Пример #5
0
        private void RefreshMailTitle(uint id)
        {
            GameObject gameObject = null;

            this.title_gos.TryGetValue(id, out gameObject);
            bool flag = gameObject == null;

            if (!flag)
            {
                Image         component     = gameObject.transform.FindChild("icon").GetComponent <Image>();
                Image         component2    = gameObject.transform.FindChild("icon").GetComponent <Image>();
                Text          component3    = gameObject.transform.FindChild("title").GetComponent <Text>();
                Text          component4    = gameObject.transform.FindChild("from").GetComponent <Text>();
                A3_MailSimple a3_MailSimple = ModelBase <A3_MailModel> .getInstance().mail_simple[id];

                bool has_itm = a3_MailSimple.has_itm;
                if (has_itm)
                {
                    bool got_itm = a3_MailSimple.got_itm;
                    if (got_itm)
                    {
                        component.sprite  = (Resources.Load("icon/itemborder/b039_03", typeof(Sprite)) as Sprite);
                        component2.sprite = (Resources.Load("icon/mail/mail_sign2", typeof(Sprite)) as Sprite);
                    }
                    else
                    {
                        component.sprite  = (Resources.Load("icon/itemborder/b039_04", typeof(Sprite)) as Sprite);
                        component2.sprite = (Resources.Load("icon/mail/mail_sign1", typeof(Sprite)) as Sprite);
                    }
                }
                else
                {
                    component.sprite = (Resources.Load("icon/itemborder/b039_01", typeof(Sprite)) as Sprite);
                }
                bool flag2 = a3_MailSimple.flag;
                if (flag2)
                {
                    component3.text = "<color=#808080>" + a3_MailSimple.title + "</color>";
                    component4.text = "<color=#808080>" + a3_MailSimple.tp + "</color>";
                }
                else
                {
                    component3.text = "<color=#FFFFFF>" + a3_MailSimple.title + "</color>";
                    component4.text = "<color=#FFFFFF>" + a3_MailSimple.tp + "</color>";
                }
            }
        }
Пример #6
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>";
            }
        }
Пример #7
0
        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;
        }
Пример #8
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;
            }
        }
Пример #9
0
        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;
            }
        }
Пример #10
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;
        }