private void RemoveLocale(LocalizedAssetBase localizedAsset, LocaleItemBase localeItem) { if (LocalizedAssetEditor.RemoveLocale(localizedAsset, localeItem)) { m_TreeView.Reload(); } }
private void RemoveLocale(LocalizedAssetBase localizedAsset, LocaleItemBase localeItem) { var serializedObject = new SerializedObject(localizedAsset); serializedObject.Update(); var elements = serializedObject.FindProperty(LocalizationEditorHelper.LocalizedElementsSerializedProperty); if (elements != null && elements.arraySize > 1) { var localeItemIndex = Array.IndexOf(localizedAsset.LocaleItems, localeItem); elements.DeleteArrayElementAtIndex(localeItemIndex); serializedObject.ApplyModifiedProperties(); m_TreeView.Reload(); } }
private void MakeLocaleDefault(LocalizedAssetBase localizedAsset, LocaleItemBase localeItem) { var serializedObject = new SerializedObject(localizedAsset); serializedObject.Update(); var elements = serializedObject.FindProperty(LocalizationEditorHelper.LocalizedElementsSerializedProperty); if (elements != null && elements.arraySize > 1) { var defaultLanguage = localeItem.Language; var localeItemIndex = Array.IndexOf(localizedAsset.LocaleItems, localeItem); elements.MoveArrayElement(localeItemIndex, 0); serializedObject.ApplyModifiedProperties(); m_TreeView.Reload(); Debug.Log(localizedAsset.name + ":" + defaultLanguage + " was set as the default language."); } }
/// <summary> /// Removes specified locale item from the list. /// </summary> public static bool RemoveLocale(LocalizedAssetBase localizedAsset, LocaleItemBase localeItem) { var serializedObject = new SerializedObject(localizedAsset); serializedObject.Update(); var elements = serializedObject.FindLocaleItemsProperty(); if (elements != null && elements.arraySize > 1) { var index = Array.IndexOf(localizedAsset.LocaleItems, localeItem); if (index >= 0) { elements.DeleteArrayElementAtIndex(index); serializedObject.ApplyModifiedProperties(); return(true); } } return(false); }
public LocaleTreeViewItem(int id, int depth, LocaleItemBase localeItem, AssetTreeViewItem parent) : base(id, depth, "") { LocaleItem = localeItem; Parent = parent; }