Пример #1
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);
        }
Пример #2
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);
        }
Пример #3
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);
        }
Пример #4
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);
        }