void OnLegion(Variant data) { int res = data["res"]; debug.Log("军团消息" + data.dump()); //if (res < 0) //{ // Globle.err_output(res); // return; //} Variant vd = new Variant(); switch (res) { case EVENT_GETINFO: //if (data.ContainsKey("direct_join_clan")) //{ //} if (data.ContainsKey("id")) { A3_LegionData d = new A3_LegionData(); d.id = data["id"]; d.lvl = data["lvl"]; d.clname = data["clname"]; d.name = data["name"]; d.notice = data["notice"]; d.gold = data["money"]; d.plycnt = data["plycnt"]; d.exp = data["clan_pt"]; if (data.ContainsKey("ol_cnt")) { d.ol_cnt = data["ol_cnt"]; } if (data.ContainsKey("combpt")) { d.combpt = data["combpt"]; } if (data.ContainsKey("rankidx")) { d.rankidx = data["rankidx"]; } if (data.ContainsKey("clanc")) { d.clanc = data["clanc"]; } d.anabasis_tm = data["anabasis_tm"]; A3_LegionModel.getInstance().myLegion = d; int b = data["direct_join"]; A3_LegionModel.getInstance().CanAutoApply = b == 1 ? true : false; A3_LegionModel.getInstance().SetMyLegion(d.lvl); A3_LegionModel.getInstance().donate = data["donate"]; // a3_legion_info.mInstance.jx_up(d.gold,d.lvl); gold = d.gold; lvl = d.lvl; } else { A3_LegionModel.getInstance().myLegion = new A3_LegionData(); } dispatchEvent(GameEvent.Create(EVENT_GETINFO, this, data)); break; case EVENT_CREATE: dispatchEvent(GameEvent.Create(EVENT_CREATE, this, data)); removeEventListener(A3_LegionProxy.EVENT_CHECKNAME, a3_legion.mInstance.SetCheckName); //a3_herohead.instance.legion_bf = true; //a3_herohead.instance.isclear = true; //if (a3_herohead.instance != null) // a3_herohead.instance.refresBuff(); break; case EVENT_APPLYFOR: int clid = data["clid"]; dispatchEvent(GameEvent.Create(EVENT_APPLYFOR, this, data)); flytxt.instance.fly(ContMgr.getCont("Legion_ok")); break; case EVENT_LVUP: A3_LegionModel.getInstance().myLegion.gold = data["money"]; A3_LegionModel.getInstance().myLegion.lvl = data["lvl"]; A3_LegionModel.getInstance().myLegion.exp = 0; A3_LegionModel.getInstance().SetMyLegion(A3_LegionModel.getInstance().myLegion.lvl); dispatchEvent(GameEvent.Create(EVENT_GETINFO, this, data)); flytxt.instance.fly(ContMgr.getCont("Legionup_ok")); break; case EVENT_GETMEMBER: //14 vd = data["pls"]; A3_LegionModel.getInstance().members.Clear(); foreach (var v in vd._arr) { A3_LegionModel.getInstance().AddMember(v); } dispatchEvent(GameEvent.Create(EVENT_GETMEMBER, this, data)); //if (a3_legion.mInstance == null) // cacheProxyData = data; break; case EVENT_APPROVEORREJECT: dispatchEvent(GameEvent.Create(EVENT_APPROVEORREJECT, this, data)); break; case EVENT_QUIT: A3_LegionModel.getInstance().myLegion = new A3_LegionData(); dispatchEvent(GameEvent.Create(EVENT_QUIT, this, data)); if (a3_task_auto.instance.executeTask?.taskT == TaskType.CLAN) { SelfRole.fsm.Stop(); flytxt.instance.fly(ContMgr.getCont("Legion_out")); } else { flytxt.instance.fly(ContMgr.getCont("Legionout_ok")); } //a3_herohead.instance.legion_bf = false; //a3_herohead.instance.isclear =true; //if (a3_herohead.instance != null) // a3_herohead.instance.refresBuff(); break; case EVENT_UPBUFF: flytxt.instance.fly(ContMgr.getCont("Legionbuff_up")); break; case EVENT_DONATE: int money = data["money"]; //flytxt.instance.fly("获得了" + money / 1000 + "点贡献度"); flytxt.instance.fly(ContMgr.getCont("Legiondonate_add", new List <string> { (money / 1000).ToString() })); SendGetInfo(); break; case EVENT_GETAPPLICANT: A3_LegionModel.getInstance().RefreshApplicant(data); dispatchEvent(GameEvent.Create(EVENT_GETAPPLICANT, this, data)); break; case EVENT_CHANGENOTICE: dispatchEvent(GameEvent.Create(EVENT_CHANGENOTICE, this, data)); break; case EVENT_INVITE: dispatchEvent(GameEvent.Create(EVENT_INVITE, this, data)); break; case EVENT_BELEADER: SendGetMember(); break; case EVENT_GETDIARY: if (data != null && data.ContainsKey("clanlog_list") && data["clanlog_list"]._arr.Count > 0) { A3_LegionModel.getInstance().AddLog(data); } dispatchEvent(GameEvent.Create(EVENT_GETDIARY, this, data)); break; case EVENT_APPLYMODE: int c = data["direct_join"]; A3_LegionModel.getInstance().CanAutoApply = c == 1 ? true : false; dispatchEvent(GameEvent.Create(EVENT_APPLYMODE, this, data)); break; case EVENT_CHECKNAME: dispatchEvent(GameEvent.Create(EVENT_CHECKNAME, this, data)); break; case EVENT_DELETECLAN: SendGetInfo(); dispatchEvent(GameEvent.Create(EVENT_DELETECLAN, this, data)); flytxt.instance.fly(ContMgr.getCont("Legion_bye")); //a3_herohead.instance.legion_bf = false; //a3_herohead.instance.isclear = true; //if (a3_herohead.instance != null) // a3_herohead.instance.refresBuff(); break; case EVENT_LOADLIST: A3_LegionModel.getInstance().list.Clear(); A3_LegionModel.getInstance().list2.Clear(); vd = data["info"]; foreach (var v in vd._arr) { A3_LegionData d = new A3_LegionData(); d.id = v["id"]; d.clname = v["clname"]; d.combpt = v["combpt"]; d.lvl = v["lvl"]; d.name = v["name"]; d.plycnt = v["plycnt"]; d.direct_join = v["direct_join"]; d.huoyue = v["last_active"]; A3_LegionModel.getInstance().list.Add(d); A3_LegionModel.getInstance().list2.Add(d); } //for (int i = 0; i < A3_LegionModel.getInstance().list.Count; i++) //{ // for (int j = 0; j < A3_LegionModel.getInstance().list.Count; j++) // { // if (A3_LegionModel.getInstance().list[i].id > A3_LegionModel.getInstance().list[j].id) // { // A3_LegionData temp = A3_LegionModel.getInstance().list[i]; // A3_LegionModel.getInstance().list[i] = A3_LegionModel.getInstance().list[j]; // A3_LegionModel.getInstance().list[j] = temp; // } // } //} dispatchEvent(GameEvent.Create(EVENT_LOADLIST, this, data)); break; case EVENT_REMOVE: int ci = data["cid"]; if (A3_LegionModel.getInstance().members.ContainsKey(ci)) { A3_LegionModel.getInstance().members.Remove(ci); } dispatchEvent(GameEvent.Create(EVENT_GETMEMBER, this, data)); break; case EVENT_REPAIR: dispatchEvent(GameEvent.Create(EVENT_REPAIR, this, data)); break; case EVENT_TASKREWARD: if (A3_LegionModel.getInstance().myLegion.id != 0) { int taskCount; if (A3_TaskModel.getInstance() == null || A3_TaskModel.getInstance().GetClanTask() == null) { taskCount = 9; } else { taskCount = A3_TaskModel.getInstance().GetClanTask().taskCount; } Dictionary <uint, int> rewardDic = A3_TaskModel.getInstance().GetClanRewardDic(taskCount); flytxt.instance.StopDelayFly(); if (data.ContainsKey("money")) { if (rewardDic.ContainsKey((uint)A3_TaskModel.REWARD_CLAN_MONEY)) { flytxt.instance.AddDelayFlytxt(ContMgr.getCont("Legion_money", new List <string> { (rewardDic[(uint)A3_TaskModel.REWARD_CLAN_MONEY]).ToString() })); } //flytxt.instance.AddDelayFlytxt("军团资金+" + rewardDic[(uint)A3_TaskModel.REWARD_CLAN_MONEY]); A3_LegionModel.getInstance().myLegion.gold = data["money"]._int; } if (data.ContainsKey("clan_pt")) { if (rewardDic.ContainsKey((uint)A3_TaskModel.REWARD_CLAN_EXP)) { flytxt.instance.AddDelayFlytxt(ContMgr.getCont("Legion_exp", new List <string> { (rewardDic[(uint)A3_TaskModel.REWARD_CLAN_EXP]).ToString() })); } //flytxt.instance.AddDelayFlytxt("军团经验+" + rewardDic[(uint)A3_TaskModel.REWARD_CLAN_EXP]); A3_LegionModel.getInstance().myLegion.clan_pt = data["clan_pt"]._int; } if (data.ContainsKey("donate")) { if (rewardDic.ContainsKey((uint)A3_TaskModel.REWARD_CLAN_DONATE)) { flytxt.instance.AddDelayFlytxt(ContMgr.getCont("Legion_gongxian", new List <string> { (rewardDic[(uint)A3_TaskModel.REWARD_CLAN_DONATE]).ToString() })); } //flytxt.instance.AddDelayFlytxt("军团贡献+" + rewardDic[(uint)A3_TaskModel.REWARD_CLAN_DONATE]); A3_LegionModel.getInstance().donate = data["donate"]._int; } if (data.ContainsKey("active")) { A3_LegionModel.getInstance().myLegion.huoyue = data["active"]._int; } flytxt.instance.StartDelayFly(); } break; case EVENT_BEINVITE: uint clanid = data["clanid"]; string name = data["name"]; string clan_name = data["clan_name"]; int clan_lvl = data["clan_lvl"]; if (a3_legion.mInstance.dic0.isOn) { SendAcceptInvite(clanid, true); flytxt.instance.fly(ContMgr.getCont("Legion_request")); a3_dartproxy.getInstance().sendDartGo(); //查看军团镖车信息 dispatchEvent(GameEvent.Create(EVENT_ACCEPTAINVITE, this, data)); } else { MsgBoxMgr.getInstance().showConfirm(name + ContMgr.getCont("add_request") + clan_lvl + ContMgr.getCont("lvLegion") + clan_name, () => { SendAcceptInvite(clanid, true); }, () => { SendAcceptInvite(clanid, false); }); } dispatchEvent(GameEvent.Create(EVENT_BEINVITE, this, data)); break; case EVENT_APPLYSUCCESSFUL: bool approved = data["approved"]; if (approved) { A3_LegionProxy.getInstance().SendGetInfo(); } a3_dartproxy.getInstance().sendDartGo(); //查看军团镖车信息 dispatchEvent(GameEvent.Create(EVENT_APPLYSUCCESSFUL, this, data)); break; case 35: A3_LegionProxy.getInstance().SendGetMember(); int cid = data["cid"]; int clanc = data["clanc"]; int oldclanc = data["oldclanc"]; string name1 = data["name"]; string dic = string.Empty; if ((uint)cid == PlayerModel.getInstance().cid) { name1 = ContMgr.getCont("u"); } if (oldclanc > clanc) { dic = ContMgr.getCont("up"); } else { dic = ContMgr.getCont("down"); } flytxt.instance.fly(name1 + dic + A3_LegionModel.getInstance().GetClancToName(clanc)); break; case 36: A3_LegionProxy.getInstance().SendGetInfo(); if (a3_buff.instance != null) { a3_buff.instance.Quited(); } break; case EVENT_GETDIN: //37 flytxt.instance.fly(ContMgr.getCont("Legionadd_ok")); a3_dartproxy.getInstance().sendDartGo(); //查看军团镖车信息 dispatchEvent(GameEvent.Create(A3_LegionProxy.EVENT_CREATE, this, data)); //a3_herohead.instance.isclear = true; //a3_herohead.instance.legion_bf = true; //if (a3_herohead.instance != null) // a3_herohead.instance.refresBuff(); break; case EVENT_FINDNAME: //27模糊搜索 if (data["info"].Count <= 0) { flytxt.instance.fly(ContMgr.getCont("nofinname")); } else { A3_LegionModel.getInstance().finfname.Clear(); A3_LegionModel.getInstance().finfname = new List <A3_LegionData>(); foreach (var v in data["info"]._arr) { A3_LegionData d = new A3_LegionData(); d.id = v["id"]; d.clname = v["clname"]; d.combpt = v["combpt"]; d.lvl = v["lvl"]; d.name = v["name"]; d.plycnt = v["plycnt"]; d.direct_join = v["direct_join"]; d.huoyue = v["last_active"]; A3_LegionModel.getInstance().finfname.Add(d); } if (a3_legion.Instance != null) { a3_legion.Instance.addpanels.SetActive(false); a3_legion.Instance.Findnames(); } } break; case EVENT_CHANGE_NAME: A3_LegionModel.getInstance().myLegion.clname = data["clname"]; dispatchEvent(GameEvent.Create(EVENT_CHANGE_NAME, this, data)); break; case EVENT_BUILD: A3_LegionModel.getInstance().build_awd[data["type"]] = data["type"]; if (a3_legion_build.instance) { a3_legion_build.instance.RefresAward(); } break; default: if (res < 0) { Globle.err_output(res); } break; } }
private void OnLegion(Variant data) { int num = data["res"]; debug.Log("军团消息" + data.dump()); Variant variant = new Variant(); switch (num) { case 1: { bool flag = data.ContainsKey("id"); if (flag) { A3_LegionData a3_LegionData = default(A3_LegionData); a3_LegionData.id = data["id"]; a3_LegionData.lvl = data["lvl"]; a3_LegionData.clname = data["clname"]; a3_LegionData.name = data["name"]; a3_LegionData.notice = data["notice"]; a3_LegionData.gold = data["money"]; a3_LegionData.plycnt = data["plycnt"]; a3_LegionData.exp = data["clan_pt"]; bool flag2 = data.ContainsKey("ol_cnt"); if (flag2) { a3_LegionData.ol_cnt = data["ol_cnt"]; } bool flag3 = data.ContainsKey("combpt"); if (flag3) { a3_LegionData.combpt = data["combpt"]; } bool flag4 = data.ContainsKey("rankidx"); if (flag4) { a3_LegionData.rankidx = data["rankidx"]; } bool flag5 = data.ContainsKey("clanc"); if (flag5) { a3_LegionData.clanc = data["clanc"]; } a3_LegionData.anabasis_tm = data["anabasis_tm"]; ModelBase <A3_LegionModel> .getInstance().myLegion = a3_LegionData; int num2 = data["direct_join"]; ModelBase <A3_LegionModel> .getInstance().CanAutoApply = (num2 == 1); ModelBase <A3_LegionModel> .getInstance().SetMyLegion(a3_LegionData.lvl); ModelBase <A3_LegionModel> .getInstance().donate = data["donate"]; this.gold = a3_LegionData.gold; this.lvl = a3_LegionData.lvl; } else { ModelBase <A3_LegionModel> .getInstance().myLegion = default(A3_LegionData); } base.dispatchEvent(GameEvent.Create(1u, this, data, false)); break; } case 2: base.dispatchEvent(GameEvent.Create(2u, this, data, false)); base.removeEventListener(24u, new Action <GameEvent>(a3_legion.mInstance.SetCheckName)); break; case 3: { int num3 = data["clid"]; base.dispatchEvent(GameEvent.Create(3u, this, data, false)); flytxt.instance.fly("申请成功!", 0, default(Color), null); break; } case 4: base.dispatchEvent(GameEvent.Create(4u, this, data, false)); break; case 5: ModelBase <A3_LegionModel> .getInstance().myLegion.gold = data["money"]; ModelBase <A3_LegionModel> .getInstance().myLegion.lvl = data["lvl"]; ModelBase <A3_LegionModel> .getInstance().myLegion.exp = 0; ModelBase <A3_LegionModel> .getInstance().SetMyLegion(ModelBase <A3_LegionModel> .getInstance().myLegion.lvl); base.dispatchEvent(GameEvent.Create(1u, this, data, false)); flytxt.instance.fly("升级骑士团成功!", 0, default(Color), null); break; case 6: { int num4 = data["money"]; flytxt.instance.fly("获得了" + num4 / 1000 + "点贡献度", 0, default(Color), null); this.SendGetInfo(); break; } case 8: this.SendGetMember(); break; case 9: { ModelBase <A3_LegionModel> .getInstance().myLegion = default(A3_LegionData); base.dispatchEvent(GameEvent.Create(9u, this, data, false)); TaskData expr_4C9 = a3_task_auto.instance.executeTask; bool flag6 = expr_4C9 != null && expr_4C9.taskT == TaskType.CLAN; if (flag6) { SelfRole.fsm.Stop(); flytxt.instance.fly("你已退出军团无法继续进行任务", 0, default(Color), null); } else { flytxt.instance.fly("您已成功退出骑士团!", 0, default(Color), null); } break; } case 10: { int key = data["cid"]; bool flag7 = ModelBase <A3_LegionModel> .getInstance().members.ContainsKey(key); if (flag7) { ModelBase <A3_LegionModel> .getInstance().members.Remove(key); } base.dispatchEvent(GameEvent.Create(14u, this, data, false)); break; } case 11: { int num5 = data["direct_join"]; ModelBase <A3_LegionModel> .getInstance().CanAutoApply = (num5 == 1); base.dispatchEvent(GameEvent.Create(11u, this, data, false)); break; } case 12: base.dispatchEvent(GameEvent.Create(12u, this, data, false)); break; case 14: variant = data["pls"]; ModelBase <A3_LegionModel> .getInstance().members.Clear(); foreach (Variant current in variant._arr) { ModelBase <A3_LegionModel> .getInstance().AddMember(current); } base.dispatchEvent(GameEvent.Create(14u, this, data, false)); break; case 15: { bool flag8 = data != null && data.ContainsKey("clanlog_list") && data["clanlog_list"]._arr.Count > 0; if (flag8) { ModelBase <A3_LegionModel> .getInstance().AddLog(data); } base.dispatchEvent(GameEvent.Create(15u, this, data, false)); break; } case 16: ModelBase <A3_LegionModel> .getInstance().RefreshApplicant(data); base.dispatchEvent(GameEvent.Create(16u, this, data, false)); break; case 17: ModelBase <A3_LegionModel> .getInstance().list.Clear(); ModelBase <A3_LegionModel> .getInstance().list2.Clear(); variant = data["info"]; foreach (Variant current2 in variant._arr) { A3_LegionData item = default(A3_LegionData); item.id = current2["id"]; item.clname = current2["clname"]; item.combpt = current2["combpt"]; item.lvl = current2["lvl"]; item.name = current2["name"]; item.plycnt = current2["plycnt"]; item.direct_join = current2["direct_join"]; item.huoyue = current2["last_active"]; ModelBase <A3_LegionModel> .getInstance().list.Add(item); ModelBase <A3_LegionModel> .getInstance().list2.Add(item); } base.dispatchEvent(GameEvent.Create(17u, this, data, false)); break; case 18: base.dispatchEvent(GameEvent.Create(18u, this, data, false)); break; case 22: this.SendGetInfo(); base.dispatchEvent(GameEvent.Create(22u, this, data, false)); flytxt.instance.fly("您已成功解散骑士团!", 0, default(Color), null); break; case 24: base.dispatchEvent(GameEvent.Create(24u, this, data, false)); break; case 25: flytxt.instance.fly("军团buff提升成功", 0, default(Color), null); break; case 26: base.dispatchEvent(GameEvent.Create(26u, this, data, false)); break; case 32: { bool flag9 = ModelBase <A3_LegionModel> .getInstance().myLegion.id != 0; if (flag9) { bool flag10 = ModelBase <A3_TaskModel> .getInstance() == null || ModelBase <A3_TaskModel> .getInstance().GetClanTask() == null; int taskCount; if (flag10) { taskCount = 9; } else { taskCount = ModelBase <A3_TaskModel> .getInstance().GetClanTask().taskCount; } Dictionary <uint, int> clanRewardDic = ModelBase <A3_TaskModel> .getInstance().GetClanRewardDic(taskCount); flytxt.instance.StopDelayFly(); bool flag11 = data.ContainsKey("money"); if (flag11) { bool flag12 = clanRewardDic.ContainsKey((uint)A3_TaskModel.REWARD_CLAN_MONEY); if (flag12) { flytxt.instance.AddDelayFlytxt("军团资金+" + clanRewardDic[(uint)A3_TaskModel.REWARD_CLAN_MONEY]); } ModelBase <A3_LegionModel> .getInstance().myLegion.gold = data["money"]._int; } bool flag13 = data.ContainsKey("clan_pt"); if (flag13) { bool flag14 = clanRewardDic.ContainsKey((uint)A3_TaskModel.REWARD_CLAN_EXP); if (flag14) { flytxt.instance.AddDelayFlytxt("军团经验+" + clanRewardDic[(uint)A3_TaskModel.REWARD_CLAN_EXP]); } ModelBase <A3_LegionModel> .getInstance().myLegion.clan_pt = data["clan_pt"]._int; } bool flag15 = data.ContainsKey("donate"); if (flag15) { bool flag16 = clanRewardDic.ContainsKey((uint)A3_TaskModel.REWARD_CLAN_DONATE); if (flag16) { flytxt.instance.AddDelayFlytxt("军团贡献+" + clanRewardDic[(uint)A3_TaskModel.REWARD_CLAN_DONATE]); } ModelBase <A3_LegionModel> .getInstance().donate = data["donate"]._int; } bool flag17 = data.ContainsKey("active"); if (flag17) { ModelBase <A3_LegionModel> .getInstance().myLegion.huoyue = data["active"]._int; } flytxt.instance.StartDelayFly(0f, 0.2f); } break; } case 33: { uint clanid = data["clanid"]; string text = data["name"]; string text2 = data["clan_name"]; int num6 = data["clan_lvl"]; bool isOn = a3_legion.mInstance.dic0.isOn; if (isOn) { this.SendAcceptInvite(clanid, true); flytxt.instance.fly("您已接受军团邀请!", 0, default(Color), null); BaseProxy <a3_dartproxy> .getInstance().sendDartGo(); base.dispatchEvent(GameEvent.Create(19u, this, data, false)); } else { MsgBoxMgr.getInstance().showConfirm(string.Concat(new object[] { text, " 邀请你加入 ", num6, "级骑士团 ", text2 }), delegate { this.SendAcceptInvite(clanid, true); }, delegate { this.SendAcceptInvite(clanid, false); }, 0); } base.dispatchEvent(GameEvent.Create(33u, this, data, false)); break; } case 34: { bool flag18 = data["approved"]; bool flag19 = flag18; if (flag19) { BaseProxy <A3_LegionProxy> .getInstance().SendGetInfo(); } BaseProxy <a3_dartproxy> .getInstance().sendDartGo(); base.dispatchEvent(GameEvent.Create(34u, this, data, false)); break; } case 35: { BaseProxy <A3_LegionProxy> .getInstance().SendGetMember(); int num7 = data["cid"]; int num8 = data["clanc"]; int num9 = data["oldclanc"]; string str = data["name"]; string str2 = string.Empty; bool flag20 = num7 == (int)ModelBase <PlayerModel> .getInstance().cid; if (flag20) { str = "您"; } bool flag21 = num9 > num8; if (flag21) { str2 = "的军团职位被降为:"; } else { str2 = "的军团职位被升为:"; } flytxt.instance.fly(str + str2 + ModelBase <A3_LegionModel> .getInstance().GetClancToName(num8), 0, default(Color), null); break; } case 36: { BaseProxy <A3_LegionProxy> .getInstance().SendGetInfo(); bool flag22 = a3_buff.instance != null; if (flag22) { a3_buff.instance.Quited(); } break; } case 37: flytxt.instance.fly("您已成功加入骑士团!", 0, default(Color), null); BaseProxy <a3_dartproxy> .getInstance().sendDartGo(); base.dispatchEvent(GameEvent.Create(2u, this, data, false)); break; } }