コード例 #1
0
        void TableCollectionNameChanged(ChangeEvent <string> evt)
        {
            m_TableNameHelpBox?.RemoveFromHierarchy();

            if (TableCollection.TableCollectionName == evt.newValue)
            {
                return;
            }

            var tableNameError = LocalizationEditorSettings.Instance.IsTableNameValid(TableCollection.GetType(), evt.newValue);

            if (tableNameError != null)
            {
                m_TableNameHelpBox = HelpBoxFactory.CreateDefaultHelpBox(tableNameError);
                m_TableNameHelpBoxContainer.Add(m_TableNameHelpBox);
                return;
            }

            TableCollection.SetTableCollectionName(evt.newValue, true);

            // Force the label to update itself.
            var atf = FindTablesPopup();

            atf?.RefreshLabels();
        }
コード例 #2
0
        void UpdateCreateButtonState()
        {
            RemoveHelpBoxes();

            var atLeastOneActiveLocale = m_LocalesList.Children().Any(it => it.Q <Toggle>().value);
            var tableNameError         = LocalizationEditorSettings.Instance.IsTableNameValid(m_CollectionTypePopup.value, m_TableCollectionName?.value);

            var createEnabled = atLeastOneActiveLocale && tableNameError == null;

            if (!createEnabled)
            {
                if (!atLeastOneActiveLocale)
                {
                    m_LocaleHelpBoxContainer.Add(m_LocaleHelpBox);
                }
                if (tableNameError != null)
                {
                    m_TableNameHelpBox = HelpBoxFactory.CreateDefaultHelpBox(tableNameError);
                    m_TableNameHelpBoxContainer.Add(m_TableNameHelpBox);
                }
            }
            m_CreateTableCollectionButton.SetEnabled(createEnabled);
        }