/// <summary> /// 处理服务端发送过来的分线信息 /// </summary> /// <param name="msg"></param> public void ProcessLineInfo(S2CMapLineState msg) { mLineInfos.Clear(); uint minLine = GameConstHelper.GetUint("GAME_LINE_MIN"); for (int i = 1; i <= minLine; i++) { mLineInfos.Add((uint)i, 0); } // 设置每条分线上的人数 foreach (var info in msg.hcounts) { uint count = 0; if (mLineInfos.TryGetValue(info.line, out count)) { mLineInfos[info.line] = info.count; } else { mLineInfos.Add(info.line, info.count); } } ClientEventMgr.GetInstance().FireEvent((int)ClientEvent.CE_LINE_INFO, new CEventBaseArgs(msg.dungeon_id)); }
void HandleServerData(ushort protocol, byte[] data) { switch (protocol) { case NetMsg.MSG_MAP_LINE_STATE: // 处理换线逻辑 { S2CMapLineState msg = S2CPackBase.DeserializePack <S2CMapLineState>(data); SceneHelp.Instance.ProcessLineInfo(msg); } break; case NetMsg.MSG_PLAYER_DISPLAY_INFO: // 处理查看其他玩家信息 { var msg = S2CPackBase.DeserializePack <S2CPlayerDisplayInfo>(data); var equip_infos = msg.equips; m_OtherPlayerEquip.Clear(); foreach (var info in equip_infos) { var equip_goods = GoodsHelper.CreateEquipGoodsFromNet(info); equip_goods.IsInstalledByOtherPlayer = true; m_OtherPlayerEquip.Add(equip_goods); } Equip.EquipHelper.CalculatorSuitNum(m_OtherPlayerEquip); m_OtherPlayerEquipPosInfos = Equip.EquipHelper.GetEquipPosInfosByPkgInfos(msg.strengths, msg.baptizes); ClientEventMgr.Instance.FireEvent((int)ClientEvent.CE_CLICKPLAY_DISPLAY_INFO, new CEventEventParamArgs(msg.info, m_OtherPlayerEquip, m_OtherPlayerEquipPosInfos)); } break; case NetMsg.MSG_MAP_GET_HANG_POS: // 请求挂机位置 { S2CMapGetHangPos msg = S2CPackBase.DeserializePack <S2CMapGetHangPos>(data); Vector3 pos = new Vector3(msg.pos.px * GlobalConst.UnitScale, 0f, msg.pos.py * GlobalConst.UnitScale); pos = PhysicsHelp.GetPosition(pos.x, pos.z); TargetPathManager.Instance.GoToConstPosition(msg.dungeon_id, msg.line_id, pos, null, () => { InstanceManager.Instance.SetOnHook(true); }); } break; default: break; } }