private void OnLocaleItemContextMenu(AssetTreeViewItem assetTreeViewItem, LocaleTreeViewItem localeTreeViewItem) { Debug.Assert(assetTreeViewItem != null); Debug.Assert(localeTreeViewItem != null); var menu = new GenericMenu(); menu.AddItem(new GUIContent("Make default"), false, LocaleItemContextMenu_MakeDefault); menu.AddItem(new GUIContent("Remove"), false, LocaleItemContextMenu_Remove); menu.ShowAsContext(); }
private void TryGetSelectedTreeViewItem(out AssetTreeViewItem assetTreeViewItem, out LocaleTreeViewItem localeTreeViewItem) { var selectedItem = m_TreeView.GetSelectedItem(); assetTreeViewItem = selectedItem as AssetTreeViewItem; localeTreeViewItem = selectedItem as LocaleTreeViewItem; if (assetTreeViewItem == null && selectedItem != null) { assetTreeViewItem = ((LocaleTreeViewItem)selectedItem).Parent; } }
private void MakeLocaleDefault(AssetTreeViewItem assetTreeViewItem, LocaleTreeViewItem localeTreeViewItem) { var localizedAsset = assetTreeViewItem.LocalizedAsset; var language = localeTreeViewItem.LocaleItem.Language; var serializedObject = new SerializedObject(localizedAsset); serializedObject.Update(); var elements = serializedObject.FindLocaleItemsProperty(); if (elements != null && elements.arraySize > 1) { var index = Array.FindIndex(localizedAsset.LocaleItems, x => x.Language == language); if (index >= 0) { language = new Language(language); elements.MoveArrayElement(index, 0); serializedObject.ApplyModifiedProperties(); m_TreeView.Reload(); Debug.Log(localizedAsset.name + ":" + language + " was set as the default language."); } } }
private void RenameLocalizedAsset(AssetTreeViewItem assetTreeViewItem) { Debug.Assert(assetTreeViewItem != null); m_TreeView.BeginRename(assetTreeViewItem); }
private void RevealLocalizedAsset(AssetTreeViewItem assetTreeViewItem) { Debug.Assert(assetTreeViewItem != null); EditorGUIUtility.PingObject(assetTreeViewItem.LocalizedAsset); }
public LocaleTreeViewItem(int id, int depth, LocaleItemBase localeItem, AssetTreeViewItem parent) : base(id, depth, "") { LocaleItem = localeItem; Parent = parent; }