Пример #1
0
 void DEBUGTestUserInfoInput()
 {
     if (Input.GetKeyDown(KeyCode.G))
     {
         Debug.Log(UserSessionManager.GetUsername());
         Debug.Log(UserSessionManager.GetID());
     }
 }
Пример #2
0
    public async void ClickVerify()
    {
        _mHandler    = GameObject.FindObjectOfType <MenuHandler>();
        _aConnection = GameObject.FindObjectOfType <AccountConnection>();
        InputField codeInputField = null;
        InputField nameInputField = null;

        var test = GameObject.FindObjectsOfType <InputField>();

        foreach (InputField x in test)
        {
            switch (x.name)
            {
            case nameof(EInputFieldNames.UsernameInputField):
                nameInputField = x;
                break;

            case nameof(EInputFieldNames.PasswordInputField):
                codeInputField = x;
                break;
            }
        }

        try
        {
            _username = nameInputField.text;
            _passcode = codeInputField.text;
        }
        catch (NullReferenceException)
        {
            throw new NullReferenceException("ClickVerify: Use of unassigned InputField.");
        }

        //Now that we have the input field info, we can toggle off the login canvas
        _mHandler.ToggleCanvas(_mHandler.GetLoginCanvas());

        Task <BoolStringResult> verifyAccountTask = _aConnection.VerifyAccountAsync(_username, _passcode);
        var result = await verifyAccountTask;

        Debug.Log(result._successful);
        Task authTask = _aConnection.GrantAuthAsync(result._successful, _username);


        _mHandler.UpdateConfirmationMessageText(result._stringMessage + " Login", result._successful);
        if (result._successful)
        {
            _mHandler.SetPrevCanvas(_mHandler.GetMainMenuCanvas());
        }
        _mHandler.ToggleCanvas(_mHandler.GetLoadingCanvas());
        _mHandler.ToggleCanvas(_mHandler.GetMessageCanvas());

        if (authTask.IsCompleted)
        {
            Debug.Log(UserSessionManager.GetUsername());
            Debug.Log(UserSessionManager.GetID());
        }
    }