コード例 #1
0
 void SetSongPos(float posTime)
 {
     if (EAudio.IsAudioPlaying())
     {
         EAudio.SetSamplePosition((int)(EAudio.GetSampleDuration() * (posTime / f_totalTime)));
         i_pauseSample = EAudio.GetCurSample();
     }
     else
     {
         Play();
         EAudio.SetSamplePosition((int)(EAudio.GetSampleDuration() * (posTime / f_totalTime)));
         Pause();
     }
     f_beatCheck = 0;
 }
コード例 #2
0
 void DrawSongConroll()
 {
     f_curTime = EAudio.GetCurTime();
     GUILayout.BeginHorizontal();
     GUILayout.Space(15);
     if (EAudio.IsAudioPlaying())
     {
         if (!b_pause)
         {
             if (GUILayout.Button("Pause(~)"))
             {
                 Pause();
             }
         }
         else
         {
             if (GUILayout.Button("Resume(~)"))
             {
                 Resume();
             }
         }
     }
     else
     {
         if (GUILayout.Button("Play(~)"))
         {
             Play();
         }
     }
     GUILayout.Space(15);
     if (GUILayout.Button("Stop(Esc)"))
     {
         Stop();
     }
     GUILayout.Space(15);
     GUILayout.EndHorizontal();
 }
コード例 #3
0
    void EventManage()
    {
        if (Event.current.isMouse)
        {
            if (Event.current.type == EventType.MouseDown)
            {
                v2_mousePos = Event.current.mousePosition;
            }
            b_isLeftClick = Event.current.button == 0;
        }
        else if (Event.current.isScrollWheel)
        {
            if (Event.current.delta.y > 0)
            {
                SetSongPos(f_curTime - .5f);
            }
            else if (Event.current.delta.y < 0)
            {
                SetSongPos(f_curTime + .5f);
            }
        }
        else if (Event.current.isKey && Event.current.type == EventType.KeyUp)
        {
            switch (Event.current.keyCode)
            {
            case KeyCode.F12:
            {
                beats.Clear();
            }
            break;

            case KeyCode.BackQuote:
            {
                if (!EAudio.IsAudioPlaying())
                {
                    Play();
                }
                else if (b_pause)
                {
                    Resume();
                }
                else
                {
                    Pause();
                }
            }
            break;

            case KeyCode.Escape:
            {
                if (EAudio.IsAudioPlaying())
                {
                    Stop();
                }
            }
            break;

            case KeyCode.W:
            {
                SetSongPos(f_curTime + 1f);
            }
            break;

            case KeyCode.S:
            {
                SetSongPos(f_curTime - 1f);
            }
            break;
            }
        }
    }