// ------------------------------------------------ public void SoundMarkerSelected(SoundMarker selectedSound) { // Change the InputField text soundNameInputField.text = selectedSound.hotspot.name; soundLabelResizeText.text = selectedSound.hotspot.name; // Change the 2D UI representation soundIconImage.sprite = selectedSound.iconSprite; // Set the trigger and loop toggles triggerPlaybackToggle.isOn = selectedSound.hotspot.triggerPlayback; loopAudioToggle.isOn = selectedSound.hotspot.loopAudio; loopAudioToggle.interactable = (triggerPlaybackToggle.isOn == true); SetTriggerVisualInteractiveState(loopAudioToggle); pitchSlider.value = selectedSound.hotspot.pitchBend; volumeSlider.value = selectedSound.hotspot.soundVolume; // Change the colour of the UI Color newCol = selectedSound.color; repositionImage.color = newCol; soundIconImage.color = newCol; soundColorImage.color = newCol; minRadiusSlider.SetColorTint(newCol); maxRadiusSlider.SetColorTint(newCol); minRadiusSlider.SetSliderRadius(selectedSound.soundMinDist, notifyDelegate: false); maxRadiusSlider.SetSliderRadius(selectedSound.soundMaxDist, notifyDelegate: false); UnityEngine.UI.ColorBlock cols = soundSrcButton.colors; cols.normalColor = newCol; cols.highlightedColor = newCol.ColorWithBrightness(-0.15f); cols.pressedColor = newCol.ColorWithBrightness(-0.3f); soundSrcButton.colors = cols; if (selectedSound.hotspot.soundFile.isDefaultSoundFile) { soundFilenameText.text = "Tap to change sound"; } else { soundFilenameText.text = "\"" + selectedSound.hotspot.soundFile.filenameWithExtension + "\""; } int charLimit = 21; int charsOver = soundFilenameText.text.Length - charLimit; float percentOverCharLimit = (charsOver > 0) ? (charsOver / 8f) : 0; soundFilenameText.fontSize = 36 - (int)(8 * percentOverCharLimit); }
public void SoundMarkerSelected(SoundMarker selectedMarker) { // Change the InputField text soundNameInputField.text = selectedMarker.hotspot.name; soundLabelResizeText.text = selectedMarker.hotspot.name; // Change the 2D UI representation soundAppearanceImage.sprite = selectedMarker.iconSprite; soundShapeImage.sprite = selectedMarker.soundShapeSprite; // Set the trigger and loop toggles triggerPlaybackToggle.isOn = selectedMarker.hotspot.triggerPlayback; playOnceToggle.isOn = selectedMarker.hotspot.playOnce; loopAudioToggle.isOn = selectedMarker.hotspot.loopAudio; bool loopAudioInteractable = selectedMarker.hotspot.triggerPlayback; if (selectedMarker.hotspot.playOnce) { loopAudioInteractable = false; } loopAudioToggle.interactable = loopAudioInteractable; SetTriggerVisualInteractiveState(loopAudioToggle, loopAudioInteractable, selectedMarker.hotspot.loopAudio); pitchSlider.value = selectedMarker.hotspot.pitchBend; volumeSlider.value = selectedMarker.hotspot.soundVolume; // Filter values freqCutoffSlider.value = selectedMarker.hotspot.freqCutoff; phaserSlider.value = selectedMarker.hotspot.phaserLevel; distortionSlider.value = selectedMarker.hotspot.distortion; echoSlider.value = selectedMarker.hotspot.echoMagnitude; updateSyncedMarkersUI(selectedMarker); // Change the colour of the UI updateUIColor(selectedMarker.color, notifyDelegate: false); // Color newCol = selectedSound.color; // repositionImage.color = newCol; // soundAppearanceImage.color = newCol; // soundColorImage.color = newCol; // minRadiusSlider.SetColorTint(newCol); // maxRadiusSlider.SetColorTint(newCol); // UnityEngine.UI.ColorBlock cols = soundSrcButton.colors; // cols.normalColor = newCol; // cols.highlightedColor = newCol.ColorWithBrightness(-0.15f); // cols.pressedColor = newCol.ColorWithBrightness(-0.3f); // soundSrcButton.colors = cols; minRadiusSlider.SetSliderRadius(selectedMarker.soundMinDist, notifyDelegate: false); maxRadiusSlider.SetSliderRadius(selectedMarker.soundMaxDist, notifyDelegate: false); SoundFile markerSoundFile = selectedMarker.hotspot.soundFile; if (markerSoundFile.isDefaultSoundFile) { soundFilenameText.text = "Tap to change sound"; } else { soundFilenameText.text = "\"" + markerSoundFile.filenameWithExtension + "\""; } int charLimit = 21; int charsOver = soundFilenameText.text.Length - charLimit; float percentOverCharLimit = (charsOver > 0) ? (charsOver / 8f) : 0; soundFilenameText.fontSize = 36 - (int)(8 * percentOverCharLimit); refreshDebugText(); // debugText.text = selectedMarker.userHasHeardSound ? "User HAS heard" : "NOT heard"; }
// ------------------------------------------------ public void SoundMarkerSelected(SoundMarker selectedSound) { // Change the InputField text soundNameInputField.text = selectedSound.hotspot.name; soundLabelResizeText.text = selectedSound.hotspot.name; // Change the 2D UI representation soundIconImage.sprite = selectedSound.iconSprite; // Set the trigger and loop toggles triggerPlaybackToggle.isOn = selectedSound.hotspot.triggerPlayback; loopAudioToggle.isOn = selectedSound.hotspot.loopAudio; loopAudioToggle.interactable = (triggerPlaybackToggle.isOn == true); SetTriggerVisualInteractiveState(loopAudioToggle); pitchSlider.value = selectedSound.hotspot.pitchBend; volumeSlider.value = selectedSound.hotspot.soundVolume; // Filter values freqCutoffSlider.value = selectedSound.hotspot.freqCutoff; phaserSlider.value = selectedSound.hotspot.phaserLevel; distortionSlider.value = selectedSound.hotspot.distortion; // Syncronisation button subtitle syncSubtitleText.text = "Edit synchronised Sound Markers"; if (canvasDelegate != null) { System.Collections.Generic.HashSet <string> syncedMarkers = canvasDelegate.SynchronisedMarkerIDsWithMarkerID(selectedSound.hotspot.id); if (syncedMarkers != null && syncedMarkers.Count > 1) { syncSubtitleText.text = string.Format("Synced with {0} Sound Marker{1}", syncedMarkers.Count - 1, (syncedMarkers.Count == 2 ? "" : "s")); } } // Change the colour of the UI Color newCol = selectedSound.color; repositionImage.color = newCol; soundIconImage.color = newCol; soundColorImage.color = newCol; minRadiusSlider.SetColorTint(newCol); maxRadiusSlider.SetColorTint(newCol); minRadiusSlider.SetSliderRadius(selectedSound.soundMinDist, notifyDelegate: false); maxRadiusSlider.SetSliderRadius(selectedSound.soundMaxDist, notifyDelegate: false); UnityEngine.UI.ColorBlock cols = soundSrcButton.colors; cols.normalColor = newCol; cols.highlightedColor = newCol.ColorWithBrightness(-0.15f); cols.pressedColor = newCol.ColorWithBrightness(-0.3f); soundSrcButton.colors = cols; if (selectedSound.hotspot.soundFile.isDefaultSoundFile) { soundFilenameText.text = "Tap to change sound"; } else { soundFilenameText.text = "\"" + selectedSound.hotspot.soundFile.filenameWithExtension + "\""; } int charLimit = 21; int charsOver = soundFilenameText.text.Length - charLimit; float percentOverCharLimit = (charsOver > 0) ? (charsOver / 8f) : 0; soundFilenameText.fontSize = 36 - (int)(8 * percentOverCharLimit); }