Beispiel #1
0
        internal TextInfo Update(MeshGenerationContextUtils.TextParams parms, float pixelsPerPoint)
        {
            parms.rect = new Rect(Vector2.zero, parms.rect.size);
            int      hashCode = parms.GetHashCode();
            bool     flag     = this.m_PreviousGenerationSettingsHash == hashCode;
            TextInfo textInfo;

            if (flag)
            {
                textInfo = this.textInfo;
            }
            else
            {
                TextHandle.UpdateGenerationSettingsCommon(parms, this.m_CurrentGenerationSettings);
                this.m_CurrentGenerationSettings.color        = parms.fontColor;
                this.m_CurrentGenerationSettings.inverseYAxis = true;
                this.m_CurrentGenerationSettings.scale        = pixelsPerPoint;
                this.m_CurrentGenerationSettings.overflowMode = parms.textOverflowMode;
                this.textInfo.isDirty = true;
                UnityEngine.TextCore.TextGenerator.GenerateText(this.m_CurrentGenerationSettings, this.textInfo);
                this.m_PreviousGenerationSettingsHash = hashCode;
                textInfo = this.textInfo;
            }
            return(textInfo);
        }
Beispiel #2
0
        private void UpdatePreferredValues(MeshGenerationContextUtils.TextParams parms)
        {
            parms.rect = new Rect(Vector2.zero, parms.rect.size);
            int  hashCode = parms.GetHashCode();
            bool flag     = this.m_PreviousLayoutSettingsHash == hashCode;

            if (!flag)
            {
                TextHandle.UpdateGenerationSettingsCommon(parms, this.m_CurrentLayoutSettings);
                this.m_PreferredSize = UnityEngine.TextCore.TextGenerator.GetPreferredValues(this.m_CurrentLayoutSettings, this.textInfo);
                this.m_PreviousLayoutSettingsHash = hashCode;
            }
        }
        void UpdatePreferredValues(MeshGenerationContextUtils.TextParams parms)
        {
            // The screenRect in TextCore is not properly implemented with regards to the offset part, so zero it out for now and we will add it ourselves later
            parms.rect = new Rect(Vector2.zero, parms.rect.size);
            int paramsHash = parms.GetHashCode();

            if (m_PreviousLayoutSettingsHash == paramsHash)
            {
                return;
            }
            UpdateGenerationSettingsCommon(parms, m_CurrentLayoutSettings);
            m_PreferredSize = TextCore.TextGenerator.GetPreferredValues(m_CurrentLayoutSettings, textInfo);
            m_PreviousLayoutSettingsHash = paramsHash;
        }
        public NativeArray <TextVertex> GetVertices(MeshGenerationContextUtils.TextParams parms, float scaling)
        {
            int paramsHash = parms.GetHashCode();

            if (m_PreviousTextParamsHash == paramsHash)
            {
                return(textVertices);
            }

            m_PreviousTextParamsHash = paramsHash;
            TextNativeSettings textSettings = MeshGenerationContextUtils.TextParams.GetTextNativeSettings(parms, scaling);

            textVertices = TextNative.GetVertices(textSettings);
            return(textVertices);
        }
Beispiel #5
0
        private void UpdateVisibleText()
        {
            MeshGenerationContextUtils.TextParams textParams = MeshGenerationContextUtils.TextParams.MakeStyleBased(this, this.text);
            int  hashCode = textParams.GetHashCode();
            bool flag     = this.m_UpdateTextParams || hashCode != this.m_PreviousTextParamsHashCode;

            if (flag)
            {
                this.m_TextParams = textParams;
                bool flag2 = this.m_TextParams.textOverflowMode == TextOverflowMode.Ellipsis;
                if (flag2)
                {
                    this.m_TextParams.text = this.ElideText(this.m_TextParams.text, TextElement.k_EllipsisText, this.m_TextParams.rect.width, this.m_TextParams.textOverflowPosition);
                }
                this.isElided = (this.m_TextParams.textOverflowMode == TextOverflowMode.Ellipsis && this.m_TextParams.text != this.text);
                this.m_PreviousTextParamsHashCode = hashCode;
                this.m_UpdateTextParams           = false;
                this.UpdateTooltip();
            }
        }
        public TextInfo Update(MeshGenerationContextUtils.TextParams parms, float pixelsPerPoint)
        {
            // The screenRect in TextCore is not properly implemented with regards to the offset part, so zero it out for now and we will add it ourselves later
            parms.rect = new Rect(Vector2.zero, parms.rect.size);
            int paramsHash = parms.GetHashCode();

            if (m_PreviousGenerationSettingsHash == paramsHash)
            {
                return(uITKTextInfo);
            }
            UpdateGenerationSettingsCommon(parms, m_CurrentGenerationSettings);
            m_CurrentGenerationSettings.color        = parms.fontColor;
            m_CurrentGenerationSettings.inverseYAxis = true;
            m_CurrentGenerationSettings.scale        = pixelsPerPoint;
            m_CurrentGenerationSettings.overflowMode = GetTextOverflowMode(parms);
            textInfo.isDirty = true;
            TextCore.TextGenerator.GenerateText(m_CurrentGenerationSettings, textInfo);
            m_PreviousGenerationSettingsHash = paramsHash;
            return(ConvertTo(textInfo));
        }