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

        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.AccountId = ms.ReadInt();

        if (isChild)
        {
            GameEntry.Pool.EnqueueClassObject(ms);
        }
        return(proto);
    }
Exemplo n.º 2
0
    public static RoleOperation_LogOnGameServerProto GetProto(byte[] buffer)
    {
        RoleOperation_LogOnGameServerProto proto = new RoleOperation_LogOnGameServerProto();

        using (MMO_MemoryStream ms = new MMO_MemoryStream(buffer))
        {
            proto.AccountId = ms.ReadInt();
        }
        return(proto);
    }
    /// <summary>
    /// 登录服务器
    /// </summary>
    private void LogOnGameServer()
    {
        RoleOperation_LogOnGameServerProto proto = new RoleOperation_LogOnGameServerProto();

        {
            proto.AccountId = GlobalInit.Instance.m_currentAccountEntity.Id;
        }

        NetWorkSocket.Instance.SendMsg(proto.ToArray());
    }
    public static RoleOperation_LogOnGameServerProto GetProto(MMO_MemoryStream ms, byte[] buffer)
    {
        RoleOperation_LogOnGameServerProto proto = new RoleOperation_LogOnGameServerProto();

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

        proto.AccountId = ms.ReadInt();

        return(proto);
    }
Exemplo n.º 5
0
        public override void OnEnter()
        {
            base.OnEnter();

            GameEntry.Event.CommonEvent.AddEventListener(LogOnGameServerReturnGameEvent.EventId, OnLogOnGameServerReturn);
            GameEntry.Event.CommonEvent.AddEventListener(ReturnSelectRoleGameEvent.EventId, OnReturnSelectRole);
            GameEntry.Event.CommonEvent.AddEventListener(InputMoveGameEvent.EventId, OnSceneMove);

            RoleOperation_LogOnGameServerProto proto = new RoleOperation_LogOnGameServerProto();

            proto.AccountId = GameEntry.Data.UserData.AccountId;
            GameEntry.Socket.SendProtoMessage(proto);
        }