Exemple #1
0
    public void HandleTouchUp(Vector2 touch)
    {
        //selectedTiles.Count variable lets you set the minimum length of the word to be checked with the dictionary.
        if (selectedTile == null || selectedTiles.Count < 4)
        {
            return;
        }

        if (selectedTile != null)
        {
            selectedTile.Select(false);
            selectedTile = null;
        }

        char[] word = new char[selectedTiles.Count];
        for (var i = 0; i < selectedTiles.Count; i++)
        {
            var tile = selectedTiles[i];
            word[i] = tile.TypeChar;
            tile.Select(false);
        }

        var s = new string (word);

        statusLabel.text = s.ToUpper();

        if (wordData.IsValidWord(s))
        {
            Debug.Log(s);
        }
    }
Exemple #2
0
    public void HandleTouchUp(Vector2 touch)
    {
        //if (selectedTile == null || selectedTiles.Count < 3)
        if (selectedTile == null || selectedTiles.Count < 1)
        {
            return;
        }

        if (selectedTile != null)
        {
            selectedTile.Select(false);
            selectedTile = null;
        }

        char[] word = new char[selectedTiles.Count];
        for (var i = 0; i < selectedTiles.Count; i++)
        {
            var tile = selectedTiles[i];
            word[i] = tile.TypeChar;
            tile.Select(false);
        }

        var s = new string (word);

        statusLabel.text = s.ToUpper();

        if (wordData.IsValidWord(s))
        {
            for (var i = 0; i < selectedTiles.Count; i++)
            {
                var tile = selectedTiles [i];
                tile.gameObject.SetActive(false);
            }
            grid.CollapseGrid();
        }

        selectedTiles.Clear();
    }