public void SetTextRenderer(string fullPath, string textName, string text, TextRenderer textRenderer) { bool setText = false; string fullName = fullPath + "." + textName; TextDictionaryItem item; if (m_textDictionary.TryGetValue(fullName, out item)) { item.renderer = textRenderer; if (!String.IsNullOrEmpty(item.text)) { textRenderer.SetText(item.text); setText = true; } } else { m_textDictionary[fullName] = new TextDictionaryItem(text, textRenderer); } if (m_textDictionary.TryGetValue(textName, out item)) { item.renderer = textRenderer; if (!setText && !String.IsNullOrEmpty(item.text)) { textRenderer.SetText(item.text); setText = true; } } else { m_textDictionary[textName] = new TextDictionaryItem(text, textRenderer); } if (!setText) textRenderer.SetText(text); }
public TextDictionaryItem(string t, TextRenderer r) { text = t; renderer = r; }