public void OnCreateAndJoinRoomAnswer(ProtobufPacket <CreateAndJoinRoomAnswerPacket> packet)
        {
            CreateAndJoinRoomAnswerPacket answer = packet.ProtobufMessage;

            OnCreateRoom?.Invoke(this, answer.Success);
            OnJoinRoom?.Invoke(this, new Tuple <string, bool>(answer.RoomName, answer.Success));
        }
Exemple #2
0
        private void OnJoinRoomRequest(ProtobufPacket <JoinRoomRequestPacket> packet)
        {
            JoinRoomRequestPacket request = packet.ProtobufMessage;
            JoinRoomAnswerPacket  send    = new JoinRoomAnswerPacket();

            bool result = NetworkLobby.JoinRoom(request.RoomName, request.UserName, out MNetworkRoom room);

            // Packet Data Set
            send.Success  = result;
            send.RoomName = request.RoomName;

            Debug.Log($"S:[{packet.Serial}] Request to join the room. Name: [{request.UserName}] Room: [{request.RoomName}] Result: [{send.Success}]");

            if (result == true)
            {
                ChattingAnswerPacket joinMessage = new ChattingAnswerPacket();

                joinMessage.Text = $"{request.UserName} 님이 방에 참가했습니다.";

                SendPacket(new ProtobufPacket <ChattingAnswerPacket>(packet.Serial, PacketEnum.ProcessType.Data,
                                                                     (int)MessageType.ChattingAnswer, joinMessage), room.SerialList);
            }

            SendPacket(new ProtobufPacket <JoinRoomAnswerPacket>(packet.Serial, PacketEnum.ProcessType.Data,
                                                                 (int)MessageType.JoinRoomAnswer, send));
        }
Exemple #3
0
        private void OnCreateAndJoinRoomRequest(ProtobufPacket <CreateAndJoinRoomRequestPacket> packet)
        {
            CreateAndJoinRoomRequestPacket request = packet.ProtobufMessage;
            CreateAndJoinRoomAnswerPacket  send    = new CreateAndJoinRoomAnswerPacket();

            // Packet Data Set

            bool success1 = NetworkLobby.AddRoom(request.RoomName, new MNetworkRoom(request.RoomName));
            bool success2 = NetworkLobby.JoinRoom(request.RoomName, request.UserName, out MNetworkRoom room);

            Debug.Log($"S:[{packet.Serial}] Room creation request. Room: [{request.RoomName}] Result: [{send.Success}]");
            Debug.Log($"S:[{packet.Serial}] Request to join the room. Name: [{request.UserName}] Room: [{request.RoomName}] Result: [{send.Success}]");

            if (success1 && success2 == true)
            {
                ChattingAnswerPacket joinMessage = new ChattingAnswerPacket();

                joinMessage.Text = $"{request.UserName} 님이 방에 참가했습니다.";

                SendPacket(new ProtobufPacket <ChattingAnswerPacket>(packet.Serial, PacketEnum.ProcessType.Data,
                                                                     (int)MessageType.ChattingAnswer, joinMessage), room.SerialList);
            }

            send.Success  = success1 && success2;
            send.RoomName = request.RoomName;

            SendPacket(new ProtobufPacket <CreateAndJoinRoomAnswerPacket>(packet.Serial, PacketEnum.ProcessType.Data,
                                                                          (int)MessageType.CreateAndJoinRoomAnswer, send));
        }
