コード例 #1
0
 private void RemoveLocale(LocalizedAssetBase localizedAsset, LocaleItemBase localeItem)
 {
     if (LocalizedAssetEditor.RemoveLocale(localizedAsset, localeItem))
     {
         m_TreeView.Reload();
     }
 }
コード例 #2
0
        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();
            }
        }
コード例 #3
0
        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.");
            }
        }
コード例 #4
0
        /// <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);
        }
コード例 #5
0
 public LocaleTreeViewItem(int id, int depth, LocaleItemBase localeItem, AssetTreeViewItem parent)
     : base(id, depth, "")
 {
     LocaleItem = localeItem;
     Parent     = parent;
 }