Beispiel #1
0
        // Rendering
        /// <summary>
        /// Make a 2d slice of the text grid using the internal position of the view to this grid, and the size of the view.
        /// </summary>
        /// <param name="externalTextGrid">The external grid to take a slice out of.</param>
        public void SetText(TextGrid externalTextGrid)
        {
            var externalSize = externalTextGrid.GetSize();

            textGrid = new TextGrid(size);

            int endRow    = internalPosition.row + size.rows - 1;
            int endColumn = internalPosition.column + size.columns - 1;

            int maxRow = Math.Min(endRow + 1, externalSize.rows);
            int maxCol = Math.Min(endColumn + 1, externalSize.columns);

            for (int row = internalPosition.row; row < maxRow; row++)
            {
                for (int column = internalPosition.column; column < maxCol; column++)
                {
                    char character = externalTextGrid[row, column];

                    int textRow    = row - internalPosition.row;
                    int textColumn = column - internalPosition.column;

                    textGrid[textRow, textColumn] = character;
                }
            }

            Change();
        }
Beispiel #2
0
        private void Awake()
        {
            if (Tools.CheckError(textMesh == null, "No TextMeshPro object has been added"))
            {
                return;
            }
            if (Tools.CheckError(uiCursor == null, "No UICursor object has been added"))
            {
                return;
            }

            _mainLayer = new Layer(Size);
            _layers    = new List <Layer>();

            _textGrid = new TextGrid(Size);

            CalibrateTextMesh();
        }