public static void HandleServerData(ushort protocol, byte[] data) { switch (protocol) { case NetMsg.MSG_TALK_GOODS: { var msg = Net.S2CPackBase.DeserializePack <Net.S2CTalkGoods>(data); var goods = GoodsFactory.Create(msg.goods.gid, msg.goods); if (goods == null) { return; } string luaScript = GoodsHelper.GetGoodsLuaScriptByGoodsId(goods.type_idx); if (!string.IsNullOrEmpty(luaScript)) { return; } goods.id = msg.goods.oid; goods.num = msg.goods.num; goods.bind = msg.goods.bind; goods.expire_time = msg.goods.expire_time; Net.PkgStrengthInfo pkgStrengthInfo = null; if (msg.strengths != null && msg.strengths.Count > 0) { pkgStrengthInfo = msg.strengths[0]; } Net.PkgBaptizeInfo pkgBaptizeInfo = null; if (msg.baptizes != null && msg.baptizes.Count > 0) { pkgBaptizeInfo = msg.baptizes[0]; } GoodsHelper.ShowGoodsTips(goods, pkgStrengthInfo, pkgBaptizeInfo); break;; } } }
public static void ResponseClickEmojiTextHref(string origText) { if (origText.Contains("goodsOid")) { string idStr = origText.Replace("goodsOid=", ""); var matchs = Regex.Matches(idStr, @"\{(\d+),(\d+)\}"); foreach (Match _match in matchs) { if (_match.Success) { uint sendId = (DBTextResource.ParseUI(_match.Groups[1].Value)); ulong goodsOid = DBTextResource.ParseUL_s(_match.Groups[2].Value, 0); Net.C2STalkGoods pack = new Net.C2STalkGoods(); pack.uuid = sendId; pack.oid = goodsOid; //GameDebug.LogError("=============== OnClickHref test"); Net.NetClient.GetBaseClient().SendData <Net.C2STalkGoods>(xc.protocol.NetMsg.MSG_TALK_GOODS, pack); } } //兼容3个参数和2个参数 matchs = Regex.Matches(idStr, @"\{(\d+),(\d+),(\d+)\}"); foreach (Match _match in matchs) { if (_match.Success) { uint sendId = (DBTextResource.ParseUI(_match.Groups[1].Value)); ulong goodsOid = DBTextResource.ParseUL_s(_match.Groups[2].Value, 0); ulong goodsGid = DBTextResource.ParseUL_s(_match.Groups[3].Value, 0); Net.C2STalkGoods pack = new Net.C2STalkGoods(); pack.uuid = sendId; pack.oid = goodsOid; pack.gid = (uint)goodsGid; Net.NetClient.GetBaseClient().SendData <Net.C2STalkGoods>(xc.protocol.NetMsg.MSG_TALK_GOODS, pack); } } } else if (origText.Contains("teamId")) { var idStr = origText.Replace("teamId=", ""); var teamId = uint.Parse(idStr); TeamManager.Instance.Apply(teamId); } else if (origText.Contains("playerId")) {//查看玩家 var idStr = origText.Replace("playerId=", ""); List <string> param_list = DBTextResource.ParseArrayString(idStr, ";"); if (param_list.Count >= 5) { // 不能查看玩家自己的信息 if (param_list[0].Equals(LocalPlayerManager.Instance.LocalActorAttribute.UnitId.obj_idx.ToString()) == false) { Dictionary <string, string> playerInfo = new Dictionary <string, string>(); playerInfo.Clear(); playerInfo.Add("uuid", param_list[0]); xc.ui.ugui.UIManager.Instance.ShowWindow("UIWatchPlayerWindow", playerInfo); } } else { GameDebug.LogError("playerId param is error! idStr = " + idStr); } } else if (origText.Contains("jumpSysId=")) {//跳转系统ID var idStr = origText.Replace("jumpSysId=", ""); List <string> param_list = DBTextResource.ParseArrayString(idStr, ";"); if (param_list.Count >= 1) { uint sys_id = 0; if (uint.TryParse(param_list[0], out sys_id)) { if (LuaScriptMgr.Instance != null) { XLua.LuaFunction func = LuaScriptMgr.Instance.GetLuaFunction(LuaScriptMgr.Instance.Lua.Global, "GotoSysRouter_chatItem"); if (func != null) { func.Action(param_list); } } } } else { GameDebug.LogError("jumpSysId param is error! idStr = " + idStr); } } else if (origText.Contains("clientGoodsTips")) {//客户端拼凑的物品TIPS string idStr = origText; //var idStr = origText.Replace("clientGoodsTips=", ""); var matchs = Regex.Matches(origText, @"clientGoodsTips=\{(.+)\}"); foreach (Match _match in matchs) { if (_match.Success) { idStr = _match.Groups[1].Value; } } Goods item_info = xc.GoodsHelper.ParseClientGoodsStr(idStr); if (item_info != null) { GoodsHelper.ShowGoodsTips(item_info, null, null, "GuildWarehouseNormal"); } else { GameDebug.LogError("playerId param is error! idStr = " + idStr); } } else if (origText.Contains("enter_guild_manor")) {//进入帮派领地 if (SysConfigManager.GetInstance().CheckSysHasOpened(GameConst.SYS_OPEN_GUILD, true)) { if (LocalPlayerManager.Instance.GuildID > 0) { InstanceHelper.EnterGuildManor(); } else { xc.UINotice.Instance.ShowMessage(xc.TextHelper.GetConstText("CODE_TEXT_LOCALIZATION_77")); xc.ui.ugui.UIManager.GetInstance().ShowSysWindow("UIGuildWindow"); } } } else if (origText.Contains("goodsTips")) {//查看物品 string idStr = origText.Replace("goodsTips=", ""); var matchs = Regex.Matches(idStr, @"\{(\d+),(\d+)\}"); foreach (Match _match in matchs) { if (_match.Success) { uint sendId = (DBTextResource.ParseUI(_match.Groups[1].Value)); ulong goodsOid = DBTextResource.ParseUL_s(_match.Groups[2].Value, 0); Net.C2STalkGoods pack = new Net.C2STalkGoods(); pack.uuid = sendId; pack.oid = goodsOid; //GameDebug.LogError("=============== OnClickHref test"); Net.NetClient.GetBaseClient().SendData <Net.C2STalkGoods>(xc.protocol.NetMsg.MSG_TALK_GOODS, pack); } } } else if (origText.Contains("goodsGid")) { var matchs = Regex.Matches(origText, @"goodsGid=\{(\d+),(\d+)\}"); foreach (Match _match in matchs) { if (_match.Success) { //uint playerId = (DBTextResource.ParseUI(_match.Groups[1].Value)); uint goodsGid = DBTextResource.ParseUI(_match.Groups[2].Value); var goods = GoodsHelper.CreateGoodsByTypeId(goodsGid); if (goods != null) { GoodsHelper.ShowGoodsTips(goods); } } } } else if (origText.Contains("position=")) { var matchs = Regex.Matches(origText, @"position=\{(\d+),(\d+),(\d+\.?\d*),(\d+\.?\d*)\}"); foreach (Match _match in matchs) { if (_match.Success) { uint instanceId = DBTextResource.ParseUI(_match.Groups[1].Value); uint line = DBTextResource.ParseUI(_match.Groups[2].Value); float x = DBTextResource.ParseF(_match.Groups[3].Value); float z = DBTextResource.ParseF(_match.Groups[4].Value); ClientEventMgr.GetInstance().FireEvent( (int)ClientEvent.CE_CHAT_JUMP_TO_CONST_POSITION, new CEventEventParamArgs(instanceId, line, x, z)); } } } else if (origText.Contains("marketGoodsTips")) { var matchs = Regex.Matches(origText, @"marketGoodsTips=\{(\d+)\}"); foreach (Match _match in matchs) { if (_match.Success) { uint goodsOid = DBTextResource.ParseUI(_match.Groups[1].Value); Net.C2SMarketDetail pack = new Net.C2SMarketDetail(); pack.oid = goodsOid; Net.NetClient.GetBaseClient().SendData <Net.C2SMarketDetail>(xc.protocol.NetMsg.MSG_MARKET_DETAIL, pack); } } } else { ClientEventMgr.GetInstance().FireEvent((int)ClientEvent.CE_CHAT_RESPONSE_CLICK_TEXT_HREF, new CEventEventParamArgs(origText)); } }