Esempio n. 1
0
        /// <summary>
        /// 下发关系列表
        /// </summary>
        public void RelationListClient()
        {
            Player player = UnitManager.Instance.GetUnitByIdx(m_char_idx) as Player;

            if (player == null)
            {
                return;
            }
            List <RelationInfo> list = new List <RelationInfo>();

            foreach (var obj in m_relations)
            {
                list.Add(obj.Value);
                if (list.Count == 10)
                {//每次下发10个
                    ss2c.RelationList msg = PacketPools.Get(ss2c.msg.RELATION_LIST) as ss2c.RelationList;
                    msg.list.AddRange(list);
                    ServerNetManager.Instance.SendProxy(player.client_uid, msg, false);

                    list.Clear();
                }
            }
            if (list.Count > 0)
            {
                ss2c.RelationList msg = PacketPools.Get(ss2c.msg.RELATION_LIST) as ss2c.RelationList;
                msg.list.AddRange(list);
                ServerNetManager.Instance.SendProxy(player.client_uid, msg, false);
            }
        }
 /// <summary>
 /// 关系列表
 /// </summary>
 private void OnRelationList(PacketBase packet)
 {
     ss2c.RelationList msg = packet as ss2c.RelationList;
     RelationDataManager.Instance.AddRelation(msg.list);
 }