Example #1
0
    public override void CancelUsingItem()
    {
//		Match3Tile.OnTileTap -= OnTileSelected;
        touchController.StopInputController();
        touchController.OnNewBoardPieceSelected -= OnNewBoardPieceSelected;

        TileSwitchInput.Instance.ActivateDrag();

        base.CancelUsingItem();
    }
Example #2
0
    public override void CancelUsingItem()
    {
        StopCoroutine("GetInput");

        touchController.StopInputController();
        touchController.OnNewBoardPieceSelected -= OnNewBoardPieceSelected;

//		TileSwitchInput.Instance.gameObject.SetActive(true);
        TileSwitchInput.Instance.EnableInput();

        base.CancelUsingItem();
    }
Example #3
0
    protected void OnNewBoardPieceSelected(AbstractBoardPiece boardPiece, CustomInput.TouchInfo touchInfo)
    {
        if (isRunning || BoardShuffleController.Instance.IsBoardReshuffling)
        {
            return;
        }

        bool isLinked = false;
        AbstractBoardPiece lastSelection = null;

        //Cache reference to the last selection
        if (selectionList.Count > 0)
        {
            lastSelection = selectionList[selectionList.Count - 1];
        }

//		if(boardPiece.GetType() != typeof(EmptyBoardPiece))
//		{
        //Undo selection
        if (selectionList.Count >= 2 && selectionList[selectionList.Count - 2] == boardPiece)
        {
            RemoveSelection(selectionList.Count - 1);
            return;
        }

        //Check link between new and last selection
        if (lastSelection)
        {
            isLinked = lastSelection.IsAdjacentTo(boardPiece);
        }

        //Add current tile to the selection or start a new one
        if (selectionCount < maxNumberOfSelections)        // && !selectionList.Contains(boardPiece)
        {
            if (!isLinked)
            {
                if (selectionList.Contains(boardPiece))
                {
                    return;
                }
                RemoveAllSelections();
            }

            AddSelection(boardPiece);
        }

        if (selectionCount == maxNumberOfSelections || selectionList.Count == critNumberOfSelections)
        {
            touchController.StopInputController();
            StartCoroutine(DoItemCoroutine());
            isRunning = true;
        }
//		}
    }