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); }
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)); } }
private void RefreshMailContent(int id) { this.mailtitle.gameObject.SetActive(false); this.mailcontent.gameObject.SetActive(false); this.fajianren2.gameObject.SetActive(false); this.time2.gameObject.SetActive(false); this.hint.gameObject.SetActive(false); this.del1.gameObject.SetActive(false); this.get.gameObject.SetActive(false); this.del2.gameObject.SetActive(false); this.tx_infos.gameObject.SetActive(false); for (int i = 0; i < this.itmGrid.transform.childCount; i++) { UnityEngine.Object.Destroy(this.itmGrid.transform.GetChild(i).gameObject); } for (int j = 0; j < this.coinGrid.transform.childCount; j++) { UnityEngine.Object.Destroy(this.coinGrid.transform.GetChild(j).gameObject); } bool flag = ModelBase <A3_MailModel> .getInstance().mail_simple.Count == 0; if (flag) { this.hint.gameObject.SetActive(true); this.hint.text = ContMgr.getCont("mail_hint_1", null); } else { bool flag2 = id == -1 || !ModelBase <A3_MailModel> .getInstance().mail_details.ContainsKey((uint)id); if (flag2) { this.hint.gameObject.SetActive(true); this.hint.text = ContMgr.getCont("mail_hint_2", null); } else { A3_MailDetail a3_MailDetail = ModelBase <A3_MailModel> .getInstance().mail_details[(uint)id]; this.mailtitle.gameObject.SetActive(true); this.mailtitle.text = a3_MailDetail.ms.title; this.fajianren2.gameObject.SetActive(true); this.fajianren2.text = a3_MailDetail.ms.tp; this.time2.gameObject.SetActive(true); string strTime = Globle.getStrTime((int)a3_MailDetail.ms.tm, false, true); this.time2.text = strTime; this.mailcontent.gameObject.SetActive(true); this.mailcontent.text = a3_MailDetail.msg; bool flag3 = !a3_MailDetail.ms.has_itm; if (flag3) { this.del2.gameObject.SetActive(true); } else { bool flag4 = a3_MailDetail.money > 0u; if (flag4) { this.CreateCoinIcon("coin1", a3_MailDetail.money); } bool flag5 = a3_MailDetail.yb > 0u; if (flag5) { this.CreateCoinIcon("coin2", a3_MailDetail.yb); } bool flag6 = a3_MailDetail.bndyb > 0u; if (flag6) { this.CreateCoinIcon("coin3", a3_MailDetail.bndyb); } for (int k = 0; k < a3_MailDetail.itms.Count; k++) { a3_BagItemData data = a3_MailDetail.itms[k]; GameObject gameObject = IconImageMgr.getInstance().createA3ItemIcon(data, true, data.num, 1f, false); gameObject.transform.SetParent(this.itmGrid.transform, false); bool flag7 = data.num <= 1; if (flag7) { gameObject.transform.FindChild("num").gameObject.SetActive(false); } BaseButton baseButton = new BaseButton(gameObject.transform, 1, 1); baseButton.onClick = delegate(GameObject go) { this.onMailItemClick(data); }; } bool got_itm = a3_MailDetail.ms.got_itm; if (got_itm) { this.del2.gameObject.SetActive(true); this.tx_infos.gameObject.SetActive(true); this.tx_infos.text = ContMgr.getCont("mail_hint_0", null); for (int l = 0; l < this.itmGrid.transform.childCount; l++) { UnityEngine.Object.Destroy(this.itmGrid.transform.GetChild(l).gameObject); } for (int m = 0; m < this.coinGrid.transform.childCount; m++) { UnityEngine.Object.Destroy(this.coinGrid.transform.GetChild(m).gameObject); } } else { this.del1.gameObject.SetActive(true); this.get.gameObject.SetActive(true); } } } } }
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)); }
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 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); } } } }