Exemple #4
0
        private void OnChattingRequest(ProtobufPacket <ChattingRequestPacket> packet)
        {
            ChattingRequestPacket request = packet.ProtobufMessage;
            ChattingAnswerPacket  send    = new ChattingAnswerPacket();

            // Packet Data Set

            MNetworkPlayer sender = NetworkLobby.FindPlayer(request.Sender);

            if (sender == null)
            {
                return;
            }

            MNetworkRoom room = NetworkLobby.FindRoom(sender.RoomKey);

            if (room == null)
            {
                return;
            }

            send.Text = $"[{Time.TimeLogHMS}] [{request.Sender}] : {request.Text}";

            Debug.Log($"S:[{packet.Serial}] Chat: <[{sender.RoomKey}]{send.Text}>");

            SendPacket(new ProtobufPacket <ChattingAnswerPacket>(packet.Serial, PacketEnum.ProcessType.Data,
                                                                 (int)MessageType.ChattingAnswer, send), room.SerialList);
        }
        public void OnChattingAnswer(ProtobufPacket <ChattingAnswerPacket> packet)
        {
            ChattingAnswerPacket answer = packet.ProtobufMessage;

            Debug.Log(answer.Text);

            OnChatting?.Invoke(this, answer.Text);
        }
        public void HandlePacket(ProtobufPacket packet)
        {
            var pluginMessage = packet as PluginMessagePacket;

            if (pluginMessage != null)
            {
                OnPluginChannelMessage(pluginMessage.Channel, pluginMessage.Data);
            }
        }
        public void OnSignUpAnswer(ProtobufPacket <SignUpAnswerPacket> packet)
        {
            SignUpAnswerPacket answer = packet.ProtobufMessage;

            Debug.Log(answer.Success ? "회원가입 성공" : "회원가입 실패");
            Debug.Log(answer.Context);

            OnSignUp?.Invoke(this, new Tuple <string, bool>(answer.Context, answer.Success));
        }
        public void OnWhisperAnswer(ProtobufPacket <WhisperAnswerPacket> packet)
        {
            WhisperAnswerPacket answer = packet.ProtobufMessage;

            string ret = $"{answer.Sender} >> {answer.Text}";

            Debug.Log(ret);

            OnWhisper?.Invoke(this, ret);
        }
        public void OnJoinRoomAnswer(ProtobufPacket <JoinRoomAnswerPacket> packet)
        {
            JoinRoomAnswerPacket answer = packet.ProtobufMessage;

            string s = answer.Success ? "성공했습니다." : "실패했습니다.";

            Debug.Log($"{answer.RoomName} 방 입장에 {s}");

            OnJoinRoom?.Invoke(this, new Tuple <string, bool>(answer.RoomName, answer.Success));
        }
        public void OnRoomListAnswer(ProtobufPacket <RoomListAnswerPacket> packet)
        {
            RoomListAnswerPacket answer = packet.ProtobufMessage;

            List <string> names = new List <string>();

            foreach (var s in answer.RoomNames)
            {
                names.Add(s);
            }

            OnRoomListRefresh?.Invoke(this, names);
        }
        public void SendPacket(ProtobufPacket packet)
        {
            if (!Connected)
            {
                throw new ProtocolException("Connection error: Not connected to server.");
            }

            Stream.SendPacket(packet);

#if DEBUG
            PacketsSended.Add(packet);
#endif
        }
Exemple #12
0
        private void OnCreateRoomRequest(ProtobufPacket <CreateRoomRequestPacket> packet)
        {
            CreateRoomRequestPacket request = packet.ProtobufMessage;
            CreateRoomAnswerPacket  send    = new CreateRoomAnswerPacket();

            // Packet Data Set
            bool success = NetworkLobby.AddRoom(request.RoomName, new MNetwork.Rooms.MNetworkRoom(request.RoomName));

            send.Success = success;

            Debug.Log($"S:[{packet.Serial}] Room creation request. Room: [{request.RoomName}] Result: [{send.Success}]");

            SendPacket(new ProtobufPacket <CreateRoomAnswerPacket>(packet.Serial, PacketEnum.ProcessType.Data,
                                                                   (int)MessageType.CreateRoomAnswer, send));
        }
        public void SendPacket(ProtobufPacket packet, int originID = 0)
        {
            var sconPacket = packet as SCONPacket;

            if (sconPacket == null)
            {
                throw new Exception($"Wrong packet type, {packet.GetType().FullName}");
            }

            Stream.SendPacket(ref packet);

#if DEBUG
            Sended.Add(sconPacket);
#endif
        }
        public void OnCreateRoomAnswer(ProtobufPacket <CreateRoomAnswerPacket> packet)
        {
            CreateRoomAnswerPacket answer = packet.ProtobufMessage;

            if (answer.Success == true)
            {
                Debug.Log("방 생성 성공");
            }
            else
            {
                Debug.Log("방 생성 실패");
            }

            OnCreateRoom?.Invoke(this, answer.Success);
        }
Exemple #15
0
        private void OnRoomListRequest(ProtobufPacket <RoomListRequestPacket> packet)
        {
            RoomListRequestPacket request = packet.ProtobufMessage;
            RoomListAnswerPacket  send    = new RoomListAnswerPacket();

            // Packet Data Set

            foreach (var iter in NetworkLobby.GetAllRoomNames())
            {
                send.RoomNames.Add(iter);
            }

            Debug.Log($"S:[{packet.Serial}] Room list return request.");

            SendPacket(new ProtobufPacket <RoomListAnswerPacket>(packet.Serial, PacketEnum.ProcessType.Data,
                                                                 (int)MessageType.RoomListAnswer, send));
        }
