public void LateUpdate() { #region 字体花屏处理 if (null == m_RebuildForFont) { return; } for (int i = 0; i < m_FontUpdateList.Count; i++) { FontUpdateNode node = m_FontUpdateList[i]; if (node.NeedUpdate) { Font font = node.font; m_RebuildForFont.Invoke(null, new object[] { font }); // Log rebuild. Texture fontTexture = font.material.mainTexture; Trace.Log(string.Format("动态字体: \"{0}\" 的纹理大小更新为 {1}x{2}.", font.name, fontTexture.width, fontTexture.height)); node.Invalidate(); } } #endregion }
private void OnFontTextureRebuilt(Font font) { bool findThisFont = false; for (int i = 0; i < m_FontUpdateList.Count; i++) { FontUpdateNode node = m_FontUpdateList[i]; if (node.font == font) { node.Validate(); findThisFont = true; break; } } if (!findThisFont) { m_FontUpdateList.Add(new FontUpdateNode(font)); } }
// Update is called once per frame void LateUpdate() { if (null == m_RebuildForFont) { return; } for (int i = 0; i < m_FontUpdateList.Count; i++) { FontUpdateNode node = m_FontUpdateList[i]; if (node.NeedUpdate) { Font font = node.font; m_RebuildForFont.Invoke(null, new object[] { font }); // Log rebuild. //Texture fontTexture = font.material.mainTexture; //Debug.Log(HobaString.Format("Texture of dynamic font \"{0}\" is enlarged to {1}x{2}.", font.name, fontTexture.width, fontTexture.height)); node.Invalidate(); } } }