public static string GetTextForTag(LanguageTags tag) { if (m_loadedLanguageFile is null) { return(""); } string returnText = m_loadedLanguageFile.GetEntryText(tag.ToString()); if (string.IsNullOrEmpty(returnText)) { return("[" + tag.ToString() + "]"); } return(returnText); }
private void DrawLanguageContent() { if (m_canRemoveTagsFromDict) { m_deleteTagList.ForEach(tag => { if (m_categorysAndTagsList.ContainsKey(GetUntilOrEmpty(tag))) { if (m_categorysAndTagsList[GetUntilOrEmpty(tag)].Count == 1) { m_categorysAndTagsList.Remove(GetUntilOrEmpty(tag)); } else { m_categorysAndTagsList[GetUntilOrEmpty(tag)].Remove(tag); } } }); m_canRemoveTagsFromDict = false; m_selectedIndexCategoryForTags = 0; } if (m_categorysAndTagsList.Count == 0) { return; } m_selectedIndexCategoryForTags = EditorGUILayout.Popup("Category", m_selectedIndexCategoryForTags, m_categorysAndTagsList.Keys.ToArray(), GUILayout.Width(TAG_HEADER_TAG_WIDTH - 20)); if (m_selectedIndexCategoryForTags >= m_categorysAndTagsList.Count) { m_selectedIndexCategoryForTags = 0; } if (m_categorysAndTagsList.Count == 0) { return; } EditorGUI.indentLevel++; float contentTextSize = Mathf.Clamp(((position.width - TAG_HEADER_TAG_WIDTH) / 2), 100f, 9999f); m_categorysAndTagsList.ElementAt(m_selectedIndexCategoryForTags).Value.ForEach(tag => { EditorGUILayout.BeginHorizontal(); if (GUILayout.Button("-", GUILayout.MaxWidth(20))) { m_deleteTagList.Add(tag); m_newTagList.Remove(tag); m_englishFile.RemoveEntry(tag); m_canRemoveTagsFromDict = true; isDirtyTags = true; return; } if (!m_canRemoveTagsFromDict && m_englishFile.Exists(tag)) { EditorGUILayout.SelectableLabel(tag, GUILayout.Height(15), GUILayout.Width(TAG_HEADER_TAG_WIDTH - 50)); LanguageFileEntry englishEntry = m_englishFile.GetEntry(tag); string areaText = EditorGUILayout.TextArea(m_englishFile.GetEntryText(tag), GUILayout.Width(contentTextSize)); if (!englishEntry.textContent.Equals(areaText)) { isDirtyEng = true; } englishEntry.textContent = areaText; m_englishFile.SetEntry(tag, englishEntry); if (m_secondLanguageFile.fileLanguage != Languages.English && m_secondLanguageFile.Exists(tag)) { LanguageFileEntry secondEntry = m_secondLanguageFile.GetEntry(tag); string areaText2 = EditorGUILayout.TextArea(m_secondLanguageFile.GetEntryText(tag), GUILayout.Width(contentTextSize)); if (!secondEntry.textContent.Equals(areaText2)) { isDirtySecond = true; } secondEntry.textContent = areaText2; m_secondLanguageFile.SetEntry(tag, secondEntry); } } EditorGUILayout.EndHorizontal(); }); EditorGUI.indentLevel--; }