Exemple #16
0
        private void OnSignUpRequest(ProtobufPacket <SignUpRequestPacket> packet)
        {
            SignUpRequestPacket request = packet.ProtobufMessage;
            SignUpAnswerPacket  send    = new SignUpAnswerPacket();

            // Packet Data Set

            bool success = loginHandler.SignUp(request.ID, request.Password, request.UserName, out string context);

            send.Success = success;
            send.Context = context;

            Debug.Log($"S:[{packet.Serial}] User registration (Sign Up). Result: [{success}]]");

            SendPacket(new ProtobufPacket <SignUpAnswerPacket>(packet.Serial, PacketEnum.ProcessType.Data,
                                                               (int)MessageType.SignUpAnswer, send));
        }
        public void OnLoginAnswer(ProtobufPacket <LoginAnswerPacket> packet)
        {
            LoginAnswerPacket answer = packet.ProtobufMessage;

            if (answer.Success == true)
            {
                Debug.Log($"{answer.UserName} 님이 접속하셨습니다.");

                UserInfoManager.userName  = answer.UserName;
                UserInfoManager.userState = MNetwork.Rooms.MNetworkPlayer.MPlayerState.LoginSuccess;
            }
            else
            {
                Debug.Log($"로그인 실패. [사유 : {answer.Context}]");
            }

            OnSignIn?.Invoke(this, new Tuple <string, bool>(answer.Context, answer.Success));
        }
        private void OnPacketHandled(int id, ProtobufPacket packet, ClientState state)
        {
            if (!Connected)
            {
                return;
            }

            ContextFunc <ProtobufPacket> handler = null;

            switch (state)
            {
            case ClientState.Joining:
                handler = ServerPacketHandlers.LoginPacketResponses.Handlers[id]?.Invoke(this);
                break;

            case ClientState.Joined:
                handler = ServerPacketHandlers.PlayPacketResponses.Handlers[id]?.Invoke(this);
                break;

            case ClientState.InfoRequest:
                handler = ServerPacketHandlers.StatusPacketResponses.Handlers[id]?.Invoke(this);
                break;
            }

            if (handler != null)
            {
                handler.SetContext(this);
                var response = handler.Handle(packet);
                if (response != null)
                {
                    SendPacket(response);
                }
            }

            DoCustomReceiving(packet);

            foreach (var modAPI in ModAPIs)
            {
                modAPI.OnPacket(packet);
            }
        }
        public void Protobuf_Serialize_Deserialize_Test()
        {
            using (ProtobufSerializer serializer = new ProtobufSerializer())
            {
                Person person = new Person()
                {
                    Id = 2, Name = "Jerry", Address = new Address()
                };

                byte[] buffer = serializer.Serialize(person);

                Person _person = serializer.Deserialize <Person>(buffer);

                Assert.Equal(person.Id, _person.Id);
                Assert.Equal(person.Name, _person.Name);

                ProtobufMessagePack <Person> pack = new ProtobufMessagePack <Person>(person);

                buffer  = serializer.Serialize(pack);
                _person = serializer.Deserialize <ProtobufMessagePack <Person> >(buffer)?.Message;

                Assert.Equal(person.Id, _person.Id);
                Assert.Equal(person.Name, _person.Name);

                Packet packet = new Packet(typeof(Person).FullName, buffer, PacketType.Join, Guid.NewGuid().ToString());

                buffer = serializer.Serialize(new ProtobufPacket(packet));
                ProtobufPacket _packet = serializer.Deserialize <ProtobufPacket>(buffer);

                Assert.Equal(packet.PackType, _packet.PackType);
                Assert.Equal(packet.PacketType, _packet.PacketType);
                Assert.Equal(packet.FromId, _packet.FromId);

                _person = serializer.Deserialize <ProtobufMessagePack <Person> >(_packet.Payload)?.Message;

                Assert.Equal(person.Id, _person.Id);
                Assert.Equal(person.Name, _person.Name);
            }
        }
