/// <summary> /// 滑动进度条的控制 /// </summary> private void SeekSliderControl() { Rect slider_rect = new Rect((Screen.width - 100) / 2.0f, 100, 130, 40); if (!m_seekSlider.is_now_dragging) //-如果没在拖动 { float new_position = GUI.HorizontalSlider(slider_rect , m_musicManager.beatCountFromStart , 0 , m_musicManager.length); //-如果滑动条的位置和当前的拍子不一样,说明开始拖动 if (new_position != m_musicManager.beatCountFromStart) { m_seekSlider.dragging_poisition = new_position; m_seekSlider.is_now_dragging = true; } } else//-如果在拖动,则滑动条的位置就是当前拖动的位置 { m_seekSlider.dragging_poisition = GUI.HorizontalSlider(slider_rect , m_seekSlider.dragging_poisition , 0 , m_musicManager.length); // 释放按钮(拖动完成)设置所有的控件到当前位置 if (!m_seekSlider.is_button_down) { m_musicManager.Seek(m_seekSlider.dragging_poisition); m_eventManager.Seek(m_seekSlider.dragging_poisition); m_scoringManager.Seek(m_seekSlider.dragging_poisition); m_onPlayGUI.Seek(m_seekSlider.dragging_poisition); Seek(m_seekSlider.dragging_poisition); //-设置滑动结束 m_seekSlider.is_now_dragging = false; } } }