Exemplo n.º 1
0
        public void LoginToVroidHub(Action <IRenderer> onResponse, Action <Account> onLoggedIn)
        {
            if (_model.IsAuthorized())
            {
                GetAccountInfo(onResponse, onLoggedIn);
                return;
            }

            // modelを操作
            _auth.AuthorizeWithExistAccount((bool isSuccess) =>
            {
                if (!isSuccess)
                {
                    _model.AuthorizationState = LoginModel.State.AUTHORIZATION_CODE_REQUESTED;
                    onResponse(new LoginViewRenderer(_model));
                    _browser = BrowserAuthorize.GenerateInstance(_sdkConfig);
                    _browser.OpenBrowser(AfterAuthentication(onResponse, onLoggedIn));
                }
                else
                {
                    _model.AuthorizationState = LoginModel.State.AUTHORIZED;
                    GetAccountInfo(onResponse, onLoggedIn);
                }
            }, (error) =>
            {
                _model.AuthorizationState = LoginModel.State.CONNECTION_FAILED;
                onResponse(new LoginViewRenderer(_model));
            });
        }
Exemplo n.º 2
0
 private void Awake()
 {
     Authentication.Instance.Init(sdkConfiguration.AuthenticateMetaData);
     codeField.gameObject.SetActive(false);
     browserAuthorize = BrowserAuthorize.GenerateInstance(sdkConfiguration);
     Login.onClick.AddListener(OnLoginButtonClicked);
     Register.onClick.AddListener(OnRegisterCodeEnter);
 }