예제 #1
0
    // Update is called once per frame
    void Update()
    {
        if (AutoNext)
        {
            m_Button.GetComponent <Image>().sprite = selected;
            //0.02s left for this song
            if (MusicPlayer.GetSongLength() - MusicPlayer.GetAudioPosSec() < 0.02f)
            {
                int index = MusicWheelBase.GetCurSongIndex() + 1;
                if (index >= MusicWheelBase.GetWheelItemCount())
                {
                    index = 0;
                }
                MusicWheelItem item = GameObject.Find("WheelItem" + string.Format("{0}", index)).GetComponent <MusicWheelItem>();

                MusicWheelBase.SetWheelPosIndex(index);
                item.ButtonClicked();
                GameObject.Find("SongProgressBar").GetComponent <SongProgressbar>().SetProgress(0f);
                GameObject.Find("PlayButton").GetComponent <PlayButton>().ButtonOnClickEvent();
            }
        }
        else
        {
            m_Button.GetComponent <Image>().sprite = normal;
        }
    }
예제 #2
0
    public void ButtonOnClickEvent()
    {
        int index = MusicWheelBase.GetCurSongIndex() + 1;

        if (index >= MusicWheelBase.GetWheelItemCount())
        {
            index = 0;
        }
        MusicWheelItem item = GameObject.Find("WheelItem" + string.Format("{0}", index)).GetComponent <MusicWheelItem>();

        MusicWheelBase.SetWheelPosIndex(index);
        item.ButtonClicked();
        GameObject.Find("SongProgressBar").GetComponent <SongProgressbar>().SetProgress(0f);
        GameObject.Find("PlayButton").GetComponent <PlayButton>().ButtonOnClickEvent();
    }
예제 #3
0
    public void ButtonOnClickEvent()
    {
        if (MusicPlayer.GetIsPlaying())
        {
            Debug.Log("Paused");
            MusicPlayer.PauseAudio();
        }
        List <int> itemlist = new List <int>();

        for (int i = 0; i < MusicWheelBase.GetWheelItemCount(); i++)
        {
            MusicWheelItem item_t = GameObject.Find("WheelItem" + string.Format("{0}", i)).GetComponent <MusicWheelItem>();
            if (!item_t.played)
            {
                itemlist.Add(i);
            }
        }
        if (itemlist.Count == 0)
        {
            return;
        }
        //Random.InitState(1);
        int index = Random.Range(0, itemlist.Count);

        GameObject.Find("RedoRandomButton").GetComponent <RedoRandom>().AddRandom(itemlist[index]);
        MusicWheelItem item = GameObject.Find("WheelItem" + string.Format("{0}", itemlist[index])).GetComponent <MusicWheelItem>();

        float t = itemlist[index] * 1.0f / (MusicWheelBase.GetWheelItemCount() - 1);

        MusicWheelBase.UpdateWheelPos(t);
        Scrollbar m_Scrollbar = GameObject.Find("Scrollbar").GetComponent <Scrollbar>();

        m_Scrollbar.value = t;
        item.ButtonClicked();

        float pos = Random.Range(0f, 0.8f);

        if (GameObject.Find("LimTVSizeButton").GetComponent <LimitTVSize>().LimitTvSize)
        {
            float songlen = MusicPlayer.GetSongLength();
            float sec     = Random.Range(0f, 80f);
            sec = Mathf.Min(songlen - 15f, sec);
            pos = sec / songlen;
        }

        GameObject.Find("SongProgressBar").GetComponent <SongProgressbar>().SetProgress(pos);
    }
예제 #4
0
    public void ButtonOnClickEvent()
    {
        if (st.Count <= 1)
        {
            return;
        }
        //redo now
        int            index  = (int)st.Peek();
        MusicWheelItem item_t = GameObject.Find("WheelItem" + string.Format("{0}", index)).GetComponent <MusicWheelItem>();

        item_t.side_image_obj.SetActive(false);
        item_t.played = false;
        st.Pop();

        index = (int)st.Peek();
        MusicWheelItem item = GameObject.Find("WheelItem" + string.Format("{0}", index)).GetComponent <MusicWheelItem>();

        float t = index * 1.0f / (MusicWheelBase.GetWheelItemCount() - 1);

        MusicWheelBase.UpdateWheelPos(t);
        Scrollbar m_Scrollbar = GameObject.Find("Scrollbar").GetComponent <Scrollbar>();

        m_Scrollbar.value = t;
        item.ButtonClicked();

        /*
         * float pos = Random.Range(0f, 0.8f);
         * if (GameObject.Find("LimTVSizeButton").GetComponent<LimitTVSize>().LimitTvSize)
         * {
         *  float songlen = MusicPlayer.GetSongLength();
         *  float sec = Random.Range(0f, 80f);
         *  pos = sec / songlen;
         * }*/

        GameObject.Find("SongProgressBar").GetComponent <SongProgressbar>().SetProgress(0f);
    }