Ejemplo n.º 1
0
 public void SendLoginMsg(string username, string password)
 {
     client.Send((short)MsgId.Login, new LoginMsg()
     {
         AccountName = username, AccountPassword = password
     }, (callbackStatus, reader) =>
     {
         if (callbackStatus == CallbackStatus.Ok)
         {
             LoginResponseMsg msg = reader.ReadMessage <LoginResponseMsg>();
             loginSucessful       = msg.Authenticated; //This will always be true for prototyping
             if (loginSucessful)
             {
                 uniqueID      = msg.UniqueID;
                 loginResponse = "Login Successful!";
             }
             else
             {
                 loginResponse = "Login Failed!";
             }
         }
         if (callbackStatus == CallbackStatus.Error)
         {
             Debug.LogError("Callback Error: Login error");
         }
         if (callbackStatus == CallbackStatus.Timeout)
         {
             Debug.LogError("Callback Error: Login attempt timed out");
         }
     });
 }
Ejemplo n.º 2
0
        public void SendLoginMsg(string username, string password)
        {
            client.Send(new LoginMsg()
            {
                AccountName = username, AccountPassword = password
            }, (reader) =>
            {
                LoginResponseMsg msg = reader.ReadMessage <LoginResponseMsg>();

                if (msg.Status == CallbackStatus.Success)
                {
                    uniqueID       = msg.UniqueID;
                    loginSucessful = true;
                    loginResponse  = "Login Successful!";
                    logger.Log("[ClientAuthentication] - Login Successful!");
                }
                if (msg.Status == CallbackStatus.Error)
                {
                    logger.LogError("[ClientAuthentication] - Callback Error: Login error");
                }
                if (msg.Status == CallbackStatus.Timeout)
                {
                    logger.LogError("[ClientAuthentication] - Callback Error: Login attempt timed out");
                }
            });
        }