Пример #1
0
    public static WorldMap_OtherRoleMoveProto GetProto(byte[] buffer, bool isChild = false)
    {
        WorldMap_OtherRoleMoveProto proto = new WorldMap_OtherRoleMoveProto();

        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.RoleId     = ms.ReadInt();
        proto.TargetPosX = ms.ReadFloat();
        proto.TargetPosY = ms.ReadFloat();
        proto.TargetPosZ = ms.ReadFloat();
        proto.ServerTime = ms.ReadLong();
        proto.NeedTime   = ms.ReadInt();

        if (isChild)
        {
            GameEntry.Pool.EnqueueClassObject(ms);
        }
        return(proto);
    }
Пример #2
0
        /// <summary>
        /// 客户端发送当前角色移动消息
        /// </summary>
        /// <param name="role"></param>
        /// <param name="buffer"></param>
        private void OnWorldMapCurrRoleMove(Role role, byte[] buffer)
        {
            WorldMap_CurrRoleMoveProto proto = WorldMap_CurrRoleMoveProto.GetProto(role.SocketReceiveMS, buffer);
            //Console.WriteLine("我的服务器时间=" + proto.ServerTime);
            //Console.WriteLine("服    务器时间=" + DateTime.Now.ToUniversalTime().Ticks / 10000);

            List <Role> lst = GetRoleList(role.LastInWorldMapId);

            if (lst != null && lst.Count > 0)
            {
                for (int i = 0; i < lst.Count; i++)
                {
                    if (lst[i].RoleId == role.RoleId)
                    {
                        continue;
                    }

                    WorldMap_OtherRoleMoveProto myProto = new WorldMap_OtherRoleMoveProto();

                    myProto.RoleId     = role.RoleId;
                    myProto.TargetPosX = proto.TargetPosX;
                    myProto.TargetPosY = proto.TargetPosY;
                    myProto.TargetPosZ = proto.TargetPosZ;
                    myProto.ServerTime = proto.ServerTime;
                    myProto.NeedTime   = proto.NeedTime;



                    lst[i].Client_Socket.SendMsg(myProto.ToArray(lst[i].SocketSendMS));
                }
            }
        }
Пример #3
0
    public static WorldMap_OtherRoleMoveProto GetProto(byte[] buffer)
    {
        WorldMap_OtherRoleMoveProto proto = new WorldMap_OtherRoleMoveProto();

        using (MMO_MemoryStream ms = new MMO_MemoryStream(buffer))
        {
            proto.RoleId     = ms.ReadInt();
            proto.TargetPosX = ms.ReadFloat();
            proto.TargetPosY = ms.ReadFloat();
            proto.TargetPosZ = ms.ReadFloat();
            proto.ServerTime = ms.ReadLong();
            proto.NeedTime   = ms.ReadInt();
        }
        return(proto);
    }
Пример #4
0
    public static WorldMap_OtherRoleMoveProto GetProto(MMO_MemoryStream ms, byte[] buffer)
    {
        WorldMap_OtherRoleMoveProto proto = new WorldMap_OtherRoleMoveProto();

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

        proto.RoleId     = ms.ReadInt();
        proto.TargetPosX = ms.ReadFloat();
        proto.TargetPosY = ms.ReadFloat();
        proto.TargetPosZ = ms.ReadFloat();
        proto.ServerTime = ms.ReadLong();
        proto.NeedTime   = ms.ReadInt();

        return(proto);
    }