Ejemplo n.º 1
0
    /**
     * For iterating between elements on the audio cue list.
     */
    public void OnVerticalSwipe(SwipeData swipeData)
    {
        // Only trigger on up/down swipes
        if (swipeData.Direction != SwipeDirection.Down &&
            swipeData.Direction != SwipeDirection.Up)
        {
            return;
        }


        // Update index
        storedAudioInfoElement.Pause();
        audioLibraryIndex += swipeData.Direction == SwipeDirection.Up ? -1 : 1;
        int librarySize = AudioLibrary.instance.library.Length;

        audioLibraryIndex = (audioLibraryIndex + librarySize) % librarySize;

        // Update list and candidate audio cue
        playingAudio = false;
        Audio audio = AudioLibrary.instance.library[audioLibraryIndex];

        storedAudioInfoElement = storedAudioInfoElements[audioLibraryIndex];
        AM.instance.PauseCandidateAudioCueSound();
        AM.instance.ChangeCandidateAudioCueClip(audio);
        HighlightAudioElement(audioCuePanel, audioLibraryIndex, contentPanel);

        // Output current audio cue name
        MM.OutputText(audio.id);
    }
Ejemplo n.º 2
0
    /**
     * Places an audio cue list element with the given id on the list.
     */
    private void AddAudioCueListElement(string id)
    {
        GameObject         element         = Instantiate(audioInfoElementPrefab);
        AudioInfoElementV2 storedAudioInfo = element.GetComponent <AudioInfoElementV2>();

        storedAudioInfo.SetId(id);
        storedAudioInfoElements.Add(storedAudioInfo);
        element.transform.SetParent(contentPanel, false);
    }
Ejemplo n.º 3
0
    public override void SetupMode()
    {
        audioCuePanel.SetActive(true);

        // Set up list, seed w/ the first element
        contentPanel = (RectTransform)audioCuePanel.transform
                       .Find("AudioListPanel")
                       .Find("Viewport")
                       .Find("Content");
        Audio audio = AudioLibrary.instance.library[audioLibraryIndex];

        foreach (Audio curAudio in AudioLibrary.instance.library)
        {
            AddAudioCueListElement(curAudio.id);
        }
        AM.instance.PauseCandidateAudioCueSound();
        AM.instance.ChangeCandidateAudioCueClip(audio);

        // Set up elements
        List <MM.Element> elements = new List <MM.Element>();

        elements.Add(new MM.Element(AUDIO_CUE_LIST_NAME, OnSelectAudioCueList));
        elements.Add(new MM.Element("Cancel", OnSelectCancel));
        MM.instance.elements      = elements;
        MM.instance.index         = 0;
        MM.instance.listTransform = contentPanel;
        MM.instance.currentPanel  = audioCuePanel;
        HighlightAudioElement(audioCuePanel, audioLibraryIndex, contentPanel);
        storedAudioInfoElement = storedAudioInfoElements[audioLibraryIndex];

        // Set up event handlers
        TapSwipeDetector.OnSwipe     += OnHorizontalSwipe;
        TapSwipeDetector.OnSwipe     += OnVerticalSwipe;
        TapSwipeDetector.OnTap       += OnAudioCueListTap;
        TapSwipeDetector.OnDoubleTap += OnDoubleTapDefault;

        // Output intro
        MM.OutputText("Choose an audio cue from the list.");
    }