コード例 #1
0
ファイル: GameSlot.cs プロジェクト: CGlesmann/ShapeShifter
    public void OnBeginDrag(PointerEventData eventData)
    {
        GameShape gameShape = GetSlotShape();
        ShapeData shapeData = gameShape?.GetShapeData();

        if (canInteract && canSelect && shapeData != null)
        {
            if (!selected)
            {
                GameSlot selectedSlot = GameManager.manager.GetSelectedSlot();
                if (selectedSlot != null && selectedSlot != this)
                {
                    GameManager.manager.DeselectSlot();
                }

                GameManager.manager.SelectSlot(this);
                themeElement.SetElementToHighlighted();
            }

            Color baseColor = gameShape.GetComponent <Image>().color;
            gameShape.GetComponent <Image>().color = new Color(baseColor.r, baseColor.g, baseColor.b, baseColor.a / 2f);

            DragInputManager.dragInputManager.BeginDrag(shapeData, this, gameShape?.GetComponent <Transform>().localScale ?? Vector3.one);
            beganDrag = true;
        }
    }
コード例 #2
0
 public ShapeData GetDraggingShape()
 {
     if (dragging)
     {
         return(gameShape.GetShapeData());
     }
     else
     {
         return(null);
     }
 }
コード例 #3
0
    public ShapeData GetBoardShapeData(int slotIndex, Transform boardParent)
    {
        GameSlot slot = GetGameSlot(slotIndex, boardParent);

        if (slot.CheckCanInteract())
        {
            GameShape shape = slot.GetSlotShape();
            if (shape != null)
            {
                return(shape.GetShapeData() ?? null);
            }
            else
            {
                return(null);
            }
        }
        else
        {
            return(null);
        }
    }