public bool SC_GetGuildRankInfo(Protomsg.MsgBase d1) { Debug.Log("SC_GetGuildRankInfo:"); IMessage IMperson = new Protomsg.SC_GetGuildRankInfo(); Protomsg.SC_GetGuildRankInfo p1 = (Protomsg.SC_GetGuildRankInfo)IMperson.Descriptor.Parser.ParseFrom(d1.Datas); //创建界面 if (main == null) { return(true); } //-------------------------公会排名-------------------------- main.GetChild("ranklist").asList.RemoveChildren(0, -1, true); //处理排序 Protomsg.GuildShortInfo[] allplayer = new Protomsg.GuildShortInfo[p1.Guilds.Count]; int index = 0; foreach (var item in p1.Guilds) { allplayer[index++] = item; Debug.Log("11SC_GetGuildRankInfo:" + item.Rank); } System.Array.Sort(allplayer, (a, b) => { if (a.Rank > b.Rank) { return(1); } else if (a.Rank == b.Rank) { return(0); } else { return(-1); } }); foreach (var item in allplayer) { var onerank = UIPackage.CreateObject("GameUI", "GuildRankOne").asCom; onerank.GetChild("rank").asTextField.text = item.Rank + ""; onerank.GetChild("name").asTextField.text = item.Name; onerank.GetChild("level").asTextField.text = "lv." + item.Level; onerank.GetChild("count").asTextField.text = item.CharacterCount + "/" + item.MaxCount; main.GetChild("ranklist").asList.AddChild(onerank); } //地图信息 var clientitem = ExcelManager.Instance.GetSceneManager().GetSceneByID(p1.MapInfo.NextSceneID); if (clientitem == null) { return(true); } main.GetChild("rankuiname").asTextField.text = clientitem.Name; main.GetChild("rankuiguildlevel").asTextField.text = p1.MapInfo.NeedGuildLevel + ""; main.GetChild("rankuitime").asTextField.text = p1.MapInfo.OpenStartTime + "--" + p1.MapInfo.OpenEndTime; main.GetChild("rankuiweek").asTextField.text = "周" + p1.MapInfo.OpenWeekDay; //进入 main.GetChild("rankuigoto").asButton.onClick.Add(() => { Protomsg.CS_GotoGuildMap msg1 = new Protomsg.CS_GotoGuildMap(); msg1.ID = p1.MapInfo.ID; MyKcp.Instance.SendMsg(GameScene.Singleton.m_ServerName, "CS_GotoGuildMap", msg1); }); //击杀情况 CS_GetGuildRankBattleInfo main.GetChild("rankuikillinfo").asButton.onClick.Add(() => { Protomsg.CS_GetGuildRankBattleInfo msg1 = new Protomsg.CS_GetGuildRankBattleInfo(); msg1.ID = p1.MapInfo.ID; MyKcp.Instance.SendMsg(GameScene.Singleton.m_ServerName, "CS_GetGuildRankBattleInfo", msg1); }); return(true); }
//获取公会地图信息 public bool SC_GetGuildMapsInfo(Protomsg.MsgBase d1) { Debug.Log("CS_GetGuildMapsInfo:"); IMessage IMperson = new Protomsg.SC_GetGuildMapsInfo(); Protomsg.SC_GetGuildMapsInfo p1 = (Protomsg.SC_GetGuildMapsInfo)IMperson.Descriptor.Parser.ParseFrom(d1.Datas); if (main == null) { return(true); } main.GetChild("maplist").asList.RemoveChildren(0, -1, true); Protomsg.GuildMapInfo[] allplayer = new Protomsg.GuildMapInfo[p1.Maps.Count]; p1.Maps.CopyTo(allplayer, 0); System.Array.Sort(allplayer, (a, b) => { if (a.ID > b.ID) { return(1); } else if (a.ID < b.ID) { return(-1); } return(0); }); //遍历 foreach (var item in allplayer) { var clientitem = ExcelManager.Instance.GetSceneManager().GetSceneByID(item.NextSceneID); if (clientitem == null) { continue; } var onedropitem = UIPackage.CreateObject("GameUI", "GuildMapInfo").asCom; //onedropitem.GetChild("item").asCom.GetChild("icon").asLoader.url = clientitem.IconPath; onedropitem.GetChild("name").asTextField.text = clientitem.Name; onedropitem.GetChild("guildlevel").asTextField.text = item.NeedGuildLevel + ""; onedropitem.GetChild("time").asTextField.text = item.OpenStartTime + "--" + item.OpenEndTime; onedropitem.GetChild("week").asTextField.text = "周" + item.OpenWeekDay; //进入 onedropitem.GetChild("goto").asButton.onClick.Add(() => { Protomsg.CS_GotoGuildMap msg1 = new Protomsg.CS_GotoGuildMap(); msg1.ID = item.ID; MyKcp.Instance.SendMsg(GameScene.Singleton.m_ServerName, "CS_GotoGuildMap", msg1); }); //地图信息 onedropitem.GetChild("icon").asLoader.onClick.Add(() => { Protomsg.CS_GetMapInfo msg1 = new Protomsg.CS_GetMapInfo(); msg1.SceneID = item.NextSceneID; MyKcp.Instance.SendMsg(GameScene.Singleton.m_ServerName, "CS_GetMapInfo", msg1); }); main.GetChild("maplist").asList.AddChild(onedropitem); } return(true); }