Example #1
0
        protected virtual void InitializeColumns()
        {
            showBorder = true;
            showAlternatingRowBackgrounds = true;
            var columns = new MultiColumnHeaderState.Column[Tables.Count + 1];

            columns[0] = new MultiColumnHeaderState.Column()
            {
                headerContent         = new GUIContent("Key"),
                headerTextAlignment   = TextAlignment.Center,
                canSort               = true,
                allowToggleVisibility = false,
                sortedAscending       = true
            };

            // Update column labels if possible
            var locales = LocalizationAddressableSettings.GetLocales();

            for (int i = 0; i < Tables.Count; ++i)
            {
                var foundLocale = locales.FirstOrDefault(o => o.Identifier.Code == Tables[i].LocaleIdentifier.Code);
                columns[i + 1] = new MultiColumnHeaderState.Column()
                {
                    headerContent         = new GUIContent(foundLocale != null ? foundLocale.name : Tables[i].LocaleIdentifier.Code),
                    headerTextAlignment   = TextAlignment.Center,
                    canSort               = false, // TODO: Support sorting
                    allowToggleVisibility = true,
                };
            }

            var multiColState = new MultiColumnHeaderState(columns);

            multiColumnHeader = new MultiColumnHeader(multiColState);
            multiColumnHeader.ResizeToFit();
        }
Example #2
0
        protected override TreeViewItem BuildRoot()
        {
            TreeViewItem root = new TreeViewItem(-1, -1, "root");

            var items = new List <TreeViewItem>();

            foreach (var l in LocalizationAddressableSettings.GetLocales())
            {
                items.Add(new SerializedLocaleItem(l));
            }

            ApplySorting(items);

            for (int i = 0; i < items.Count; ++i)
            {
                items[i].id = i;
            }

            SetupParentsAndChildrenFromDepths(root, items);
            return(root);
        }