Ejemplo n.º 1
0
        void Update()
        {
            BaseUpdate();

            // Update save buttons availability.
            bool alreadySaved = SaveLoadScript.m_Instance.SceneFile.Valid &&
                                SaveLoadScript.m_Instance.CanOverwriteSource;

            m_NewSaveButton.SetActive(!alreadySaved);
            m_SaveOptionsButton.SetActive(alreadySaved);

            // Update share button's text.
            bool loggedIn = App.GoogleIdentity.LoggedIn;

            if (loggedIn != m_LoggedIn)
            {
                RefreshLoginButtonText(loggedIn);
            }

            // Update share button's availability.
            // This is a special case.  Normally, OptionButton.m_AllowUnavailable controls the availability
            // of buttons, but we want to run custom logic here to allow it to be available when the
            // sketch can't be shared, but we've got an upload in progress.
            bool bWasAvailable = m_ShareButton.IsAvailable();
            bool bAvailable    = SketchControlsScript.m_Instance.IsCommandAvailable(
                SketchControlsScript.GlobalCommands.UploadToGenericCloud) || m_LastUploadProgress > 0.0f;

            // Manual in-app uploading is disabled in demo mode. The assistant can manually initiate
            // a demo upload by tapping U on the keyboard, or Tilt Brush can be configured to automatically
            // upload the sketch when the demo countdown is down.
            if (DemoManager.m_Instance.DemoModeEnabled)
            {
                bAvailable = false;
            }
            if (bWasAvailable != bAvailable)
            {
                m_ShareButton.SetButtonAvailable(bAvailable);
            }

            // Keep share button fresh.
            float uploadProgress = VrAssetService.m_Instance.UploadProgress;

            // In demo mode, since the button is always disabled, we don't want any distracting
            // flashing or color changes when the automatic uploads occur.
            if (DemoManager.m_Instance.DemoModeEnabled)
            {
                uploadProgress = 0;
            }
            if (m_LastUploadProgress != uploadProgress)
            {
                SetShareNotification(uploadProgress >= 1);
                m_ShareButton.GetComponent <Renderer>().material.SetFloat("_Ratio", uploadProgress);
                m_LastUploadProgress = uploadProgress;
            }
        }
Ejemplo n.º 2
0
        override public void OnUpdatePanel(Vector3 vToPanel, Vector3 vHitPoint)
        {
            base.OnUpdatePanel(vToPanel, vHitPoint);
            UpdateShareButtonText();

            float uploadProgress = VrAssetService.m_Instance.UploadProgress;

            // Update share button's availability.
            // This is a special case.  Normally, OptionButton.m_AllowUnavailable controls the availability
            // of buttons, but we want to run custom logic here to allow it to be available when the
            // sketch can't be shared, but we've got an upload in progress.
            bool bWasAvailable = m_ShareButton.IsAvailable();
            bool bAvailable    = SketchControlsScript.m_Instance.IsCommandAvailable(
                SketchControlsScript.GlobalCommands.UploadToGenericCloud) || uploadProgress > 0.0f;

            if (bWasAvailable != bAvailable)
            {
                m_ShareButton.SetButtonAvailable(bAvailable);
            }

            // Enable the appropriate share button depending on upload state.
            // Keep both the buttons' colors and shader variables updated, regardless of activity.
            if (uploadProgress > 0.0f)
            {
                if (uploadProgress >= 1.0f)
                {
                    ActivatePromoBorder(false);
                    SetShareButtonNotifyActive(true);
                }
                else
                {
                    SetShareButtonNotifyActive(false);
                }
            }
            else
            {
                uploadProgress = 0.0f;
                SetShareButtonNotifyActive(false);
            }

            m_ShareButton.GetComponent <Renderer>().material.SetFloat("_Ratio", uploadProgress);
            m_ShareButton_Notify.GetComponent <Renderer>().material.SetFloat("_Ratio", uploadProgress);

            Color col = GetGazeColor();

            m_ShareButton.SetColor(col);
            m_ShareButton_Notify.SetColor(col);
        }