Example #1
0
        List <Locale> GetSelectedLocales()
        {
            var           locales         = LocalizationAddressableSettings.GetLocales();
            List <Locale> selectedLocales = new List <Locale>();

            for (int i = 0; i < m_LocalesList.contentContainer.childCount; ++i)
            {
                var toggle = m_LocalesList.contentContainer.ElementAt(i) as Toggle;
                if (toggle != null && toggle.value)
                {
                    Debug.Assert(locales[i].name == toggle.text, string.Format("Expected locale to match toggle. Expected {0} but got {1}", locales[i].name, toggle.name));
                    selectedLocales.Add(locales[i]);
                }
            }

            return(selectedLocales);
        }
Example #2
0
        public AssetTablesGenerator()
        {
            var root = Resources.GetTemplate("AssetTablesGenerator");

            Add(root);
            root.StretchToParentSize();

            var locales = LocalizationAddressableSettings.GetLocales();

            m_LocalesList = root.Q <ScrollView>("localesList");
            foreach (var locale in locales)
            {
                m_LocalesList.Add(new Toggle()
                {
                    text = locale.name, value = true
                });
            }

            root.Q <Button>("createTableButton").clickable.clicked += CreateTables;
            root.Q <Button>("selectAllLocales").clickable.clicked  += () => SelectAllLocales(true);
            root.Q <Button>("selectNoLocales").clickable.clicked   += () => SelectAllLocales(false);
            m_TableType = root.Q <AssetTableTypeField>();
            m_TableName = root.Q <TextField>("newTableName");
        }