public bool SC_GetMailRewards(Protomsg.MsgBase d1) { Debug.Log("SC_GetMailRewards:"); IMessage IMperson = new Protomsg.SC_GetMailRewards(); Protomsg.SC_GetMailRewards p2 = (Protomsg.SC_GetMailRewards)IMperson.Descriptor.Parser.ParseFrom(d1.Datas); //1表示成功 0表示失败 if (p2.Result == 1) { Tool.NoticeWords("领取成功", null); FriendsCom.GetChild("get").visible = false; var list = FriendsCom.GetChild("list").asList; foreach (var one in list.GetChildren()) { if (one.data == null) { continue; } var shortinfo = (Protomsg.MailShortInfoMsg)one.data; if (shortinfo.Id == p2.Id) { one.alpha = 0.5f; //teamrequest.GetChild("bg").asImage.color = new Color(0.7f, 0.7f, 0.7f); } } } else { Tool.NoticeWords("领取失败", null); } return(true); }
public bool SC_ChatInfo(Protomsg.MsgBase d1) { Debug.Log("SC_ChatInfo:"); IMessage IMperson = new Protomsg.SC_ChatInfo(); Protomsg.SC_ChatInfo p1 = (Protomsg.SC_ChatInfo)IMperson.Descriptor.Parser.ParseFrom(d1.Datas); //////聊天频道 1附近 2全服 3私聊 4队伍 //zonghe siliao duiwu AddChatMsg2Chanel(p1, "zonghe"); if (p1.Channel == 1) { AddChatMsg2Chanel(p1, "fujin"); } if (p1.Channel == 3) { AddChatMsg2Chanel(p1, "siliao"); } if (p1.Channel == 4) { AddChatMsg2Chanel(p1, "duiwu"); } if (p1.Channel == 5) { AddChatMsg2Chanel(p1, "guild"); } if (p1.Channel == 2) { AddChatMsg2Chanel(p1, "quanfu"); } return(true); }
public bool SC_GetBattleMapInfo(Protomsg.MsgBase d1) { Debug.Log("SC_GetBattleMapInfo:"); IMessage IMperson = new Protomsg.SC_GetBattleMapInfo(); Protomsg.SC_GetBattleMapInfo p1 = (Protomsg.SC_GetBattleMapInfo)IMperson.Descriptor.Parser.ParseFrom(d1.Datas); main.GetChild("guildlevel").asTextField.text = "Lv." + p1.BattleMapInfo.NeedLevel; //进入 main.GetChild("pipei").asButton.onClick.Add(() => { Protomsg.CS_BattlePiPei msg1 = new Protomsg.CS_BattlePiPei(); msg1.CopyMapID = p1.BattleMapInfo.ID; MyKcp.Instance.SendMsg(GameScene.Singleton.m_ServerName, "CS_BattlePiPei", msg1); }); //地图信息 main.GetChild("cancel").asButton.onClick.Add(() => { Protomsg.CS_BattleCancel msg1 = new Protomsg.CS_BattleCancel(); MyKcp.Instance.SendMsg(GameScene.Singleton.m_ServerName, "CS_BattleCancel", msg1); }); if (p1.BattleMapInfo.State == 1)//可以匹配 { Controller ct = main.GetController("c1"); ct.SetSelectedIndex(0); } else if (p1.BattleMapInfo.State == 2)//匹配中 { Controller ct = main.GetController("c1"); ct.SetSelectedIndex(1); } return(true); }
public bool SC_GetLineUpFrontCount(Protomsg.MsgBase d1) { Google.Protobuf.IMessage IMperson = new Protomsg.SC_GetLineUpFrontCount(); Protomsg.SC_GetLineUpFrontCount p1 = (Protomsg.SC_GetLineUpFrontCount)IMperson.Descriptor.Parser.ParseFrom(d1.Datas); mLineUp.visible = true; mLineUp.GetChild("playercount").asTextField.text = p1.FrontCount + ""; return(true); }
public bool SC_GetMapInfo(Protomsg.MsgBase d1) { Debug.Log("SC_GetMapInfo:"); IMessage IMperson = new Protomsg.SC_GetMapInfo(); Protomsg.SC_GetMapInfo p1 = (Protomsg.SC_GetMapInfo)IMperson.Descriptor.Parser.ParseFrom(d1.Datas); var mapinfo = UIPackage.CreateObject("GameUI", "MapInfo").asCom; GRoot.inst.AddChild(mapinfo); mapinfo.xy = Tool.GetPosition(0.5f, 0.5f); mapinfo.GetChild("close").asButton.onClick.Add(() => { mapinfo.Dispose(); }); var sceneitem = ExcelManager.Instance.GetSceneManager().GetSceneByID(p1.SceneID); if (sceneitem != null) { mapinfo.GetChild("name").asTextField.text = sceneitem.Name; } mapinfo.GetChild("time").asTextField.text = Tool.Time2String(p1.BossFreshTime); //掉落道具 mapinfo.GetChild("maplist").asList.RemoveChildren(0, -1, true); int[] allplayer = new int[p1.DropItems.Count]; p1.DropItems.CopyTo(allplayer, 0); System.Array.Sort(allplayer, (a, b) => { if (a > b) { return(1); } else if (a < b) { return(-1); } return(0); }); foreach (var item in allplayer) { var clientitem = ExcelManager.Instance.GetItemManager().GetItemByID(item); if (clientitem == null) { continue; } var onedropitem = UIPackage.CreateObject("GameUI", "sellable").asCom; onedropitem.GetChild("icon").asLoader.url = clientitem.IconPath; onedropitem.GetChild("icon").onClick.Add(() => { new ItemInfo(item); }); onedropitem.GetChild("level").asTextField.text = "lv.1"; mapinfo.GetChild("maplist").asList.AddChild(onedropitem); } return(true); }
public bool SC_BagInfo(Protomsg.MsgBase d1) { IMessage IMperson = new Protomsg.SC_BagInfo(); Protomsg.SC_BagInfo p1 = (Protomsg.SC_BagInfo)IMperson.Descriptor.Parser.ParseFrom(d1.Datas); FreshBagInfoData(p1); return(true); }
public bool SC_UnitInfo(Protomsg.MsgBase d1) { //Debug.Log("SC_Update:"); IMessage IMperson = new Protomsg.SC_UnitInfo(); Protomsg.SC_UnitInfo p1 = (Protomsg.SC_UnitInfo)IMperson.Descriptor.Parser.ParseFrom(d1.Datas); FreshUnitInfoData(p1.UnitData); return(true); }
public bool SC_GetExchangeShortCommoditys(Protomsg.MsgBase d1) { Debug.Log("SC_GetExchangeShortCommoditys:"); IMessage IMperson = new Protomsg.SC_GetExchangeShortCommoditys(); Protomsg.SC_GetExchangeShortCommoditys p1 = (Protomsg.SC_GetExchangeShortCommoditys)IMperson.Descriptor.Parser.ParseFrom(d1.Datas); main.GetChild("buylist").asList.RemoveChildren(0, -1, true); //处理排序 Protomsg.ExchangeShortCommodityData[] allplayer = new Protomsg.ExchangeShortCommodityData[p1.Commoditys.Count]; int index = 0; foreach (var item in p1.Commoditys) { allplayer[index++] = item; } System.Array.Sort(allplayer, (a, b) => { if (a.ItemID > b.ItemID) { return(1); } else { return(-1); } }); foreach (var item in allplayer) { var clientitem = ExcelManager.Instance.GetItemManager().GetItemByID(item.ItemID); if (clientitem == null) { continue; } var onedropitem = UIPackage.CreateObject("GameUI", "exchangecommodity_short").asCom; onedropitem.GetChild("icon").asLoader.url = clientitem.IconPath; onedropitem.GetChild("icon").onClick.Add(() => { new ItemInfo(item.ItemID); }); onedropitem.GetChild("price").asTextField.text = item.SellCount + ""; onedropitem.GetChild("name").asTextField.text = clientitem.Name; onedropitem.onClick.Add(() => { //获取数据 Protomsg.CS_GetExchangeDetailedCommoditys msg1 = new Protomsg.CS_GetExchangeDetailedCommoditys(); msg1.ItemID = item.ItemID; MyKcp.Instance.SendMsg(GameScene.Singleton.m_ServerName, "CS_GetExchangeDetailedCommoditys", msg1); }); main.GetChild("buylist").asList.AddChild(onedropitem); } return(true); }
public bool SC_GotoActivityMap(Protomsg.MsgBase d1) { Debug.Log("SC_GotoActivityMap:"); IMessage IMperson = new Protomsg.SC_GotoActivityMap(); Protomsg.SC_GotoActivityMap p1 = (Protomsg.SC_GotoActivityMap)IMperson.Descriptor.Parser.ParseFrom(d1.Datas); if (p1.Result == 1) { this.Destroy(); } return(true); }
public bool SC_GetItemExtraInfo(Protomsg.MsgBase d1) { Debug.Log("SC_GetItemExtraInfo:"); IMessage IMperson = new Protomsg.SC_GetItemExtraInfo(); Protomsg.SC_GetItemExtraInfo p1 = (Protomsg.SC_GetItemExtraInfo)IMperson.Descriptor.Parser.ParseFrom(d1.Datas); if (p1.TypeId != TypeID) { return(false); } //需要等级 main.GetChild("needlevel").asTextField.SetVar("p1", p1.EquipNeedLevel + ""); main.GetChild("needlevel").asTextField.FlushVars(); main.GetChild("droplist").asList.RemoveChildren(0, -1, true); //宝箱 if (p1.Exception == 1) { var items = p1.ExceptionParam.Split(';'); for (var i = 0; i < items.Length; i++) { var oneitem = items[i].Split(':'); if (oneitem.Length <= 0) { continue; } var item = int.Parse(oneitem[0]); var clientitem = ExcelManager.Instance.GetItemManager().GetItemByID(item); if (clientitem == null) { continue; } var onedropitem = UIPackage.CreateObject("GameUI", "sellable").asCom; onedropitem.GetChild("icon").asLoader.url = clientitem.IconPath; onedropitem.GetChild("icon").onClick.Add(() => { new ItemInfo(item); }); onedropitem.GetChild("level").asTextField.text = "lv.1"; main.GetChild("droplist").asList.AddChild(onedropitem); } } return(true); }
//进入新场景 public bool SC_NewScene(Protomsg.MsgBase d1) { Debug.Log("SC_NewScene:"); IMessage IMperson = new Protomsg.SC_NewScene(); Protomsg.SC_NewScene p1 = (Protomsg.SC_NewScene)IMperson.Descriptor.Parser.ParseFrom(d1.Datas); bool needNewScene = false; if (m_ScenePath != p1.Name) { needNewScene = true; } //p1.Name m_CurFrame = p1.CurFrame; m_LogicFps = p1.LogicFps; m_ServerName = p1.ServerName; m_DataShowType = p1.DataShowType; m_SceneID = p1.SceneID; m_ScenePath = p1.Name; m_GameServerStartTime = Tool.GetTime() - 1.0f / p1.LogicFps * p1.CurFrame; Debug.Log("starttime:" + m_GameServerStartTime + " LogicFps: " + p1.LogicFps + " curframe:" + m_CurFrame + " time:" + Time.realtimeSinceStartup); //显示服务器时间差值 var timenow = DateTime.Now; Debug.Log("111:" + p1.TimeHour + " :" + timenow.Hour); TimeHourDiffer = p1.TimeHour - timenow.Hour; TimeMinuteDiffer = p1.TimeMinute - timenow.Minute; TimeSecondDiffer = p1.TimeSecond - timenow.Second; CleanScene(); if (needNewScene) { LoadScene(p1.SceneID, p1.Name); } else { //通知服务器加载完成 Protomsg.CS_LodingScene msg1 = new Protomsg.CS_LodingScene(); msg1.SceneID = m_SceneID; MyKcp.Instance.SendMsg(m_ServerName, "CS_LodingScene", msg1); } return(true); }
//测试聊天数据 public void testchat() { ////聊天频道 1附近 2全服 3私聊 4队伍 Protomsg.SC_ChatInfo msg = new Protomsg.SC_ChatInfo(); msg.Channel = 1; msg.SrcName = "t1"; msg.Time = "10:59"; msg.Content = "来了 测试 范德萨发 接口了聚隆科技 范德萨发生的"; Protomsg.MsgBase msg1 = new Protomsg.MsgBase(); msg1.ModeType = ""; msg1.MsgType = "SC_ChatInfo"; if (msg != null) { msg1.Datas = ByteString.CopyFrom(msg.ToByteArray()); } MsgManager.Instance.AddMessage(msg1); }
public bool SC_Update(Protomsg.MsgBase d1) { //Debug.Log("SC_Update:"); //var m1 = System.GC.GetTotalMemory(true); IMessage IMperson = new Protomsg.SC_Update(); Protomsg.SC_Update p1 = (Protomsg.SC_Update)IMperson.Descriptor.Parser.ParseFrom(d1.Datas); m_LogicFrameData[p1.CurFrame] = p1; m_MaxFrame = p1.CurFrame; //Debug.Log("SC_Update time:" + Tool.GetTime()+" frame:"+p1.CurFrame); //var m2 = System.GC.GetTotalMemory(true); //Debug.Log("gc size:"+ d1.Datas.Length+" str:"+ d1.Datas.ToString()); return(true); }
public bool Logined(Protomsg.MsgBase d1) { Google.Protobuf.IMessage IMperson = new Protomsg.SC_Logined(); Protomsg.SC_Logined p1 = (Protomsg.SC_Logined)IMperson.Descriptor.Parser.ParseFrom(d1.Datas); UID = p1.Uid; if (p1.Code != 1) { Debug.Log("login fail"); } else { Protomsg.CS_SelectCharacter msg1 = new Protomsg.CS_SelectCharacter(); msg1.SelectCharacter = new Protomsg.CharacterBaseDatas(); Debug.Log("Logined:" + p1.Characters); initOpenHeros(p1.Characters); showSelectHero(); } return(false); //中断解析数据 }
public bool SelectCharacterResult(Protomsg.MsgBase d1) { Google.Protobuf.IMessage IMperson = new Protomsg.SC_SelectCharacterResult(); Protomsg.SC_SelectCharacterResult p1 = (Protomsg.SC_SelectCharacterResult)IMperson.Descriptor.Parser.ParseFrom(d1.Datas); Characterid = p1.Characterid; Debug.Log("SelectCharacterid :" + Characterid); if (p1.Code != 1) { Debug.Log("SelectCharacterResult fail" + p1.Error); var word = ""; if (p1.Error == 3) { word = "这个名字已经存在,请重新取名!"; } else if (p1.Error == 1) { word = "找不到该角色"; } else if (p1.Error == 4) { word = "名字中含有非法字符!"; } Tool.NoticeWords(word, null); } else { SaveDataManager.Save(); SceneManager.LoadScene(1); SelectLayer.Dispose(); mLineUp.Dispose(); Debug.Log("main OnDestroy:aaaa"); Debug.Log("main OnDestroy:bbbbb"); } return(false); //中断解析数据 }
// public bool SC_GetSellUIInfo(Protomsg.MsgBase d1) { Debug.Log("SC_GetSellUIInfo:"); IMessage IMperson = new Protomsg.SC_GetSellUIInfo(); Protomsg.SC_GetSellUIInfo p1 = (Protomsg.SC_GetSellUIInfo)IMperson.Descriptor.Parser.ParseFrom(d1.Datas); main.GetChild("sellablelist").asList.RemoveChildren(0, -1, true); //------------------可以售卖的道具---------------------- //处理排序 Protomsg.UnitEquip[] allplayer = new Protomsg.UnitEquip[p1.Equips.Count]; int index = 0; foreach (var item in p1.Equips) { allplayer[index++] = item; } System.Array.Sort(allplayer, (a, b) => { if (a.Pos > b.Pos) { return(1); } else if (a.Pos < b.Pos) { return(-1); } return(0); }); foreach (var item in allplayer) { var clientitem = ExcelManager.Instance.GetItemManager().GetItemByID(item.TypdID); if (clientitem == null) { continue; } var onedropitem = UIPackage.CreateObject("GameUI", "sellable").asCom; onedropitem.GetChild("icon").asLoader.url = clientitem.IconPath; onedropitem.GetChild("icon").onClick.Add(() => { //售卖 var sellwindow = UIPackage.CreateObject("GameUI", "Shelf1").asCom; GRoot.inst.AddChild(sellwindow); sellwindow.xy = Tool.GetPosition(0.5f, 0.5f); sellwindow.GetChild("close").onClick.Add(() => { sellwindow.Dispose(); }); sellwindow.GetChild("yes_btn").onClick.Add(() => { var txt = sellwindow.GetChild("input").asTextInput.text; if (txt.Length <= 0) { Tool.NoticeWords("请输入价格!", null); return; } int price = 0; try { price = Convert.ToInt32(txt); //报异常 } catch (SystemException e) { Tool.NoticeWords("请输入正确的价格!", null); return; } if (price <= 0) { Tool.NoticeWords("请输入正确的价格!", null); return; } //上架 Protomsg.CS_ShelfExchangeCommodity msg1 = new Protomsg.CS_ShelfExchangeCommodity(); msg1.BagPos = item.Pos; msg1.PriceType = 10001; msg1.Price = price; MyKcp.Instance.SendMsg(GameScene.Singleton.m_ServerName, "CS_ShelfExchangeCommodity", msg1); sellwindow.Dispose(); }); sellwindow.GetChild("item").asCom.GetChild("icon").asLoader.url = clientitem.IconPath; sellwindow.GetChild("item").asCom.GetChild("level").asTextField.text = "lv." + item.Level + ""; sellwindow.GetChild("name").asTextField.text = clientitem.Name; sellwindow.GetChild("pricetype_shouxufei").asLoader.url = Tool.GetPriceTypeIcon(p1.ShelfExchangeFeePriceType); sellwindow.GetChild("pricetype").asLoader.url = Tool.GetPriceTypeIcon(10001); sellwindow.GetChild("price_shouxufei").asTextField.text = p1.ShelfExchangeFeePrice + ""; sellwindow.GetChild("unshelf_time").asTextField.SetVar("p1", Tool.Time2String(p1.AutoUnShelfTime)); sellwindow.GetChild("unshelf_time").asTextField.FlushVars(); }); onedropitem.GetChild("level").asTextField.text = "lv." + item.Level; main.GetChild("sellablelist").asList.AddChild(onedropitem); } //------------------正在售卖的道具---------------------- main.GetChild("sellinglist").asList.RemoveChildren(0, -1, true); //处理排序 Protomsg.ExchangeDetailedCommodityData[] allselling = new Protomsg.ExchangeDetailedCommodityData[p1.Commoditys.Count]; index = 0; foreach (var item in p1.Commoditys) { allselling[index++] = item; } System.Array.Sort(allselling, (a, b) => { Debug.Log("a:" + a.CommodityData.TypeID + " b:" + b.CommodityData.TypeID); if (a.CommodityData.TypeID > b.CommodityData.TypeID) { return(1); } else if (a.CommodityData.TypeID < b.CommodityData.TypeID) { return(-1); } return(0); }); foreach (var item in allselling) { var clientitem = ExcelManager.Instance.GetItemManager().GetItemByID(item.CommodityData.ItemID); if (clientitem == null) { continue; } var onedropitem = UIPackage.CreateObject("GameUI", "selling").asCom; onedropitem.GetChild("icon").asLoader.url = clientitem.IconPath; onedropitem.GetChild("icon").onClick.Add(() => { new ItemInfo(item.CommodityData.ItemID); }); onedropitem.onClick.Add(() => { //下架 var sellwindow = UIPackage.CreateObject("GameUI", "exchangeunshelf").asCom; GRoot.inst.AddChild(sellwindow); sellwindow.xy = Tool.GetPosition(0.5f, 0.5f); sellwindow.GetChild("close").onClick.Add(() => { sellwindow.Dispose(); }); sellwindow.GetChild("yes_btn").onClick.Add(() => { Protomsg.CS_UnShelfExchangeCommodity msg1 = new Protomsg.CS_UnShelfExchangeCommodity(); msg1.ID = item.CommodityData.TypeID; MyKcp.Instance.SendMsg(GameScene.Singleton.m_ServerName, "CS_UnShelfExchangeCommodity", msg1); sellwindow.Dispose(); }); sellwindow.GetChild("item").asCom.GetChild("icon").asLoader.url = clientitem.IconPath; sellwindow.GetChild("item").asCom.GetChild("level").asTextField.text = "lv." + item.CommodityData.Level + ""; sellwindow.GetChild("name").asTextField.text = clientitem.Name; sellwindow.GetChild("pricetype").asLoader.url = Tool.GetPriceTypeIcon(item.CommodityData.PriceType); sellwindow.GetChild("price").asTextField.text = item.CommodityData.Price + ""; }); onedropitem.GetChild("price").asTextField.text = item.CommodityData.Price + ""; onedropitem.GetChild("level").asTextField.text = "lv." + item.CommodityData.Level + ""; onedropitem.GetChild("pricetype").asLoader.url = Tool.GetPriceTypeIcon(item.CommodityData.PriceType); onedropitem.GetChild("name").asTextField.text = clientitem.Name; main.GetChild("sellinglist").asList.AddChild(onedropitem); } //----提示描述-- main.GetChild("maxcount").asTextField.text = p1.Commoditys.Count + "/" + p1.ShelfExchangeLimit; main.GetChild("Tax").asTextField.SetVar("p1", (p1.SellExchangeTax * 100).ToString("0.00") + "%"); main.GetChild("Tax").asTextField.FlushVars(); return(true); }
public bool SC_GetMailInfo(Protomsg.MsgBase d1) { Debug.Log("SC_GetMailInfo:"); IMessage IMperson = new Protomsg.SC_GetMailInfo(); Protomsg.SC_GetMailInfo p2 = (Protomsg.SC_GetMailInfo)IMperson.Descriptor.Parser.ParseFrom(d1.Datas); this.ShowID = p2.Id; var group = FriendsCom.GetChild("content").asGroup; group.visible = true; FriendsCom.GetChild("title").asTextField.text = p2.Title; FriendsCom.GetChild("day").asTextField.text = p2.Date; FriendsCom.GetChild("sendname").asTextField.text = p2.SendName; FriendsCom.GetChild("contentwords").asTextField.text = p2.Content; //领取状态 0表示未领取,1表示已领取 if (p2.State == 1) { FriendsCom.GetChild("get").visible = false; } else { FriendsCom.GetChild("get").visible = true; } var list = FriendsCom.GetChild("rewardslist").asList; list.RemoveChildren(0, -1, true); foreach (var p1 in p2.Rewards) { var teamrequest = UIPackage.CreateObject("GameUI", "Reward").asCom; list.AddChild(teamrequest); teamrequest.onClick.Add(() => { new ItemInfo(p1.ItemType); }); var clientitem = ExcelManager.Instance.GetItemManager().GetItemByID(p1.ItemType); if (clientitem != null) { teamrequest.GetChild("icon").asLoader.url = clientitem.IconPath; if (clientitem.ShowLevel == 1) { teamrequest.GetChild("level").visible = true; } else { teamrequest.GetChild("level").visible = false; } } if (p1.Count <= 1) { teamrequest.GetChild("count").asTextField.text = ""; } else { teamrequest.GetChild("count").asTextField.text = p1.Count + ""; } teamrequest.GetChild("level").asTextField.text = "Lv." + p1.Level + ""; } return(true); }
public bool SC_GetMailsList(Protomsg.MsgBase d1) { Debug.Log("SC_GetMailsList:"); IMessage IMperson = new Protomsg.SC_GetMailsList(); Protomsg.SC_GetMailsList p2 = (Protomsg.SC_GetMailsList)IMperson.Descriptor.Parser.ParseFrom(d1.Datas); sInstanse.FriendsCom.GetChild("content").asGroup.visible = false; var list = FriendsCom.GetChild("list").asList; list.RemoveChildren(0, -1, true); FriendsCom.GetChild("noticeinfo").asTextField.SetVar("count", p2.MailUpperLimit + ""); FriendsCom.GetChild("noticeinfo").asTextField.FlushVars(); FriendsCom.GetChild("count").asTextField.text = p2.Mails.Count + "/" + p2.MailUpperLimit; //处理排序 Protomsg.MailShortInfoMsg[] allplayer = new Protomsg.MailShortInfoMsg[p2.Mails.Count]; int index = 0; foreach (var item in p2.Mails) { allplayer[index++] = item; } //排序 System.Array.Sort(allplayer, (s1, s2) => { if (s1.Id < s2.Id) { return(1); } else if (s1.Id == s2.Id) { return(0); } return(-1); }); foreach (var p1 in allplayer) { var teamrequest = UIPackage.CreateObject("GameUI", "MailOne").asCom; teamrequest.data = p1; list.AddChild(teamrequest); AudioManager.Am.Play2DSound(AudioManager.Sound_OpenLittleUI); teamrequest.GetChild("title").asTextField.text = p1.Title; teamrequest.GetChild("day").asTextField.text = p1.Date; teamrequest.GetChild("sendname").asTextField.text = p1.SendName; //领取状态 0表示未领取,1表示已领取 if (p1.State == 1) { teamrequest.alpha = 0.5f; //teamrequest.GetChild("bg").asImage.color = new Color(0.7f, 0.7f, 0.7f); } else { teamrequest.alpha = 1; //teamrequest.GetChild("bg").asImage.color = new Color(1, 1, 1); } //查看详细信息 teamrequest.onClick.Add(() => { //解析分隔数据 Protomsg.CS_GetMailInfo msg = new Protomsg.CS_GetMailInfo(); msg.Id = p1.Id; MyKcp.Instance.SendMsg(GameScene.Singleton.m_ServerName, "CS_GetMailInfo", msg); }); } return(true); }
public bool SC_GetAllGuildsInfo(Protomsg.MsgBase d1) { Debug.Log("SC_GetAllGuildsInfo:"); IMessage IMperson = new Protomsg.SC_GetAllGuildsInfo(); Protomsg.SC_GetAllGuildsInfo p1 = (Protomsg.SC_GetAllGuildsInfo)IMperson.Descriptor.Parser.ParseFrom(d1.Datas); //创建界面 if (main != null) { main.Dispose(); } main = UIPackage.CreateObject("GameUI", "AllGuilds").asCom; GRoot.inst.AddChild(main); main.xy = Tool.GetPosition(0.5f, 0.5f); main.GetChild("close").asButton.onClick.Add(() => { this.Destroy(); }); //创建公会按钮 main.GetChild("add").asButton.onClick.Add(() => { this.createguildwindow(p1.CreatePrice, p1.CreatePriceType); }); //main.GetChild("list").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; } System.Array.Sort(allplayer, (a, b) => { if (a.Rank < b.Rank) { return(1); } else if (a.Rank == b.Rank) { if (a.Level > b.Level) { return(1); } else if (a.Level == b.Level) { if (a.Experience > b.Experience) { return(1); } else { return(-1); } } else { return(-1); } } return(0); }); foreach (var item in allplayer) { var onedropitem = UIPackage.CreateObject("GameUI", "GuildsOne").asCom; onedropitem.GetChild("add").onClick.Add(() => { //申请加入公会 Protomsg.CS_JoinGuild msg1 = new Protomsg.CS_JoinGuild(); msg1.ID = item.ID; MyKcp.Instance.SendMsg(GameScene.Singleton.m_ServerName, "CS_JoinGuild", msg1); }); onedropitem.GetChild("name").asTextField.text = item.Name; onedropitem.GetChild("level").asTextField.text = item.Level + ""; onedropitem.GetChild("count").asTextField.text = item.CharacterCount + "/" + item.MaxCount; onedropitem.GetChild("president").asTextField.text = item.PresidentName; onedropitem.GetChild("levellimit").asTextField.text = item.Joinlevellimit + ""; main.GetChild("list").asList.AddChild(onedropitem); } 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); }
public bool SC_GetFriendsList(Protomsg.MsgBase d1) { Debug.Log("SC_GetFriendsList:"); IMessage IMperson = new Protomsg.SC_GetFriendsList(); Protomsg.SC_GetFriendsList p2 = (Protomsg.SC_GetFriendsList)IMperson.Descriptor.Parser.ParseFrom(d1.Datas); var list = FriendsCom.GetChild("list").asList; list.RemoveChildren(); foreach (var p1 in p2.FriendsRequest) { var teamrequest = UIPackage.CreateObject("GameUI", "FriendRequest").asCom; list.AddChild(teamrequest); AudioManager.Am.Play2DSound(AudioManager.Sound_OpenLittleUI); //SrcUnitTypeID var clientitem = ExcelManager.Instance.GetUnitInfoManager().GetUnitInfoByID(p1.Typeid); if (clientitem != null) { teamrequest.GetChild("headicon").asLoader.url = clientitem.IconPath; } teamrequest.GetChild("name").asTextField.text = p1.Name; teamrequest.GetChild("level").asTextField.text = p1.Level + ""; teamrequest.GetChild("no_btn").asButton.onClick.Add(() => { //回复拒绝好友请求 Protomsg.CS_AddFriendResponse msg = new Protomsg.CS_AddFriendResponse(); msg.Result = 2;//1同意 2拒绝 msg.FriendInfo = p1; MyKcp.Instance.SendMsg(GameScene.Singleton.m_ServerName, "CS_AddFriendResponse", msg); list.RemoveChild(teamrequest); }); teamrequest.GetChild("yes_btn").asButton.onClick.Add(() => { //回复同意组队请求 Protomsg.CS_AddFriendResponse msg = new Protomsg.CS_AddFriendResponse(); msg.Result = 1;//1同意 2拒绝 msg.FriendInfo = p1; MyKcp.Instance.SendMsg(GameScene.Singleton.m_ServerName, "CS_AddFriendResponse", msg); list.RemoveChild(teamrequest); }); } //处理排序 Protomsg.FriendInfoMsg[] allplayer = new Protomsg.FriendInfoMsg[p2.Friends.Count]; int index = 0; foreach (var item in p2.Friends) { allplayer[index++] = item; } //排序 System.Array.Sort(allplayer, (s1, s2) => { if (s1.State > s2.State) { return(1); } else if (s1.State == s2.State) { return(0); } return(-1); }); foreach (var p1 in allplayer) { var teamrequest = UIPackage.CreateObject("GameUI", "FriendOne").asCom; list.AddChild(teamrequest); AudioManager.Am.Play2DSound(AudioManager.Sound_OpenLittleUI); //SrcUnitTypeID var clientitem = ExcelManager.Instance.GetUnitInfoManager().GetUnitInfoByID(p1.Typeid); if (clientitem != null) { teamrequest.GetChild("headicon").asLoader.url = clientitem.IconPath; } teamrequest.GetChild("name").asTextField.text = p1.Name; teamrequest.GetChild("level").asTextField.text = p1.Level + ""; if (p1.State == 1) { //在线 teamrequest.GetChild("discript").asTextField.text = "在线"; teamrequest.GetChild("discript").asTextField.color = new Color(1, 1, 1); teamrequest.GetChild("name").asTextField.color = new Color(1, 1, 1); teamrequest.GetChild("level").asTextField.color = new Color(1, 1, 1); teamrequest.GetChild("levelword").asTextField.color = new Color(1, 1, 1); teamrequest.onClick.Add(() => { //onlinefriendclick var headselect = UIPackage.CreateObject("GameUI", "onlinefriendclick").asCom; GRoot.inst.ShowPopup(headselect); headselect.GetChild("siliao").asButton.onClick.Add(() => { ChatUI.SOpenChatBox("zonghe", p1.Name, p1.Uid); GRoot.inst.HidePopup(headselect); }); headselect.GetChild("info").asButton.onClick.Add(() => { new HeroSimpleInfo(p1.Characterid); }); //注销组队功能 //headselect.GetChild("zudui").asButton.onClick.Add(() => //{ // Protomsg.CS_OrganizeTeam msg1 = new Protomsg.CS_OrganizeTeam(); // msg1.Player1 = GameScene.Singleton.m_MyMainUnit.ControlID; // msg1.Player2 = p1.Uid; // MyKcp.Instance.SendMsg(GameScene.Singleton.m_ServerName, "CS_OrganizeTeam", msg1); // GRoot.inst.HidePopup(headselect); //}); }); } else { //离线 teamrequest.GetChild("discript").asTextField.text = "离线"; teamrequest.GetChild("discript").asTextField.color = new Color(0.2f, 0.2f, 0.2f); teamrequest.GetChild("name").asTextField.color = new Color(0.2f, 0.2f, 0.2f); teamrequest.GetChild("level").asTextField.color = new Color(0.2f, 0.2f, 0.2f); teamrequest.GetChild("levelword").asTextField.color = new Color(0.2f, 0.2f, 0.2f); teamrequest.onClick.Add(() => { new HeroSimpleInfo(p1.Characterid); }); } } return(true); }
public bool SC_GetCharacterSimpleInfo(Protomsg.MsgBase d1) { Debug.Log("SC_GetCharacterSimpleInfo:"); IMessage IMperson = new Protomsg.SC_GetCharacterSimpleInfo(); Protomsg.SC_GetCharacterSimpleInfo p1 = (Protomsg.SC_GetCharacterSimpleInfo)IMperson.Descriptor.Parser.ParseFrom(d1.Datas); main.GetChild("name").asTextField.text = p1.Name; main.GetChild("level").asTextField.text = "lv." + p1.Level; main.GetChild("lastlogindate").asTextField.text = p1.LastLoginDate; //道具 for (var j = 0; j < p1.EquipItems.Count; j++) { var item = main.GetChild("item" + (j + 1)).asButton; if (item == null) { continue; } var itemstrarr = p1.EquipItems[j].Split(','); if (itemstrarr.Length < 2) { item.GetChild("level").visible = false; continue; } var typeid = int.Parse(itemstrarr[0]); var level = int.Parse(itemstrarr[1]); var clientitem = ExcelManager.Instance.GetItemManager().GetItemByID(typeid); if (clientitem == null) { item.asButton.icon = ""; item.asButton.GetChild("level").asTextField.text = ""; continue; } item.asButton.icon = clientitem.IconPath; item.asButton.GetChild("level").asTextField.text = "Lv." + level; item.onClick.Add(() => { if (typeid != -1) { new ItemInfo(typeid); } }); } //技能 InitSkillInfo(p1.Skills); //模型 var modeeffect = (GameObject)(GameObject.Instantiate(Resources.Load(p1.ModeType))); modeeffect.transform.localPosition = new Vector3(0, 0, 100); var box = modeeffect.GetComponent <BoxCollider>(); modeeffect.transform.localScale = new Vector3(100, 100, 100); if (box != null) { var scale = box.size.y / 1.2f; modeeffect.transform.localScale = new Vector3(100 / scale, 100 / scale, 100 / scale); } Vector3 rotation = modeeffect.transform.localEulerAngles; rotation.x = 10; // 在这里修改坐标轴的值 rotation.y = 180; rotation.z = 0; //将旋转的角度赋值给预制 modeeffect.transform.localEulerAngles = rotation; //var modeeffect = (GameObject)(GameObject.Instantiate(Resources.Load(p1.ModeType))); //modeeffect.transform.localPosition = new Vector3(0, 0, 100); GGraph holder = main.GetChild("heromode").asGraph; GoWrapper wrapper = new GoWrapper(modeeffect); holder.SetNativeObject(wrapper); holder.z = 10; return(true); }
//夺宝奇兵 SC_GetDuoBaoInfo public bool SC_GetDuoBaoInfo(Protomsg.MsgBase d1) { Debug.Log("SC_GetDuoBaoInfo:"); IMessage IMperson = new Protomsg.SC_GetDuoBaoInfo(); Protomsg.SC_GetDuoBaoInfo p1 = (Protomsg.SC_GetDuoBaoInfo)IMperson.Descriptor.Parser.ParseFrom(d1.Datas); var item = p1.MapGoInInfo; var clientitem = ExcelManager.Instance.GetSceneManager().GetSceneByID(item.NextSceneID); if (clientitem == null) { return(true); } var onedropitem = main.GetChild("duobaocom").asCom; onedropitem.GetChild("des").asTextField.SetVar("p1", p1.Minute + ""); onedropitem.GetChild("des").asTextField.FlushVars(); //onedropitem.GetChild("item").asCom.GetChild("icon").asLoader.url = clientitem.IconPath; onedropitem.GetChild("name").asTextField.text = clientitem.Name; onedropitem.GetChild("guildlevel").asTextField.text = item.NeedLevel + ""; onedropitem.GetChild("time").asTextField.text = item.OpenStartTime + "--" + item.OpenEndTime; onedropitem.GetChild("week").asTextField.text = "周" + item.OpenWeekDay; onedropitem.GetChild("pricetype").asLoader.url = Tool.GetPriceTypeIcon(item.PriceType); onedropitem.GetChild("price").asTextField.text = item.Price + ""; //进入 onedropitem.GetChild("goto").asButton.onClick.Set(() => { Protomsg.CS_GotoActivityMap msg1 = new Protomsg.CS_GotoActivityMap(); msg1.ID = item.ID; MyKcp.Instance.SendMsg(GameScene.Singleton.m_ServerName, "CS_GotoActivityMap", msg1); }); //地图信息 //掉落道具 onedropitem.GetChild("droplist").asList.RemoveChildren(0, -1, true); int[] allplayer = new int[p1.MapInfo.DropItems.Count]; p1.MapInfo.DropItems.CopyTo(allplayer, 0); System.Array.Sort(allplayer, (a, b) => { if (a > b) { return(1); } else if (a < b) { return(-1); } return(0); }); foreach (var itemdrop in allplayer) { var clientitemdrop = ExcelManager.Instance.GetItemManager().GetItemByID(itemdrop); if (clientitemdrop == null) { continue; } var onedropitemdrop = UIPackage.CreateObject("GameUI", "sellable").asCom; onedropitemdrop.GetChild("icon").asLoader.url = clientitemdrop.IconPath; onedropitemdrop.GetChild("icon").onClick.Add(() => { new ItemInfo(itemdrop); }); onedropitemdrop.GetChild("level").asTextField.text = "lv.1"; onedropitem.GetChild("droplist").asList.AddChild(onedropitemdrop); } return(true); }
public bool SC_GetExchangeDetailedCommoditys(Protomsg.MsgBase d1) { Debug.Log("SC_GetExchangeDetailedCommoditys:"); IMessage IMperson = new Protomsg.SC_GetExchangeDetailedCommoditys(); Protomsg.SC_GetExchangeDetailedCommoditys p1 = (Protomsg.SC_GetExchangeDetailedCommoditys)IMperson.Descriptor.Parser.ParseFrom(d1.Datas); main.GetChild("buylist").asList.RemoveChildren(0, -1, true); //处理排序 Protomsg.ExchangeDetailedCommodityData[] allplayer = new Protomsg.ExchangeDetailedCommodityData[p1.Commoditys.Count]; int index = 0; foreach (var item in p1.Commoditys) { allplayer[index++] = item; } System.Array.Sort(allplayer, (a, b) => { if (a.CommodityData.Price > b.CommodityData.Price) { return(1); } else if (a.CommodityData.Price == b.CommodityData.Price) { if (a.CommodityData.TypeID > b.CommodityData.TypeID) { return(1); } else if (a.CommodityData.TypeID < b.CommodityData.TypeID) { return(-1); } return(0); } else { return(-1); } }); foreach (var item in allplayer) { var clientitem = ExcelManager.Instance.GetItemManager().GetItemByID(item.CommodityData.ItemID); if (clientitem == null) { continue; } var onedropitem = UIPackage.CreateObject("GameUI", "exchangecommodity").asCom; onedropitem.GetChild("icon").asLoader.url = clientitem.IconPath; onedropitem.GetChild("name").asTextField.text = clientitem.Name; onedropitem.GetChild("icon").onClick.Add(() => { new ItemInfo(item.CommodityData.ItemID); }); onedropitem.GetChild("price").asTextField.text = item.CommodityData.Price + ""; onedropitem.GetChild("level").asTextField.text = "lv." + item.CommodityData.Level + ""; onedropitem.GetChild("pricetype").asLoader.url = Tool.GetPriceTypeIcon(item.CommodityData.PriceType); onedropitem.GetChild("n2").onClick.Add(() => { //购买 var sellwindow = UIPackage.CreateObject("GameUI", "exchangebuy").asCom; GRoot.inst.AddChild(sellwindow); sellwindow.xy = Tool.GetPosition(0.5f, 0.5f); sellwindow.GetChild("close").onClick.Add(() => { sellwindow.Dispose(); }); sellwindow.GetChild("yes_btn").onClick.Add(() => { Protomsg.CS_BuyExchangeCommodity msg1 = new Protomsg.CS_BuyExchangeCommodity(); msg1.ID = item.CommodityData.TypeID; MyKcp.Instance.SendMsg(GameScene.Singleton.m_ServerName, "CS_BuyExchangeCommodity", msg1); sellwindow.Dispose(); }); sellwindow.GetChild("item").asCom.GetChild("icon").asLoader.url = clientitem.IconPath; sellwindow.GetChild("item").asCom.GetChild("level").asTextField.text = "lv." + item.CommodityData.Level + ""; sellwindow.GetChild("name").asTextField.text = clientitem.Name; sellwindow.GetChild("pricetype").asLoader.url = Tool.GetPriceTypeIcon(item.CommodityData.PriceType); sellwindow.GetChild("price").asTextField.text = item.CommodityData.Price + ""; }); main.GetChild("buylist").asList.AddChild(onedropitem); } return(true); }
//获取副本信息 public bool SC_GetCopyMapsInfo(Protomsg.MsgBase d1) { Debug.Log("SC_GetCopyMapsInfo:"); IMessage IMperson = new Protomsg.SC_GetCopyMapsInfo(); Protomsg.SC_GetCopyMapsInfo p1 = (Protomsg.SC_GetCopyMapsInfo)IMperson.Descriptor.Parser.ParseFrom(d1.Datas); main.GetChild("maplist").asList.RemoveChildren(0, -1, true); main.GetChild("playcount").asTextField.SetVar("p1", p1.RemainPlayTimes + ""); main.GetChild("playcount").asTextField.FlushVars(); Protomsg.CopyMapInfo[] allplayer = new Protomsg.CopyMapInfo[p1.Maps.Count]; p1.Maps.CopyTo(allplayer, 0); System.Array.Sort(allplayer, (a, b) => { if (a.NeedLevel > b.NeedLevel) { return(-1); } return(1); }); //遍历 foreach (var item in allplayer) { var clientitem = ExcelManager.Instance.GetSceneManager().GetSceneByID(item.NextSceneID); if (clientitem == null) { continue; } var onedropitem = UIPackage.CreateObject("GameUI", "CopyMapInfo").asCom; //onedropitem.GetChild("item").asCom.GetChild("icon").asLoader.url = clientitem.IconPath; onedropitem.GetChild("name").asTextField.text = clientitem.Name; onedropitem.GetChild("guildlevel").asTextField.text = item.NeedLevel + ""; onedropitem.GetChild("playercount").asTextField.text = item.PlayerCount + ""; //进入 onedropitem.GetChild("pipei").asButton.onClick.Add(() => { Protomsg.CS_CopyMapPiPei msg1 = new Protomsg.CS_CopyMapPiPei(); msg1.CopyMapID = item.ID; MyKcp.Instance.SendMsg(GameScene.Singleton.m_ServerName, "CS_CopyMapPiPei", msg1); }); //地图信息 onedropitem.GetChild("cancel").asButton.onClick.Add(() => { Protomsg.CS_CopyMapCancel msg1 = new Protomsg.CS_CopyMapCancel(); MyKcp.Instance.SendMsg(GameScene.Singleton.m_ServerName, "CS_CopyMapCancel", 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); }); if (item.State == 1)//可以匹配 { Controller ct = onedropitem.GetController("c1"); ct.SetSelectedIndex(0); } else if (item.State == 2)//匹配中 { Controller ct = onedropitem.GetController("c1"); ct.SetSelectedIndex(1); } main.GetChild("maplist").asList.AddChild(onedropitem); } return(true); }
public bool SC_GetGuildInfo(Protomsg.MsgBase d1) { Debug.Log("SC_GetGuildInfo:"); IMessage IMperson = new Protomsg.SC_GetGuildInfo(); Protomsg.SC_GetGuildInfo p1 = (Protomsg.SC_GetGuildInfo)IMperson.Descriptor.Parser.ParseFrom(d1.Datas); //创建界面 if (main != null) { main.Dispose(); } main = UIPackage.CreateObject("GameUI", "GuildInfo").asCom; GRoot.inst.AddChild(main); main.xy = Tool.GetPosition(0.5f, 0.5f); main.GetChild("close").asButton.onClick.Add(() => { this.Destroy(); }); //自己退出公会 main.GetChild("exit").asButton.onClick.Add(() => { Tool.NoticeWindonw("你确定要退出公会吗?", () => { Protomsg.CS_GuildOperate msg1 = new Protomsg.CS_GuildOperate(); msg1.Code = 1;// MyKcp.Instance.SendMsg(GameScene.Singleton.m_ServerName, "CS_GuildOperate", msg1); }); }); //解散公会 main.GetChild("dismiss").asButton.onClick.Add(() => { Tool.NoticeWindonw("你确定要解散公会吗?", () => { Protomsg.CS_GuildOperate msg1 = new Protomsg.CS_GuildOperate(); msg1.Code = 2;// MyKcp.Instance.SendMsg(GameScene.Singleton.m_ServerName, "CS_GuildOperate", msg1); }); }); //修改公告 main.GetChild("editornotice").asButton.onClick.Add(() => { createguildeditornotice(p1.GuildBaseInfo.Notice); }); // main.GetChild("request").asButton.onClick.Add(() => { //查看申请列表 Protomsg.CS_GetJoinGuildPlayer msg1 = new Protomsg.CS_GetJoinGuildPlayer(); msg1.ID = p1.GuildBaseInfo.ID; MyKcp.Instance.SendMsg(GameScene.Singleton.m_ServerName, "CS_GetJoinGuildPlayer", msg1); }); //查看拍卖行 main.GetChild("auction").asButton.onClick.Add(() => { //查看申请列表 Protomsg.CS_GetAuctionItems msg1 = new Protomsg.CS_GetAuctionItems(); MyKcp.Instance.SendMsg(GameScene.Singleton.m_ServerName, "CS_GetAuctionItems", msg1); }); //查看公会地图 main.GetChild("huodong").asButton.onClick.Add(() => { //查看申请列表 Protomsg.CS_GetGuildMapsInfo msg1 = new Protomsg.CS_GetGuildMapsInfo(); msg1.ID = p1.GuildBaseInfo.ID; MyKcp.Instance.SendMsg(GameScene.Singleton.m_ServerName, "CS_GetGuildMapsInfo", msg1); }); //查看公会排名信息 main.GetChild("rank").asButton.onClick.Add(() => { Protomsg.CS_GetGuildRankInfo msg1 = new Protomsg.CS_GetGuildRankInfo(); MyKcp.Instance.SendMsg(GameScene.Singleton.m_ServerName, "CS_GetGuildRankInfo", msg1); }); //-------------------------公会成员-------------------------- //处理排序 Protomsg.GuildChaInfo[] allplayer = new Protomsg.GuildChaInfo[p1.Characters.Count]; int index = 0; foreach (var item in p1.Characters) { allplayer[index++] = item; Debug.Log("SC_GetGuildInfo111 :" + item.Level + " name:" + item.Name); } Array.Sort(allplayer, (a, b) => { if (a.Post > b.Post) { return(-1); } else if (a.Post == b.Post) { if (a.Level > b.Level) { return(-1); } else if (a.Level == b.Level) { //return 0; if (a.PinLevel > b.PinLevel) { return(-1); } else if (a.PinLevel == b.PinLevel) { if (a.PinExperience > b.PinExperience) { return(-1); } else { return(1); } } else { return(1); } } else { return(1); } } else { return(1); } }); foreach (var item in allplayer) { Debug.Log("SC_GetGuildInfo :" + item.Level + " name:" + item.Name); var onedropitem = UIPackage.CreateObject("GameUI", "GuildPlayerOne").asCom; onedropitem.GetChild("heroicon").onClick.Add(() => { new HeroSimpleInfo(item.Characterid); }); //改变职位 onedropitem.GetChild("changepost").onClick.Add(() => { var teamrequest = UIPackage.CreateObject("GameUI", "ChangePost").asCom; GRoot.inst.AddChild(teamrequest); teamrequest.xy = Tool.GetPosition(0.5f, 0.5f); teamrequest.GetChild("close").asButton.onClick.Add(() => { teamrequest.Dispose(); }); AudioManager.Am.Play2DSound(AudioManager.Sound_OpenLittleUI); //SrcUnitTypeID var clientcha = ExcelManager.Instance.GetUnitInfoManager().GetUnitInfoByID(item.Typeid); if (clientcha != null) { teamrequest.GetChild("headicon").asLoader.url = clientcha.IconPath; } teamrequest.GetChild("name").asTextField.text = item.Name; teamrequest.GetChild("level").asTextField.text = item.Level + ""; teamrequest.GetChild("post1").asButton.onClick.Add(() => { //回复拒绝好友请求 Protomsg.CS_ChangePost msg1 = new Protomsg.CS_ChangePost(); msg1.Characterid = item.Characterid; msg1.Post = 1; MyKcp.Instance.SendMsg(GameScene.Singleton.m_ServerName, "CS_ChangePost", msg1); teamrequest.Dispose(); }); teamrequest.GetChild("post9").asButton.onClick.Add(() => { //回复同意组队请求 Protomsg.CS_ChangePost msg1 = new Protomsg.CS_ChangePost(); msg1.Characterid = item.Characterid; msg1.Post = 9; MyKcp.Instance.SendMsg(GameScene.Singleton.m_ServerName, "CS_ChangePost", msg1); teamrequest.Dispose(); }); }); onedropitem.GetChild("add").onClick.Add(() => { //踢出公会 Tool.NoticeWindonw("你确定要把(" + item.Name + ")踢出公会吗?", () => { Protomsg.CS_DeleteGuildPlayer msg1 = new Protomsg.CS_DeleteGuildPlayer(); msg1.Characterid = item.Characterid; MyKcp.Instance.SendMsg(GameScene.Singleton.m_ServerName, "CS_DeleteGuildPlayer", msg1); }); }); onedropitem.GetChild("name").asTextField.text = item.Name; onedropitem.GetChild("level").asTextField.text = item.Level + ""; onedropitem.GetChild("pinlevel").asTextField.text = item.PinLevelName; onedropitem.GetChild("post").asTextField.text = item.PostName; onedropitem.GetChild("experience").asTextField.text = item.PinExperience + "/" + item.PinMaxExperience; var clientitem = ExcelManager.Instance.GetUnitInfoManager().GetUnitInfoByID(item.Typeid); if (clientitem != null) { onedropitem.GetChild("heroicon").asLoader.url = clientitem.IconPath; } main.GetChild("mainlist").asList.AddChild(onedropitem); } //-----------------公会信息------------------ main.GetChild("name").asTextField.text = p1.GuildBaseInfo.Name; main.GetChild("level").asTextField.text = "Lv." + p1.GuildBaseInfo.Level; main.GetChild("experience").asTextField.text = p1.GuildBaseInfo.Experience + "/" + p1.GuildBaseInfo.MaxExperience; main.GetChild("playercount").asTextField.text = p1.GuildBaseInfo.CharacterCount + "/" + p1.GuildBaseInfo.MaxCount; main.GetChild("gonggao").asTextField.text = p1.GuildBaseInfo.Notice; return(true); }
public bool SC_StoreData(Protomsg.MsgBase d1) { //Debug.Log("SC_NoticeWords:"); IMessage IMperson = new Protomsg.SC_StoreData(); Protomsg.SC_StoreData p1 = (Protomsg.SC_StoreData)IMperson.Descriptor.Parser.ParseFrom(d1.Datas); main.GetChild("n3").asList.RemoveChildren(); //排序 //处理排序 Protomsg.CommodityDataProto[] allplayer = new Protomsg.CommodityDataProto[p1.Commoditys.Count]; int index = 0; foreach (var item in p1.Commoditys) { allplayer[index++] = item; } System.Array.Sort(allplayer, (a, b) => { if (a.PriceType == b.PriceType) { if (a.Price > b.Price) { return(1); } else if (a.Price == b.Price) { return(0); } return(-1); } else if (a.PriceType > b.PriceType) { return(1); } else { return(-1); } }); foreach (var item in allplayer) { var clientitem = ExcelManager.Instance.GetItemManager().GetItemByID(item.ItemID); if (clientitem == null) { continue; } var onedropitem = UIPackage.CreateObject("GameUI", "Commodity").asCom; onedropitem.GetChild("n0").asLoader.url = clientitem.IconPath; onedropitem.GetChild("n3").asLoader.url = Tool.GetPriceTypeIcon(item.PriceType); onedropitem.GetChild("n0").onClick.Add(() => { new ItemInfo(item.ItemID); }); onedropitem.GetChild("n4").asTextField.text = item.Price + ""; onedropitem.GetChild("level").asTextField.text = "Lv." + item.Level + ""; onedropitem.GetChild("n1").asButton.onClick.Add(() => { //购买 Protomsg.CS_BuyCommodity msg1 = new Protomsg.CS_BuyCommodity(); msg1.TypeID = item.TypeID; MyKcp.Instance.SendMsg(GameScene.Singleton.m_ServerName, "CS_BuyCommodity", msg1); }); main.GetChild("n3").asList.AddChild(onedropitem); } return(true); }
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_GetJoinGuildPlayer(Protomsg.MsgBase d1) { Debug.Log("SC_GetJoinGuildPlayer:"); IMessage IMperson = new Protomsg.SC_GetJoinGuildPlayer(); Protomsg.SC_GetJoinGuildPlayer p1 = (Protomsg.SC_GetJoinGuildPlayer)IMperson.Descriptor.Parser.ParseFrom(d1.Datas); //创建界面 if (main == null) { return(true); } //-------------------------公会成员-------------------------- main.GetChild("requestlist").asList.RemoveChildren(0, -1, true); //处理排序 Protomsg.GuildChaInfo[] allplayer = new Protomsg.GuildChaInfo[p1.RequestCharacters.Count]; int index = 0; foreach (var item in p1.RequestCharacters) { allplayer[index++] = item; } System.Array.Sort(allplayer, (a, b) => { if (a.Level > b.Level) { return(1); } else { return(-1); } }); foreach (var item in allplayer) { var onedropitem = UIPackage.CreateObject("GameUI", "GuildRequestPlayerOne").asCom; onedropitem.GetChild("heroicon").onClick.Add(() => { new HeroSimpleInfo(item.Characterid); }); onedropitem.GetChild("agree").onClick.Add(() => { //同意 Protomsg.CS_ResponseJoinGuildPlayer msg1 = new Protomsg.CS_ResponseJoinGuildPlayer(); msg1.Characterid = item.Characterid; msg1.Result = 1; MyKcp.Instance.SendMsg(GameScene.Singleton.m_ServerName, "CS_ResponseJoinGuildPlayer", msg1); }); onedropitem.GetChild("no").onClick.Add(() => { //拒绝 Protomsg.CS_ResponseJoinGuildPlayer msg1 = new Protomsg.CS_ResponseJoinGuildPlayer(); msg1.Characterid = item.Characterid; msg1.Result = 0; MyKcp.Instance.SendMsg(GameScene.Singleton.m_ServerName, "CS_ResponseJoinGuildPlayer", msg1); }); onedropitem.GetChild("name").asTextField.text = item.Name; onedropitem.GetChild("level").asTextField.text = item.Level + ""; var clientitem = ExcelManager.Instance.GetUnitInfoManager().GetUnitInfoByID(item.Typeid); if (clientitem != null) { onedropitem.GetChild("heroicon").asLoader.url = clientitem.IconPath; } main.GetChild("requestlist").asList.AddChild(onedropitem); } return(true); }
public bool SC_GetWorldAuctionItems(Protomsg.MsgBase d1) { Debug.Log("SC_GetWorldAuctionItems:"); IMessage IMperson = new Protomsg.SC_GetWorldAuctionItems(); Protomsg.SC_GetWorldAuctionItems p1 = (Protomsg.SC_GetWorldAuctionItems)IMperson.Descriptor.Parser.ParseFrom(d1.Datas); if (main == null) { return(true); } main.GetChild("auctionlist").asList.RemoveChildren(0, -1, true); //处理排序 Protomsg.AuctionItem[] allplayer = new Protomsg.AuctionItem[p1.Items.Count]; p1.Items.CopyTo(allplayer, 0); System.Array.Sort(allplayer, (a, b) => { if (a.RemainTime > b.RemainTime) { return(1); } else if (a.RemainTime < b.RemainTime) { return(-1); } return(0); }); //遍历 foreach (var item in allplayer) { var clientitem = ExcelManager.Instance.GetItemManager().GetItemByID(item.ItemID); if (clientitem == null) { continue; } var onedropitem = UIPackage.CreateObject("GameUI", "worldAuctionOne").asCom; if (clientitem.Name == "") { onedropitem.GetChild("name").asTextField.text = "无"; } else { onedropitem.GetChild("name").asTextField.text = clientitem.Name; } onedropitem.GetChild("item").asCom.GetChild("icon").asLoader.url = clientitem.IconPath; onedropitem.GetChild("item").asCom.GetChild("level").asTextField.text = item.Level + ""; onedropitem.GetChild("item").asCom.onClick.Add(() => { string des = "\n\n参与分红的成员:\n"; foreach (var item1 in item.ReceivecharactersName) { if (item1 == item.ReceivecharactersName[item.ReceivecharactersName.Count - 1]) { des += item1; } else { des += item1 + ","; } } new ItemInfo(item.ItemID).AddDes(des); }); onedropitem.GetChild("pricetype").asLoader.url = Tool.GetPriceTypeIcon(item.PriceType); onedropitem.GetChild("price").asTextField.text = item.Price + ""; onedropitem.GetChild("playername").asTextField.text = item.BidderCharacterName; onedropitem.GetChild("remaintime").asTextField.text = Tool.Time2String(item.RemainTime); //出价 onedropitem.GetChild("add").asButton.onClick.Add(() => { //售卖 var sellwindow = UIPackage.CreateObject("GameUI", "NewPrice").asCom; GRoot.inst.AddChild(sellwindow); sellwindow.xy = Tool.GetPosition(0.5f, 0.5f); sellwindow.GetChild("close").onClick.Add(() => { sellwindow.Dispose(); }); sellwindow.GetChild("yes_btn").onClick.Add(() => { var txt = sellwindow.GetChild("input").asTextInput.text; if (txt.Length <= 0) { Tool.NoticeWords("请输入价格!", null); return; } int price = 0; try { price = Convert.ToInt32(txt); //报异常 } catch (SystemException e) { Tool.NoticeWords("请输入正确的价格!", null); return; } if (price <= 0) { Tool.NoticeWords("请输入正确的价格!", null); return; } //上架 Protomsg.CS_NewPriceWorldAuctionItem msg1 = new Protomsg.CS_NewPriceWorldAuctionItem(); msg1.Price = price; msg1.ID = item.ID; MyKcp.Instance.SendMsg(GameScene.Singleton.m_ServerName, "CS_NewPriceWorldAuctionItem", msg1); sellwindow.Dispose(); }); sellwindow.GetChild("item").asCom.GetChild("icon").asLoader.url = clientitem.IconPath; sellwindow.GetChild("item").asCom.GetChild("level").asTextField.text = item.Level + ""; sellwindow.GetChild("name").asTextField.text = clientitem.Name; sellwindow.GetChild("pricetype").asLoader.url = Tool.GetPriceTypeIcon(item.PriceType); sellwindow.GetChild("input").asTextInput.text = (item.Price + 1) + ""; }); main.GetChild("auctionlist").asList.AddChild(onedropitem); } return(true); }