Example #1
0
        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);
        }
Example #2
0
        public void RequestEnterLobby(SFNETPacket packet)
        {
            var user = UserManagerRef.GetUser(packet.SessionID());

            if (user == null)
            {
                return;
            }

            try
            {
                var request = JsonEnDecode.Decode <CSCommonLib.JsonPacketRequestEnterLobby>(packet.GetData());

                if (user.CurrentState != CONNECT_USER_STATE.ATUH_COMPLETE || user.UserID != request.UserID)
                {
                    return;
                }

                user.TryEnterLobby();

                RelayPacketPacketProcess.RelayPacket(request.LobbyID, packet);
            }
            catch (Exception ex)
            {
                DevLog.Write(ex.ToString(), LOG_LEVEL.DEBUG);
            }
        }
Example #3
0
        void ResponseLeaveLobby(ERROR_CODE result, short lobbyID, string userID)
        {
            if (result == ERROR_CODE.NONE)
            {
                DevLog.Write(string.Format("[LeaveLobby] lobbyID:{0}, UserID:{1}", lobbyID, userID), LOG_LEVEL.INFO);
            }
            else
            {
                DevLog.Write(string.Format("[LeaveLobby 실패] lobbyID:{0}, UserID:{1}, result:{2}", lobbyID, userID, result.ToString()), LOG_LEVEL.ERROR);
            }

            var jsonData = new JsonPacketInnerNotifyLeaveLobby()
            {
                Result = result, LobbyID = lobbyID, UserID = userID
            };
            var bodyData = CGSFNETCommon.JsonEnDecode.Encode <JsonPacketInnerNotifyLeaveLobby>(jsonData);

            var InnerPacket = new CgsfNET64Lib.SFNETPacket();

            InnerPacket.SetData(-1, (ushort)PACKET_ID.INNER_NOTIFY_LEAVE_LOBBY, bodyData);
            RelayPacketPacketProcess.RelayPacket(0, InnerPacket);
        }
Example #4
0
        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);
        }