public void RequestLogin(SFNETPacket packetData, ConnectUser user) { try { var request = JsonEnDecode.Decode <JsonPacketRequestLogin>(packetData.GetData()); // 이미 등록된 유저인가? serial, ID var result = UserManagerRef.AddUser(packetData.SessionID(), request.ID); var response = new JsonPacketResponseLogin() { Result = result }; ServerNetworkRef.Send <JsonPacketResponseLogin>(packetData.SessionID(), PACKET_ID.RESPONSE_LOGIN, response); DevLog.Write(string.Format("[Login] result:{0}, UserID:{1}, SessionID{2}", result.ToString(), request.ID, packetData.SessionID()), LOG_LEVEL.INFO); } catch (Exception) { var response = new JsonPacketResponseLogin() { Result = ERROR_CODE.ERROR }; ServerNetworkRef.Send <JsonPacketResponseLogin>(packetData.SessionID(), PACKET_ID.RESPONSE_LOGIN, response); } }
void ResponseErrorLobbyChat(int sessionID, ERROR_CODE result) { var response = new JsonPacketNoticeChat() { Result = ERROR_CODE.ERROR }; ServerNetworkRef.Send <JsonPacketNoticeChat>(sessionID, PACKET_ID.NOTICE_CHAT, response); }
void ResponseEnterLobby(int sessionID, ERROR_CODE result, short lobbyID) { if (result == ERROR_CODE.NONE) { DevLog.Write(string.Format("[EnterLobby] lobbyID:{0}, sessionID:{1}", lobbyID, sessionID), LOG_LEVEL.INFO); } else { DevLog.Write(string.Format("[EnterLobby 실패] lobbyID:{0}, sessionID:{1}, result:{2}", lobbyID, sessionID, result.ToString()), LOG_LEVEL.ERROR); } var response = new JsonPacketResponseEnterLobby() { Result = result, LobbyID = lobbyID }; ServerNetworkRef.Send <JsonPacketResponseEnterLobby>(sessionID, PACKET_ID.RESPONSE_ENTER_LOBBY, response); }
public void InnerNotifyLeaveLobby(SFNETPacket packet) { var notify = JsonEnDecode.Decode <CSCommonLib.JsonPacketInnerNotifyLeaveLobby>(packet.GetData()); var user = UserManagerRef.GetUser(notify.UserID); if (user == null) { return; } user.SetLobby(0); var response = new JsonPacketResponseLeaveLobby() { Result = notify.Result }; ServerNetworkRef.Send <JsonPacketResponseLeaveLobby>(user.SessionID, PACKET_ID.RESPONSE_LEAVE_LOBBY, response); }
public void RequestRegistServer(SFNETPacket packetData) { try { var request = JsonEnDecode.Decode <JsonPacketRequestReqistServer>(packetData.GetData()); // 이미 등록된 유저인가? serial, ID var result = ServerManagerRef.AddServer(packetData.SessionID(), request.ServerName); var response = new JsonPacketResponseReqistServer() { Result = result, ServerName = "GameServer" }; ServerNetworkRef.Send <JsonPacketResponseReqistServer>(packetData.SessionID(), PACKET_ID.RESPONSE_REGIST_SERVER, response); DevLog.Write(string.Format("result:{0}, ServerName:{1}, SessionID: {2}", result.ToString(), request.ServerName, packetData.SessionID()), LOG_LEVEL.INFO); CGSFNETCommon.FileLogger.Info(string.Format("result:{0}, ServerName:{1}, SessionID: {2}", result.ToString(), request.ServerName, packetData.SessionID())); } catch { } }
public void InnerNotifyEnterLobby(SFNETPacket packet) { var notify = JsonEnDecode.Decode <CSCommonLib.JsonPacketInnerNotifyEnterLobby>(packet.GetData()); var user = UserManagerRef.GetUser(notify.UserID); if (user == null) { var jsonData = new JsonPacketInnerRollBackEnterLobby() { LobbyID = notify.LobbyID, UserID = notify.UserID }; var bodyData = CGSFNETCommon.JsonEnDecode.Encode <JsonPacketInnerRollBackEnterLobby>(jsonData); var InnerPacket = new CgsfNET64Lib.SFNETPacket(); InnerPacket.SetData(-1, (ushort)PACKET_ID.INNER_ROLL_BACK_ENTER_LOBBY, bodyData); RelayPacketPacketProcess.RelayPacket(notify.LobbyID, InnerPacket); return; } if (notify.Result == ERROR_CODE.NONE) { user.SetLobby(notify.LobbyID); } else { user.SetLobby(0); } var response = new JsonPacketResponseEnterLobby() { Result = notify.Result, LobbyID = notify.LobbyID }; ServerNetworkRef.Send <JsonPacketResponseEnterLobby>(user.SessionID, PACKET_ID.RESPONSE_ENTER_LOBBY, response); }
public void DBResponseLogin(SFNETPacket packet) { var user = UserManagerRef.GetUser(packet.SessionID()); if (user == null) { return; } try { var serializer = MessagePackSerializer.Get <DB.ResponseLogin>(); var request = serializer.UnpackSingleObject(packet.GetData()); if (request.Result == ERROR_CODE.NONE) { UserManagerRef.저_인증_완료(user); DevLog.Write(string.Format("DB 인증 성공. ID:{0}", request.UserID), LOG_LEVEL.DEBUG); } else { user.BasicState(); DevLog.Write(string.Format("DB 인증 실패. ID:{0}, Result:{1}", request.UserID, request.Result.ToString()), LOG_LEVEL.DEBUG); } var jsonData = new JsonPacketResponseLogin() { Result = request.Result }; ServerNetworkRef.Send <JsonPacketResponseLogin>(packet.SessionID(), PACKET_ID.RESPONSE_LOGIN, jsonData); } catch (Exception ex) { DevLog.Write(ex.ToString(), LOG_LEVEL.DEBUG); } }