Exemple #20
0
        private void OnWhisperRequest(ProtobufPacket <WhisperRequestPacket> packet)
        {
            WhisperRequestPacket request = packet.ProtobufMessage;
            WhisperAnswerPacket  send    = new WhisperAnswerPacket();

            // Packet Data Set

            MNetworkPlayer listener = NetworkLobby.FindPlayer(request.Listener);

            if (listener == null)
            {
                return;
            }

            send.Sender = request.Sender;
            send.Text   = $"From {request.Sender} : {request.Text}";

            Debug.Log($"S:[{packet.Serial}] Whisper Send Request. SENDER: [{request.Sender}] LISTENER: [{listener.UserName}]");

            SendPacket(new ProtobufPacket <WhisperAnswerPacket>(listener.Serial, PacketEnum.ProcessType.Data,
                                                                (int)MessageType.WhisperAnswer, send));
        }
Exemple #21
0
        private void OnExitRoomRequest(ProtobufPacket <ExitRoomRequestPacket> packet)
        {
            ExitRoomRequestPacket request = packet.ProtobufMessage;
            ExitRoomAnswerPacket  send    = new ExitRoomAnswerPacket();

            // Packet Data Set

            MNetworkRoom   targetRoom   = NetworkLobby.FindRoom(request.RoomName);
            MNetworkPlayer targetPlayer = NetworkLobby.FindPlayer(request.UserName);

            bool result = NetworkLobby.ExitFromRoom(targetRoom, targetPlayer);

            send.Success = result;

            Debug.Log($"S:[{packet.Serial}] Room exit request. Name: [{request.UserName}] Room: [{request.RoomName}] Result: [{send.Success}]");

            if (targetRoom.PlayerCount == 0)
            {
                if (NetworkLobby.DeleteRoom(request.RoomName) == true)
                {
                    Debug.Log($"Room deleted. Room: [{request.RoomName}]");
                }
            }
            else
            {
                ChattingAnswerPacket exitMessage = new ChattingAnswerPacket();

                exitMessage.Text = $"{targetPlayer.UserName} 님이 방에서 나갔습니다.";

                SendPacket(new ProtobufPacket <ChattingAnswerPacket>(packet.Serial, PacketEnum.ProcessType.Data,
                                                                     (int)MessageType.ChattingAnswer, exitMessage), targetRoom.SerialList);
            }

            SendPacket(new ProtobufPacket <ExitRoomAnswerPacket>(packet.Serial, PacketEnum.ProcessType.Data,
                                                                 (int)MessageType.ExitRoomAnswer, send));
        }
Exemple #22
0
 public void HandlePacket(ProtobufPacket packet)
 {
 }
