Example #1
0
    private bool DoLogin(string username, string password)
    {
        var configuration        = Registry.Configuration;
        var authenticationClient = new AuthenticationClient(configuration.AuthenticationServer.Address, configuration.AuthenticationServer.Port);
        var result = authenticationClient.Authenticate(username, password);

        if (result.Status != AuthenticationStatus.Success)
        {
            Debug.Log("Failed to authenticate");
            return(false);
        }

        _networkEventManager.FireEvent_OnLoginAuth(this, new NetworkLoginAuthEventArgs
        {
            Username  = username,
            Token     = result.Token,
            WorldHost = result.Ip,
            WorldPort = result.Port
        });

        return(true);
    }