Ejemplo n.º 1
0
        public bool Authenticate()
        {
            // Create a new account on the web server.

            var client      = new AuthenticationWebServiceClient("http://localhost/2.0");
            var loginResult = client.LoginSteam(SteamId, string.Empty, string.Empty);

            if (loginResult.MemberAuthenticationResult != MemberAuthenticationResult.Ok)
            {
                Console.Error.WriteLine("[TestCommPeer] WS -> Failed to login through the web server.");
                return(false);
            }

            _authToken = loginResult.AuthToken;
            _member    = loginResult.MemberView;

            // Complete the account, so we can set the user name.
            var completeResult = client.CompleteAccount(Profile.Cmid, Name, ChannelType.Steam, "en_US", string.Empty);

            if (completeResult.Result != 1)
            {
                Console.Error.WriteLine("[TestCommPeer] WS -> Failed to complete account through the web server.");
                return(false);
            }

            Console.WriteLine("[TestCommPeer] WS -> Login success!");
            return(true);
        }
Ejemplo n.º 2
0
        //TODO: Write some stress test code or some stuff.

        public static void Main(string[] args)
        {
            var userServiceClient           = new UserWebServiceClient("http://localhost/2.0");
            var authenticationServiceClient = new AuthenticationWebServiceClient("http://localhost/2.0");

            var loginResult = authenticationServiceClient.LoginSteam("test", "", "");
            var member      = userServiceClient.GetMember(loginResult.AuthToken);

            Console.WriteLine(member.CmuneMemberView);
            Console.WriteLine(member.UberstrikeMemberView);
            Console.ReadLine();
        }
    public IEnumerator StartLoginMemberSteam(bool directSteamLogin)
    {
        if (directSteamLogin)
        {
            _progress.Text     = "Authenticating with Steam";
            _progress.Progress = 0.05f;
            PopupSystem.Show(_progress);
            m_GetAuthSessionTicketResponse = Callback <GetAuthSessionTicketResponse_t> .Create(new Callback <GetAuthSessionTicketResponse_t> .DispatchDelegate(OnGetAuthSessionTicketResponse));

            byte[]      ticket = new byte[1024];
            uint        pcbTicket;
            HAuthTicket authTicket = SteamUser.GetAuthSessionTicket(ticket, 1024, out pcbTicket);
            int         num        = (int)pcbTicket;
            string      authToken  = num.ToString();
            string      machineId  = SystemInfo.deviceUniqueIdentifier;
            MemberAuthenticationResultView authenticationView = null;
            _progress.Text     = "Authenticating with UberStrike";
            _progress.Progress = 0.1f;
            yield return(AuthenticationWebServiceClient.LoginSteam(PlayerDataManager.SteamId, authToken, machineId, delegate(MemberAuthenticationResultView result)
            {
                authenticationView = result;
                PlayerPrefs.SetString("CurrentSteamUser", PlayerDataManager.SteamId);
                PlayerPrefs.Save();
            }, delegate(Exception error)
            {
                Debug.LogError("Account authentication error: " + error);
                ShowLoginErrorPopup(LocalizedStrings.Error, "There was an error logging you in. Please try again or contact us at http://support.cmune.com");
            }));

            yield return(UnityRuntime.StartRoutine(CompleteAuthentication(authenticationView, false)));
        }
        else
        {
            PopupSystem.ClearAll();
            yield return(PanelManager.Instance.OpenPanel(PanelType.Login));
        }
        yield break;
    }