private void UpdateText(bool recursive = false)
        {
            // Render text
            var newText = new DecalText(text, font, style, vertical, lineSpacing, charSpacing);
            var output  = TextRenderer.UpdateText(_currentText, newText);

            // update the _currentText state variable
            // this is the ONLY place this variable should be set! otherwise the current state is lost
            _currentText = newText;

            // Update the texture with the new rendered output
            UpdateTexture(output);

            // If recursive, copy parameters to other parts and perform the same operation
            if (recursive)
            {
                foreach (var counterpart in part.symmetryCounterparts)
                {
                    var decal = counterpart.GetComponent <ModuleConformalText>();
                    decal.text        = text;
                    decal.font        = font;
                    decal.style       = style;
                    decal.vertical    = vertical;
                    decal.charSpacing = charSpacing;
                    decal.lineSpacing = lineSpacing;

                    decal.UpdateText();
                }
            }
        }
示例#2
0
        private void UpdateText()
        {
            // Render text
            var newText = new DecalText(text, font, style, vertical, lineSpacing, charSpacing);
            var output  = TextRenderer.UpdateText(_currentText, newText);

            _currentText = newText;

            UpdateTexture(output);

            // TODO: ASYNC RENDERING
            // var newText = new DecalText(text, _font, _style);
            // _currentJob = TextRenderer.UpdateText(_currentText, newText, UpdateTexture);
            // _currentText = newText;
        }