public static WorldMap_OtherRoleDieProto GetProto(byte[] buffer, bool isChild = false)
    {
        WorldMap_OtherRoleDieProto proto = new WorldMap_OtherRoleDieProto();

        MMO_MemoryStream ms = null;

        if (!isChild)
        {
            ms = GameEntry.Socket.SocketSendMS;
        }
        else
        {
            ms = GameEntry.Pool.DequeueClassObject <MMO_MemoryStream>();
        }
        ms.SetLength(0);
        ms.Write(buffer, 0, buffer.Length);
        ms.Position = 0;

        proto.AttackRoleId = ms.ReadInt();
        proto.DieCount     = ms.ReadInt();
        proto.RoleIdList   = new List <int>();
        for (int i = 0; i < proto.DieCount; i++)
        {
            int _RoleId = ms.ReadInt();  //角色编号
            proto.RoleIdList.Add(_RoleId);
        }

        if (isChild)
        {
            GameEntry.Pool.EnqueueClassObject(ms);
        }
        return(proto);
    }
示例#2
0
        /// <summary>
        /// 服务器发送角色死亡消息
        /// </summary>
        /// <param name="role"></param>
        /// <param name="lst"></param>
        private void SendOtherRoleDie(Role role, int attackRoleId, List <int> lst)
        {
            WorldMap_OtherRoleDieProto proto = new WorldMap_OtherRoleDieProto();

            proto.AttackRoleId = attackRoleId; //攻击者是谁
            proto.DieCount     = lst.Count;
            proto.RoleIdList   = lst;          //哪些人死亡

            role.Client_Socket.SendMsg(proto.ToArray(role.SocketSendMS));
        }
示例#3
0
    public static WorldMap_OtherRoleDieProto GetProto(byte[] buffer)
    {
        WorldMap_OtherRoleDieProto proto = new WorldMap_OtherRoleDieProto();

        using (MMO_MemoryStream ms = new MMO_MemoryStream(buffer))
        {
            proto.AttackRoleId = ms.ReadInt();
            proto.DieCount     = ms.ReadInt();
            proto.RoleIdList   = new List <int>();
            for (int i = 0; i < proto.DieCount; i++)
            {
                int _RoleId = ms.ReadInt();  //角色编号
                proto.RoleIdList.Add(_RoleId);
            }
        }
        return(proto);
    }
    public static WorldMap_OtherRoleDieProto GetProto(MMO_MemoryStream ms, byte[] buffer)
    {
        WorldMap_OtherRoleDieProto proto = new WorldMap_OtherRoleDieProto();

        ms.SetLength(0);
        ms.Write(buffer, 0, buffer.Length);
        ms.Position = 0;

        proto.AttackRoleId = ms.ReadInt();
        proto.DieCount     = ms.ReadInt();
        proto.RoleIdList   = new List <int>();
        for (int i = 0; i < proto.DieCount; i++)
        {
            int _RoleId = ms.ReadInt();  //角色编号
            proto.RoleIdList.Add(_RoleId);
        }

        return(proto);
    }