Esempio n. 1
0
        void TableCollectionSelected(LocalizationTableCollection ltc)
        {
            m_TableContents.Clear();

            if (m_CurrentEditor != null)
            {
                m_CurrentEditor.OnDisable();
            }

            if (ltc == null || ltc.TableType == null)
            {
                return;
            }

            var editorType = GetEditorTypeForCollection(ltc.GetType());

            if (editorType == null)
            {
                return;
            }

            m_CurrentEditor = (TableEditor)Activator.CreateInstance(editorType);
            m_CurrentEditor.TableCollection = ltc;
            m_TableContents.Add(m_CurrentEditor);
            m_CurrentEditor.StretchToParentSize();
            m_CurrentEditor.OnEnable();
        }
        void Init(SerializedProperty property)
        {
            if (m_PlatformOverridesList == null)
            {
                m_PlatformOverridesList = new ReorderableList(property.serializedObject, property.FindPropertyRelative("m_PlatformOverrides"))
                {
                    drawElementCallback   = DrawListElement,
                    drawHeaderCallback    = DrawListHeader,
                    onAddDropdownCallback = DrawAddDropdown,
                    elementHeightCallback = GetHeight
                };

                var             target          = m_PlatformOverridesList.serializedProperty.serializedObject.targetObject;
                SharedTableData sharedTableData = target as SharedTableData ?? (target as LocalizationTable)?.SharedData;
                Debug.Assert(sharedTableData != null, "Shared Table Data is null. Platform Override can only be used on a Shared Table Entry.");
                m_Collection = LocalizationEditorSettings.GetCollectionForSharedTableData(sharedTableData);
                m_TableType  = m_Collection.GetType() == typeof(StringTableCollection) ? typeof(StringTable) : typeof(AssetTable);
            }
        }
Esempio n. 3
0
        void ResolveTableCollection()
        {
            m_PossibleTableCollection.Clear();
            m_Collection = LocalizationEditorSettings.GetCollectionFromTable(m_TargetTable);

            if (m_TargetTable.SharedData == null)
            {
                return;
            }

            m_SharedTableDataSerializedObject = new SerializedObject(m_TargetTable.SharedData);
            m_TableCollectionName             = m_SharedTableDataSerializedObject.FindProperty("m_TableCollectionName");

            if (m_Collection != null)
            {
                m_CollectionButton = new GUIContent("Select Collection", EditorGUIUtility.ObjectContent(m_Collection, m_Collection.GetType()).image);
                return;
            }

            m_SharedTableDataCollection = LocalizationEditorSettings.GetCollectionForSharedTableData(m_TargetTable.SharedData);
            if (m_SharedTableDataCollection != null)
            {
                return;
            }

            LocalizationEditorSettings.FindLooseStringTablesUsingSharedTableData(m_TargetTable.SharedData, m_PossibleTableCollection);
        }