コード例 #1
0
 void RefreshButtons()
 {
     OAuth2Identity.UserInfo userInfo = m_Identity.Profile;
     if (userInfo != null)
     {
         SetDescriptionText(m_LoggedInText);
         if (userInfo.icon != null)
         {
             SetButtonTexture(userInfo.icon);
         }
     }
     else
     {
         // Go back to anonymous
         SetDescriptionText(m_LogInText);
         SetButtonTexture(m_AnonymousTexture);
     }
 }
コード例 #2
0
        void RefreshObjects()
        {
            // Google.
            bool driveFull        = App.DriveSync.DriveIsLowOnSpace;
            bool driveSyncEnabled = App.DriveSync.SyncEnabled;
            bool driveSyncing     = App.DriveSync.Syncing;

            OAuth2Identity.UserInfo googleInfo = App.GoogleIdentity.Profile;
            bool googleInfoValid = googleInfo != null;

            m_GoogleSignedInElements.SetActive(googleInfoValid);
            m_GoogleSignedOutElements.SetActive(!googleInfoValid);
            m_GoogleConfirmSignOutElements.SetActive(false);
            if (googleInfoValid)
            {
                m_GoogleNameText.text = googleInfo.name;
                m_GooglePhoto.material.mainTexture = googleInfo.icon;

                m_DriveSyncIconDriveFull.SetActive(driveFull && driveSyncEnabled);
                m_DriveSyncIconEnabled.SetActive(!driveFull && driveSyncEnabled);
                m_DriveSyncIconDisabled.SetActive(!driveSyncEnabled);
            }

            // Sketchfab.
            OAuth2Identity.UserInfo sketchfabInfo = App.SketchfabIdentity.Profile;
            bool sketchfabInfoValid = sketchfabInfo != null;

            m_SketchfabSignedInElements.SetActive(sketchfabInfoValid);
            m_SketchfabSignedOutElements.SetActive(!sketchfabInfoValid);
            m_SketchfabConfirmSignOutElements.SetActive(false);
            if (sketchfabInfoValid)
            {
                m_SketchfabNameText.text = sketchfabInfo.name;
                m_SketchfabPhoto.material.mainTexture = sketchfabInfo.icon;
            }

            m_DriveFullElements.SetActive(driveFull && driveSyncEnabled);
            m_DriveSyncEnabledElements.SetActive(!driveFull && driveSyncEnabled);
            m_DriveSyncDisabledElements.SetActive(!driveSyncEnabled);
            m_BackupCompleteElements.SetActive(!driveSyncing);
            m_BackingUpElements.SetActive(driveSyncing);
            m_DriveSyncing = driveSyncing;
            RefreshBackupProgressText();
        }
コード例 #3
0
ファイル: GuiManager.cs プロジェクト: mikeage/open-brush
 void RefreshObjects()
 {
     OAuth2Identity.UserInfo userInfo = App.GoogleIdentity.Profile;
     if (userInfo != null)
     {
         Show(true);
         m_Login.SetActive(false);
         m_Profile.SetActive(true);
         m_Text.text = userInfo.name;
         Texture tex = userInfo.icon;
         if (tex != null)
         {
             m_Image.sprite = Sprite.Create((Texture2D)tex, new Rect(0, 0, tex.width, tex.height), Vector2.zero);
             m_Image.material.SetTexture("_MainTex", tex);
         }
     }
     else
     {
         m_Profile.SetActive(false);
         m_Login.SetActive(true);
     }
 }
コード例 #4
0
        // This function serves as a callback from ProfilePopUpButtons that want to
        // change the mode of the popup on click.
        public void OnProfilePopUpButtonPressed(ProfilePopUpButton button)
        {
            switch (button.m_Command)
            {
            // Identifier for signaling we understand the info message.
            case SketchControlsScript.GlobalCommands.Null:
            case SketchControlsScript.GlobalCommands.GoogleDriveSync:
                UpdateMode(Mode.Accounts);
                RefreshObjects();
                break;

            case SketchControlsScript.GlobalCommands.LoginToGenericCloud:
                // m_CommandParam 1 is Google.  m_CommandParam 2 is Sketchfab.
                if (button.m_CommandParam == 1 || button.m_CommandParam == 2)
                {
                    if (App.Config.IsMobileHardware && m_SaveAndProceedButton != null)
                    {
                        m_SaveAndProceedButton.SetCommandParameters(button.m_CommandParam, 0);
                        UpdateMode(Mode.ConfirmLogin);
                    }
                    else
                    {
                        OAuth2Identity.UserInfo userInfo = (button.m_CommandParam == 1) ?
                                                           App.GoogleIdentity.Profile : App.SketchfabIdentity.Profile;
                        if (userInfo == null)
                        {
                            UpdateMode(Mode.TakeOffHeadset);
                            m_Persistent = true;
                        }
                    }
                }
                break;

            case SketchControlsScript.GlobalCommands.AccountInfo:
                // Identifier for triggering an info message.
                switch (button.m_CommandParam)
                {
                case 0:
                    UpdateMode(Mode.DriveHelp);
                    break;

                case 1:
                    UpdateMode(Mode.GoogleHelp);
                    break;

                case 2:
                    UpdateMode(Mode.SketchfabHelp);
                    break;
                }
                break;

            case SketchControlsScript.GlobalCommands.SignOutConfirm:
                switch ((Cloud)button.m_CommandParam)
                {
                case Cloud.Poly:
                    m_GoogleSignedInElements.SetActive(false);
                    m_GoogleSignedOutElements.SetActive(false);
                    m_GoogleConfirmSignOutElements.SetActive(true);
                    break;

                case Cloud.Sketchfab:
                    m_SketchfabSignedInElements.SetActive(false);
                    m_SketchfabSignedOutElements.SetActive(false);
                    m_SketchfabConfirmSignOutElements.SetActive(true);
                    break;

                case Cloud.None: break;
                }
                break;
            }
        }