Exemple #1
0
 void Update()
 {
     if (MouseUtilities.TouchingUI(rt) && Input.GetMouseButtonDown(0))
     {
         action.Invoke(layer);
     }
 }
 void Update()
 {
     if (valuesSet)
     {
         if (MouseUtilities.TouchingUI(rt) && Input.GetMouseButtonDown(0))
         {
             action.Invoke(palette);
         }
         im.color = typeColors[draw.GetPalette(palette) - 1];
     }
 }
Exemple #3
0
    void Update()
    {
        if (MouseUtilities.TouchingUI(rt) && Input.GetMouseButtonDown(0))
        {
            startDragMouse  = Input.mousePosition;
            startDragButton = parentRt.position;
            isDragged       = true;
            moveLayerPreview.gameObject.SetActive(true);
        }
        if (Input.GetMouseButton(0) && isDragged)
        {
            posChange         = (Vector2)Input.mousePosition - startDragMouse;
            parentRt.position = startDragButton + posChange;
            if (parentRt.position.x < contentRt.position.x + contentRt.rect.width / 2f - 10f)
            {
                parentRt.position = new Vector2(contentRt.position.x + contentRt.rect.width / 2f - 10f, parentRt.position.y);
            }
            else if (parentRt.position.x > contentRt.position.x + contentRt.rect.width / 2f + 10f)
            {
                parentRt.position = new Vector2(contentRt.position.x + contentRt.rect.width / 2f + 10f, parentRt.position.y);
            }
            if (parentRt.position.y < contentRt.position.y - 80.0f * nButtons - 5.0f)
            {
                parentRt.position = new Vector2(parentRt.position.x, contentRt.position.y - 80.0f * nButtons - 5.0f);
            }

            moveLayerPreview.position = new Vector3(
                contentRt.position.x - 25,
                contentRt.position.y - Mathf.Floor(
                    (contentRt.position.y - parentRt.position.y - 10.0f) / 80.0f + 1.0f) * 80.0f,
                0);
        }
        if (Input.GetMouseButtonUp(0) && isDragged)
        {
            action.Invoke(m_Name,
                          draw.GetLayer(Mathf.Floor(
                                            (contentRt.position.y - parentRt.position.y - 10.0f) / 80.0f)));
            isDragged = false;
            moveLayerPreview.gameObject.SetActive(false);
        }
    }