Exemple #23
0
 public abstract void OnPacket(ProtobufPacket protobufPacket);
        public void SendPacket(ProtobufPacket packet, int originID = 0)
        {
            var sconPacket = packet as SCONPacket;
            if (sconPacket == null)
                throw new Exception($"Wrong packet type, {packet.GetType().FullName}");

            Stream.SendPacket(ref packet);

#if DEBUG
            Sended.Add(sconPacket);
#endif
        }
        private void HandlePacket(ProtobufPacket packet)
        {
            switch ((SCONPacketTypes)(int)packet.ID)
            {
                case SCONPacketTypes.AuthorizationRequest:
                    HandleAuthorizationRequest((AuthorizationRequestPacket)packet);
                    break;


                //case SCONPacketTypes.EncryptionResponse:
                //    HandleEncryptionResponse((EncryptionResponsePacket)packet);
                //    break;


                case SCONPacketTypes.AuthorizationPassword:
                    HandleAuthorizationPassword((AuthorizationPasswordPacket)packet);
                    break;


                case SCONPacketTypes.ExecuteCommand:
                    HandleExecuteCommand((ExecuteCommandPacket)packet);
                    break;


                case SCONPacketTypes.StartChatReceiving:
                    HandleStartChatReceiving((StartChatReceivingPacket)packet);
                    break;

                case SCONPacketTypes.StopChatReceiving:
                    HandleStopChatReceiving((StopChatReceivingPacket)packet);
                    break;


                case SCONPacketTypes.PlayerInfoListRequest:
                    HandlePlayerInfoListRequest((PlayerInfoListRequestPacket)packet);
                    break;


                case SCONPacketTypes.LogListRequest:
                    HandleLogListRequest((LogListRequestPacket)packet);
                    break;

                case SCONPacketTypes.LogFileRequest:
                    HandleLogFileRequest((LogFileRequestPacket)packet);
                    break;


                case SCONPacketTypes.CrashLogListRequest:
                    HandleCrashLogListRequest((CrashLogListRequestPacket)packet);
                    break;

                case SCONPacketTypes.CrashLogFileRequest:
                    HandleCrashLogFileRequest((CrashLogFileRequestPacket)packet);
                    break;


                case SCONPacketTypes.PlayerDatabaseListRequest:
                    HandlePlayerDatabaseListRequest((PlayerDatabaseListRequestPacket)packet);
                    break;


                case SCONPacketTypes.BanListRequest:
                    HandleBanListRequest((BanListRequestPacket)packet);
                    break;


                //case SCONPacketTypes.UploadLuaToServer:
                //    HandleUploadLuaToServer((UploadLuaToServerPacket)packet);
                //    break;

                //case SCONPacketTypes.ReloadNPCs:
                //    HandleReloadNPCs((ReloadNPCsPacket)packet);
                //    break;
            }
        }
        private void SendPacketDirect(ProtobufPacket packet)
        {
            if (Stream.Connected)
            {
                Stream.SendPacket(ref packet);

#if DEBUG
                ToServer.Add(packet);
#endif
            }
        }
        private void SendPacket(ProtobufPacket packet)
        {
            if (State.HasFlag(JoinState.QueryPacketsEmpty))
                goto SendPackets;

            if ((GamePacketTypes)(int) packet.ID == GamePacketTypes.ServerDataRequest)
            {
                SendPacketDirect(packet);
                return;
            }

            if (!State.HasFlag(JoinState.JoinGameSent))
            {
                SendPacketDirect(new JoiningGameRequestPacket());

                State |= JoinState.JoinGameSent;
            }

            if (!State.HasFlag(JoinState.JoinedGame))
            {
                ToSend.Enqueue(packet);
                return;
            }

            if (!State.HasFlag(JoinState.QueryPacketsEmpty))
            {
                while (ToSend.Count > 0)
                    SendPacketDirect(ToSend.Dequeue());

                State |= JoinState.QueryPacketsEmpty;
            }

        SendPackets:
            SendPacketDirect(packet);
        }
 public override void OnPacket(ProtobufPacket packet)
 {
     ForgeHandlerContext.HandlePacket(packet);
 }
        private void HandlePacket(ProtobufPacket packet)
        {
            switch ((SCONPacketTypes)(int)packet.ID)
            {
            case SCONPacketTypes.AuthorizationRequest:
                HandleAuthorizationRequest((AuthorizationRequestPacket)packet);
                break;


            //case SCONPacketTypes.EncryptionResponse:
            //    HandleEncryptionResponse((EncryptionResponsePacket)packet);
            //    break;


            case SCONPacketTypes.AuthorizationPassword:
                HandleAuthorizationPassword((AuthorizationPasswordPacket)packet);
                break;


            case SCONPacketTypes.ExecuteCommand:
                HandleExecuteCommand((ExecuteCommandPacket)packet);
                break;


            case SCONPacketTypes.StartChatReceiving:
                HandleStartChatReceiving((StartChatReceivingPacket)packet);
                break;

            case SCONPacketTypes.StopChatReceiving:
                HandleStopChatReceiving((StopChatReceivingPacket)packet);
                break;


            case SCONPacketTypes.PlayerInfoListRequest:
                HandlePlayerInfoListRequest((PlayerInfoListRequestPacket)packet);
                break;


            case SCONPacketTypes.LogListRequest:
                HandleLogListRequest((LogListRequestPacket)packet);
                break;

            case SCONPacketTypes.LogFileRequest:
                HandleLogFileRequest((LogFileRequestPacket)packet);
                break;


            case SCONPacketTypes.CrashLogListRequest:
                HandleCrashLogListRequest((CrashLogListRequestPacket)packet);
                break;

            case SCONPacketTypes.CrashLogFileRequest:
                HandleCrashLogFileRequest((CrashLogFileRequestPacket)packet);
                break;


            case SCONPacketTypes.PlayerDatabaseListRequest:
                HandlePlayerDatabaseListRequest((PlayerDatabaseListRequestPacket)packet);
                break;


            case SCONPacketTypes.BanListRequest:
                HandleBanListRequest((BanListRequestPacket)packet);
                break;


                //case SCONPacketTypes.UploadLuaToServer:
                //    HandleUploadLuaToServer((UploadLuaToServerPacket)packet);
                //    break;

                //case SCONPacketTypes.ReloadNPCs:
                //    HandleReloadNPCs((ReloadNPCsPacket)packet);
                //    break;
            }
        }
