Esempio n. 1
0
    public bool HandleMouseInput(MouseCore clicker)
    {
        if (!PD.usingMouse)
        {
            return(false);
        }
        int selected = -1;

        if (clicker.getPositionInGameObject(playPauseButton).z > 0.0f && clicker.isDown())
        {
            if (isPlaying)
            {
                PD.sounds.PauseMusic();
            }
            else
            {
                PD.sounds.ResumeMusic();
            }
            return(true);
        }
        for (int y = 0; y < playlistShown; y++)
        {
            if (clicker.getPositionInGameObject(playlistColliders[y]).z > 0.0f)
            {
                selected = y; break;
            }
        }
        if (selected < 0)
        {
            return(false);
        }
        cursorIdx = selected;
        if (clicker.isDown())
        {
            if (selected == 0 && playlist.text.StartsWith("..."))
            {
                dy--;
            }
            else if (selected == playlistShown - 1 && playlist.text.EndsWith("..."))
            {
                dy++;
            }
            else
            {
                SetupTrack();
            }
        }
        return(clicker.isDown());
    }
Esempio n. 2
0
    public Vector2 GetTopColliderPositionX(MouseCore clicker)
    {
        Vector3 collider = clicker.getPositionInGameObject(topCollider);

        if (collider.z == 0)
        {
            return(new Vector2(-1.0f, -1.0f));
        }
        return(new Vector2(collider.x, 0.0f));
    }
Esempio n. 3
0
    protected bool isClickingBack()
    {
        Vector3 v = clicker.getPositionInGameObject(backButton);

        if (v.z == 0.0f)
        {
            backButton.GetComponent <SpriteRenderer>().sprite = backSprites[0]; return(false);
        }
        backButton.GetComponent <SpriteRenderer>().sprite = backSprites[1];
        return(clicker.isDown());
    }
Esempio n. 4
0
    private float SetSelectedRowAndReturnY(MouseCore clicker)
    {
        Vector3 pos = clicker.getPositionInGameObject(rowCollider);

        if (pos.z == 0)
        {
            return(0.0f);
        }
        if (!clicker.isHeld() || !lockY)
        {
            rowY  = Mathf.FloorToInt((pos.y + halfHeight) / Consts.TILE_SIZE);
            lockY = clicker.isHeld();
        }
        aboveEverything = rowY > height;
        rowX            = Mathf.FloorToInt((pos.x + 0.85f) / Consts.TILE_SIZE);
        return((pos.y + halfHeight) / Consts.TILE_SIZE);
    }
 public Vector2 GetColliderPosition(MouseCore clicker)
 {
     if (colliders.Count != 9)
     {
         return(new Vector2(-1.0f, -1.0f));
     }
     for (int i = 0; i < 9; i++)
     {
         Vector3 collider = clicker.getPositionInGameObject(colliders[i]);
         if (collider.z == 0)
         {
             continue;
         }
         return(new Vector2(collider.x, i));
     }
     return(new Vector2(-1.0f, -1.0f));
 }
Esempio n. 6
0
 public bool ClickingCancelButton(MouseCore clicker)
 {
     if (cancelButton == null)
     {
         return(false);
     }
     if (clicker.getPositionInGameObject(cancelButton).z == 0)
     {
         cancelButton.GetComponent <SpriteRenderer>().sprite = cancelSheet[0];
         return(false);
     }
     else
     {
         cancelButton.GetComponent <SpriteRenderer>().sprite = cancelSheet[1];
         return(clicker.isDown());
     }
 }