public Boolean OnCmdConnectNotify(Command_ID wCommandID, UInt64 u64ConnID, ReadBufferHelper ReadHelper) { StConnectNotify ConnectNotify = new StConnectNotify(); ConnectNotify.Read(ReadHelper); Byte ConType = ConnectNotify.btConType; if (ConType == (Byte)ConnectionType.TYPE_SVR_PROXY) { ConnectNotify.btConType = (Byte)ConnectionType.TYPE_CLT_PLAYER; ConnectNotify.u64ConnID = m_u64ClientID; m_WriteHelper.BeginWrite((UInt16)Command_ID.CMD_CONNECT_NOTIFY, (Byte)CmdHandler_ID.CMDH_SVR_CON); ConnectNotify.Write(m_WriteHelper); m_WriteHelper.EndWrite(); SendData(m_WriteHelper.GetData(), (int)m_WriteHelper.GetDataLen()); StCharEnterGameReq CharEnterGameReq = new StCharEnterGameReq(); CharEnterGameReq.u64CharID = m_u64ClientID; CharEnterGameReq.dwIdentifyCode = m_dwIdentifyCode; m_WriteHelper.BeginWrite((UInt16)Command_ID.CMD_CHAR_ENTER_GAME_REQ, (Byte)CmdHandler_ID.CMDH_SENCE); CharEnterGameReq.Write(m_WriteHelper); m_WriteHelper.EndWrite(); SendData(m_WriteHelper.GetData(), (int)m_WriteHelper.GetDataLen()); } else if (ConType == (Byte)ConnectionType.TYPE_SVR_LOGIN) { SetConnectState(ConnectState.Succ_Connect); } return(true); }
public Boolean Login(string strAccountName, string strPassword, bool bConnect) { if (bConnect) { DisConnect(); if (!ConnectToServer(m_strLoginIp, m_sLoginPort)) { return(false); } StConnectNotify ConnectNotify = new StConnectNotify(); ConnectNotify.btConType = (Byte)ConnectionType.TYPE_CLT_PLAYER; ConnectNotify.u64ConnID = 0; m_WriteHelper.BeginWrite((UInt16)Command_ID.CMD_CONNECT_NOTIFY, (Byte)CmdHandler_ID.CMDH_SVR_CON); ConnectNotify.Write(m_WriteHelper); m_WriteHelper.EndWrite(); SendData(m_WriteHelper.GetData(), (int)m_WriteHelper.GetDataLen()); } m_WriteHelper.BeginWrite((UInt16)Command_ID.CMD_CHAR_LOGIN_REQ, 0); m_WriteHelper.WriteFixString(strAccountName, 32); m_WriteHelper.WriteFixString(strPassword, 32); m_WriteHelper.EndWrite(); SendData(m_WriteHelper.GetData(), (int)m_WriteHelper.GetDataLen()); return(true); }
public Boolean OnCmdConnectNotify(Command_ID wCommandID, UInt64 u64ConnID, ReadBufferHelper ReadHelper) { StConnectNotify ConnectNotify = new StConnectNotify(); ConnectNotify.Read(ReadHelper); Byte ConType = ConnectNotify.btConType; ConnectNotify.btConType = (Byte)ConnectionType.TYPE_CLT_PLAYER; ConnectNotify.u64ConnID = m_u64ClientID; m_WriteHelper.BeginWrite((UInt16)Command_ID.CMD_CONNECT_NOTIFY, (Byte)CmdHandler_ID.CMDH_SVR_CON); ConnectNotify.Write(m_WriteHelper); m_WriteHelper.EndWrite(); SendData(m_WriteHelper.GetData(), (int)m_WriteHelper.GetDataLen()); if (ConType == (Byte)ConnectionType.TYPE_SVR_PROXY) { StCharEnterGameReq CharEnterGameReq = new StCharEnterGameReq(); CharEnterGameReq.u64CharID = m_u64ClientID; CharEnterGameReq.dwIdentifyCode = m_dwIdentifyCode; m_WriteHelper.BeginWrite((UInt16)Command_ID.CMD_CHAR_ENTER_GAME_REQ, (Byte)CmdHandler_ID.CMDH_SENCE); CharEnterGameReq.Write(m_WriteHelper); m_WriteHelper.EndWrite(); SendData(m_WriteHelper.GetData(), (int)m_WriteHelper.GetDataLen()); } else if (ConType == (Byte)ConnectionType.TYPE_SVR_LOGIN) { SetConnectState(ConnectState.Succ_Connect); } return true; }
public Boolean Login(string strAccountName, string strPassword, bool bConnect) { if (bConnect) { DisConnect(); if(!ConnectToServer(m_strLoginIp, m_sLoginPort)) { return false; } StConnectNotify ConnectNotify = new StConnectNotify(); ConnectNotify.btConType = (Byte)ConnectionType.TYPE_CLT_PLAYER; ConnectNotify.u64ConnID = 0; m_WriteHelper.BeginWrite((UInt16)Command_ID.CMD_CONNECT_NOTIFY, (Byte)CmdHandler_ID.CMDH_SVR_CON); ConnectNotify.Write(m_WriteHelper); m_WriteHelper.EndWrite(); SendData(m_WriteHelper.GetData(), (int)m_WriteHelper.GetDataLen()); } m_WriteHelper.BeginWrite((UInt16)Command_ID.CMD_CHAR_LOGIN_REQ, 0); m_WriteHelper.WriteFixString(strAccountName, 32); m_WriteHelper.WriteFixString(strPassword, 32); m_WriteHelper.EndWrite(); SendData(m_WriteHelper.GetData(), (int)m_WriteHelper.GetDataLen()); return true; }