コード例 #1
0
 virtual public bool shiftAllLeft()
 {
     if (controller == null)
     {
         return(false);
     }
     return(controller.G_ShiftAllLeft());
 }
コード例 #2
0
    public bool DoUpdate(bool acceptKeyboardInput, InputMethod c)
    {
        bool forceSwitch = false;

        if (acceptKeyboardInput)
        {
            keyDelay -= Time.deltaTime * 60.0f;
            if (keyDelay <= 0)
            {
                if (c.Nav_Down())
                {
                    cursorIdx++; keyDelay = PD.KEY_DELAY;
                }
                else if (c.Nav_Up())
                {
                    cursorIdx--; keyDelay = PD.KEY_DELAY;
                }
                else if (c.M_Cancel())
                {
                    return(false);
                }
                else if (c.M_Confirm() || c.Pause())
                {
                    if (cursorIdx == 0 && playlist.text.StartsWith("..."))
                    {
                        dy--;
                    }
                    else if (cursorIdx == playlistShown - 1 && playlist.text.EndsWith("..."))
                    {
                        dy++;
                    }
                    else if (playingIdx != (topIdx + cursorIdx))
                    {
                        SetupTrack();
                    }
                    else if (isPlaying)
                    {
                        PD.sounds.PauseMusic();
                    }
                    else
                    {
                        PD.sounds.ResumeMusic();
                    }
                    keyDelay = PD.KEY_DELAY;
                }
                else if (c.G_ShiftLeft())
                {
                    topIdx -= playlistShown;
                    if (topIdx < 0)
                    {
                        topIdx = 0;
                    }
                    keyDelay    = PD.KEY_DELAY;
                    forceSwitch = true;
                }
                else if (c.G_ShiftRight())
                {
                    topIdx += playlistShown - 2;
                    if (topIdx >= (playlistEntries.Count - playlistShown))
                    {
                        topIdx = playlistEntries.Count - playlistShown;
                    }
                    keyDelay    = PD.KEY_DELAY;
                    forceSwitch = true;
                }
                else if (c.G_ShiftAllLeft())
                {
                    topIdx      = 0;
                    keyDelay    = PD.KEY_DELAY;
                    forceSwitch = true;
                }
                else if (c.G_ShiftAllRight())
                {
                    topIdx      = playlistEntries.Count - playlistShown;
                    keyDelay    = PD.KEY_DELAY;
                    forceSwitch = true;
                }
                if (cursorIdx >= (playlistShown - 1))
                {
                    if (topIdx == (playlistEntries.Count - playlistShown))
                    {
                        cursorIdx = playlistShown - 1;
                    }
                    else
                    {
                        cursorIdx = playlistShown - 2;
                    }
                    dy++;
                }
                else if (cursorIdx < 1)
                {
                    if (topIdx == 0)
                    {
                        cursorIdx = 0;
                    }
                    else
                    {
                        cursorIdx = 1;
                    }
                    dy--;
                }
            }
        }
        for (int y = 0; y < playlistShown; y++)
        {
            playlistColliders[y].GetComponent <SpriteRenderer>().color = (y == cursorIdx ? Color.white : Color.clear);
        }
        if (topIdx > 0 && dy < 0)
        {
            topIdx--;
        }
        else if (topIdx < (playlistEntries.Count - playlistShown) && dy > 0)
        {
            topIdx++;
        }
        else
        {
            dy = 0;
        }
        if (dy != 0 || forceSwitch)
        {
            SetPlaylistText();
        }
        dy        = 0;
        isPlaying = PD.sounds.IsMusicPlaying();
        playPauseButton.GetComponent <SpriteRenderer>().sprite = isPlaying ? playPauseButtonSprite[1] : playPauseButtonSprite[0];
        SetTrackText();
        return(true);
    }