Exemple #1
0
    void DrawGuiRightSide()
    {
        int ypos        = 50;
        int yposOff     = 35;
        int buttonWidth = 300;

        if (!wasCategoryAdded)
        {
            if (customAudioClip != null && GUI.Button(new Rect(Screen.width - (buttonWidth + 20), ypos, buttonWidth, 30), "Create new category with custom AudioClip"))
            {
                var category = AudioController.NewCategory("Custom Category");
                AudioController.AddToCategory(category, customAudioClip, "CustomAudioItem");
                wasClipAdded     = true;
                wasCategoryAdded = true;
            }
        }
        else
        {
            if (GUI.Button(new Rect(Screen.width - (buttonWidth + 20), ypos, buttonWidth, 30), "Play custom AudioClip"))
            {
                AudioController.Play("CustomAudioItem");
            }

            if (wasClipAdded)
            {
                ypos += yposOff;

                if (GUI.Button(new Rect(Screen.width - (buttonWidth + 20), ypos, buttonWidth, 30), "Remove custom AudioClip"))
                {
                    if (AudioController.RemoveAudioItem("CustomAudioItem"))
                    {
                        wasClipAdded = false;
                    }
                }
            }
        }

        ypos = 130;

#if !UNITY_AUDIO_FEATURES_4_1
        BeginDisabledGroup(true);
#endif

        if (GUI.Button(new Rect(Screen.width - (buttonWidth + 20), ypos, buttonWidth, 30), "Play gapless audio loop"))
        {
            AudioController.Play("GaplessLoopTest").Stop(1, 4);
        }
        ypos += yposOff;

        if (GUI.Button(new Rect(Screen.width - (buttonWidth + 20), ypos, buttonWidth, 30), "Play random loop sequence"))
        {
            AudioController.Play("RandomLoopSequence");
        }
        ypos += yposOff;

        if (GUI.Button(new Rect(Screen.width - (buttonWidth + 20), ypos, buttonWidth, 50), "Play intro-loop-outro sequence\ngatling gun"))
        {
            introLoopOutroAudio = new PoolableReference <AudioObject>(AudioController.Play("IntroLoopOutro_Gun"));
        }

        ypos += 20;
        ypos += yposOff;

        BeginDisabledGroup(!(introLoopOutroAudio != null && introLoopOutroAudio.Get() != null));

        if (GUI.Button(new Rect(Screen.width - (buttonWidth + 20), ypos, buttonWidth, 30), "Finish gatling gun sequence"))
        {
            introLoopOutroAudio.Get().FinishSequence();
        }

        EndDisabledGroup();

#if !UNITY_AUDIO_FEATURES_4_1
        EndDisabledGroup();
#endif
    }