public TextRenderer(LWF lwf, TextContext context) : base(lwf) { m_context = context; m_matrix = new Matrix4x4(); m_renderMatrix = new Matrix4x4(); m_colorMult = new UnityEngine.Color(); #if LWF_USE_ADDITIONALCOLOR m_colorAdd = new UnityEngine.Color(); #endif if (m_context != null && m_context.systemFontRenderer != null) { ISystemFontRenderer.Parameter p = context.systemFontRendererParameter; float scale = lwf.scaleByStage; m_context.systemFontRenderer.Init( p.mSize * scale, p.mWidth * scale, p.mHeight * scale, p.mStyle, p.mAlign, p.mVerticalAlign, p.mLineSpacing * scale, p.mLetterSpacing * scale, p.mLeftMargin * scale, p.mRightMargin * scale); } CombinedMeshRenderer.Factory factory = lwf.rendererFactory as CombinedMeshRenderer.Factory; if (factory != null) { m_shouldBeOnTop = true; m_zOffset = Mathf.Abs(factory.zRate); } }
public UnityTextRenderer(LWF lwf, int objectId) : base(lwf) { Factory factory = lwf.rendererFactory as Factory; m_context = new TextContext( factory, factory.gameObject, lwf.data, objectId); m_matrix = new Matrix4x4(); m_renderMatrix = new Matrix4x4(); m_colorMult = new UnityEngine.Color(); m_colorAdd = new UnityEngine.Color(); if (m_context != null && m_context.systemFontRenderer != null) { ISystemFontRenderer.Parameter p = m_context.systemFontRendererParameter; float scale = lwf.scaleByStage; m_context.systemFontRenderer.Init( p.mSize * scale, p.mWidth * scale, p.mHeight * scale, p.mStyle, p.mAlign, p.mVerticalAlign, p.mLineSpacing * scale, p.mLetterSpacing * scale, p.mLeftMargin * scale, p.mRightMargin * scale); } CombinedMeshRenderer.Factory c = lwf.rendererFactory as CombinedMeshRenderer.Factory; if (c != null) { m_shouldBeOnTop = true; m_zOffset = Mathf.Abs(c.zRate); } }