Ejemplo n.º 1
0
    void SetTileTextFromGridWithColor(string[] grid, Color color, bool fillBlanks, bool isPermanent)
    {
        for (int i = 0; i < tiles.Length; i++)
        {
            TileLogic tl = tiles[i];
            if (tl == null)
            {
                continue;
            }

            if (grid[i] != "")
            {
                tl.SetTileText(grid[i], color, isPermanent);
            }
            else if (fillBlanks)
            {
                bool isInputHere = false;
                int  index       = i - currentTile.index;
                int  s           = (int)Mathf.Sqrt(tiles.Length);

                if (index >= 0)
                {
                    if (!currentDirectionIsAcross && (currentTile.index % s == i % s))
                    {
                        index = index / s;
                        if (index < currentUserInput.Length)
                        {
                            isInputHere = (currentUserInput[index] != "");
                        }
                    }
                    else if (currentDirectionIsAcross)
                    {
                        if (index < currentUserInput.Length)
                        {
                            isInputHere = (currentUserInput[index] != "");
                        }
                    }
                }
                if (!isInputHere)
                {
                    tl.SetTileText(grid[i], color, false);
                }
                //else
                //Debug.Log("don't draw blank over user input at index " + i);
            }
        }
    }