void SetShareNotification(bool notify) { var shareButtonRenderer = m_ShareButton.GetComponent <Renderer>(); shareButtonRenderer.material = notify ? m_ShareButtonNotify : m_ShareButtonStandard; m_ShareButton.SetColor(GetGazeColor()); if (shareButtonRenderer.material.HasProperty("_PulseSpeed")) { shareButtonRenderer.material.SetFloat("_PulseSpeed", m_GazeActive ? 2 : 1); } }
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); }