Beispiel #1
0
        public static void WelcomeReceived(int _fromClient, Packet _packet)
        {
            int    _clientIdCheck = _packet.ReadInt();
            string _username      = _packet.ReadString();
            string _password      = _packet.ReadString();
            int    _token         = _packet.ReadInt();

            if (_fromClient != _clientIdCheck)
            {
                ServerSend.StopConnection(_clientIdCheck);
            }

            ServerAccountManager.AccountLogin(_fromClient, _username, _password, _token);
        }
Beispiel #2
0
        /// <summary>Disconnects the client and stops all network traffic.</summary>
        private void Disconnect()
        {
            Debug.Log($"{tcp.socket.Client.RemoteEndPoint} has disconnected.");

            // ThreadManager.ExecuteOnMainThread(() =>
            // {
            //     UnityEngine.Object.Destroy(player.gameObject);
            //     player = null;
            // });

            ServerAccountManager.AccountLogout(id);

            tcp.Disconnect();
            udp.Disconnect();

            ServerSend.PlayerDisconnected(id);
        }
Beispiel #3
0
 public void SaveFile()
 {
     ServerAccountManager.SaveServerAccounts();
 }
Beispiel #4
0
 public void LoadFile()
 {
     ServerAccountManager.LoadServerAccounts();
 }
Beispiel #5
0
        public static void RequestAccountDataFromServer(int _fromClient, Packet _packet)
        {
            int _sessionToken = _packet.ReadInt();

            ServerAccountManager.RequestAccountData(_fromClient, _sessionToken);
        }