Exemple #30
0
        private void HandlePacket(ProtobufPacket packet)
        {
            switch ((SCONPacketTypes)(int) packet.ID)
            {
                case SCONPacketTypes.AuthorizationResponse:
                    HandleAuthorizationResponse((AuthorizationResponsePacket) packet);
                    break;


                case SCONPacketTypes.EncryptionRequest:
                    HandleEncryptionRequest((EncryptionRequestPacket) packet);
                    break;


                case SCONPacketTypes.AuthorizationComplete:
                    HandleAuthorizationComplete((AuthorizationCompletePacket) packet);
                    break;

                case SCONPacketTypes.AuthorizationDisconnect:
                    HandleAuthorizationDisconnect((AuthorizationDisconnectPacket) packet);
                    break;


                case SCONPacketTypes.ChatMessage:
                    HandleChatMessage((ChatMessagePacket) packet);
                    break;


                case SCONPacketTypes.PlayerInfoListResponse:
                    HandlePlayerInfoListResponse((PlayerInfoListResponsePacket) packet);
                    break;


                case SCONPacketTypes.LogListResponse:
                    HandleLogListResponse((LogListResponsePacket) packet);
                    break;

                case SCONPacketTypes.LogFileResponse:
                    HandleLogFileResponse((LogFileResponsePacket) packet);
                    break;


                case SCONPacketTypes.CrashLogListResponse:
                    HandleCrashLogListResponse((CrashLogListResponsePacket) packet);
                    break;

                case SCONPacketTypes.CrashLogFileResponse:
                    HandleCrashLogFileResponse((CrashLogFileResponsePacket) packet);
                    break;


                case SCONPacketTypes.PlayerDatabaseListResponse:
                    HandlePlayerDatabaseListResponse((PlayerDatabaseListResponsePacket) packet);
                    break;


                case SCONPacketTypes.BanListResponse:
                    HandleBanListResponse((BanListResponsePacket) packet);
                    break;
            }
        }
        public void OnExitRoomAnswer(ProtobufPacket <ExitRoomAnswerPacket> packet)
        {
            ExitRoomAnswerPacket answer = packet.ProtobufMessage;

            OnExitRoom?.Invoke(this, answer.Success);
        }
Exemple #32
0
        private void OnLoginRequest(ProtobufPacket <LoginRequestPacket> packet)
        {
            LoginRequestPacket request = packet.ProtobufMessage;
            LoginAnswerPacket  send    = new LoginAnswerPacket();

            // Packet Data Set

            // 로그인 핸들러에게 로그인이 성공했는지를 알아온다.
            bool success = loginHandler.SignIn(request.ID, request.Password, out string userName);

            // 보낼 패킷의 정보 설정
            send.UserName = userName;
            send.Success  = success;
            send.Context  = "로그인에 성공했습니다.";

            MNetworkPlayer player = NetworkLobby.FindPlayer(packet.Serial);

            if (send.Success == false)
            {
                send.Context = "아이디 또는 비밀번호를 확인해주세요.";
            }
            else if (player != null)
            {
                if (player.PlayerState >= MNetworkPlayer.MPlayerState.LoginSuccess)
                {
                    // 이미 접속중인 클라이언트 처리

                    send.Success = false;
                    send.Context = "이미 접속된 아이디입니다.";
                }
                else
                {
                    MNetworkPlayer find = NetworkLobby.FindPlayer(userName);

                    if (find != null)
                    {
                        // 이미 해당 닉네임을 가진 유저가 접속중임을 처리

                        send.Success = false;
                        send.Context = "해당 아이디는 이미 다른\n컴퓨터에서 사용 중입니다.";
                    }
                    else
                    {
                        // 없다면 네임 리스트에 추가해준다.

                        player.ID          = request.ID;
                        player.Password    = request.Password;
                        player.PlayerState = MNetworkPlayer.MPlayerState.LoginSuccess;
                        player.UserName    = userName;

                        NetworkLobby.AddPlayerToNameList(player);

                        send.Success = true;
                    }
                }
            }

            if (send.Success == true)
            {
                Debug.Log($"S:[{packet.Serial}] The login was successful. Name: {player.UserName}");
            }
            else
            {
                Debug.Log($"S:[{packet.Serial}] Login failed. Name: {player.UserName}");
            }

            SendPacket(new ProtobufPacket <LoginAnswerPacket>(packet.Serial, PacketEnum.ProcessType.Data,
                                                              (int)MessageType.LoginAnswer, send));
        }