public void SystemClientDisConnected(SFNETPacket packet) { var user = UserManagerRef.GetUser(packet.SessionID()); if (user == null) { return; } if (user.LobbyID > 0) { var jsonData = new JsonPacketRequestLeaveLobby() { LobbyID = user.LobbyID, UserID = user.UserID }; var bodyData = JsonEnDecode.Encode <JsonPacketRequestLeaveLobby>(jsonData); var InnerPacket = new CgsfNET64Lib.SFNETPacket(); InnerPacket.SetData(-1, (ushort)PACKET_ID.REQUEST_LEAVE_LOBBY, bodyData); RelayPacketPacketProcess.RelayPacket(user.LobbyID, InnerPacket); } var result = UserManagerRef.RemoveUser(packet.SessionID()); InnerMessageQueue.CurrentUserCount(UserManagerRef.GetConnectCount()); DevLog.Write(string.Format("Client DisConnected. SessionID: {0}", packet.SessionID()), LOG_LEVEL.INFO); }
public void SystemClientConnect(SFNETPacket packet) { var result = UserManagerRef.AddUser(packet.SessionID()); InnerMessageQueue.CurrentUserCount(UserManagerRef.GetConnectCount()); if (result == CSCommonLib.ERROR_CODE.NONE) { DevLog.Write(string.Format("Client Connect. SessionID: {0}", packet.SessionID()), LOG_LEVEL.INFO); } else { DevLog.Write(string.Format("Client Connect. SessionID: {0}, Error:{1}", packet.SessionID(), result.ToString()), LOG_LEVEL.ERROR); } }
public void InnerRoolBackEnterLobby(SFNETPacket packet) { try { var request = JsonEnDecode.Decode <JsonPacketInnerRollBackEnterLobby>(packet.GetData()); // 로비에 추가 var error = LobbyManagerRef.LeaveLobby(request.LobbyID, request.UserID); if (error == ERROR_CODE.NONE) { InnerMessageQueue.CurrentLobbyUserCount(request.LobbyID, LobbyManagerRef.LobbyCurrentUserCount(request.LobbyID)); } } catch { } }
public void RequestEnterLobby(SFNETPacket packet) { try { var request = JsonEnDecode.Decode <JsonPacketRequestEnterLobby>(packet.GetData()); // 로비에 추가 var error = LobbyManagerRef.EnterLobby(request.LobbyID, packet.SessionID(), request.UserID); if (error == ERROR_CODE.NONE) { InnerMessageQueue.CurrentLobbyUserCount(request.LobbyID, LobbyManagerRef.LobbyCurrentUserCount(request.LobbyID)); } ResponseEnterLobby(error, request.LobbyID, request.UserID); } catch { } }
void ProcessInnerMessage() { while (true) { InnerMsg msg; if (InnerMessageQueue.GetMsg(out msg)) { switch (msg.Type) { case InnerMsgType.CURRENT_CONNECT_COUNT: { textBoxCurrentUserCount.Text = msg.Value1; } break; case InnerMsgType.CURRENT_LOBBY_USER_COUNT: { var tokens = msg.Value1.Split("_"); int iItemNum = listViewLobbyInfo.Items.Count; for (int i = 0; i < iItemNum; ++i) { if (tokens[0] == listViewLobbyInfo.Items[i].SubItems[0].Text) { listViewLobbyInfo.Items[i].SubItems[1].Text = tokens[1]; listViewLobbyInfo.Refresh(); return; } } } break; } } else { break; } } }
public void RequestLeaveLobby(SFNETPacket packetData) { try { var request = JsonEnDecode.Decode <JsonPacketRequestLeaveLobby>(packetData.GetData()); var result = LobbyManagerRef.LeaveLobby(request.LobbyID, request.UserID); if (packetData.SessionID() >= 0) { ResponseLeaveLobby(result, request.LobbyID, request.UserID); } if (result == ERROR_CODE.NONE) { InnerMessageQueue.CurrentLobbyUserCount(request.LobbyID, LobbyManagerRef.LobbyCurrentUserCount(request.LobbyID)); } } catch { } }