Exemple #1
0
        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;
            }
        }