Beispiel #1
0
        protected void PopulateTabContainer(UITabstrip tabstrip)
        {
            // Parse all the available sounds first
            var sliders = new Dictionary <string, Dictionary <string, List <ISound> > >();

            foreach (var sound in SoundManager.instance.Sounds.Values)
            {
                if ((DlcUtils.InstalledDlcs & sound.RequiredDlc) != sound.RequiredDlc)
                {
                    continue;
                }

                if (!sliders.ContainsKey(sound.CategoryName))
                {
                    sliders.Add(sound.CategoryName, new Dictionary <string, List <ISound> >());
                }
                if (!sliders[sound.CategoryName].ContainsKey(sound.SubCategoryName))
                {
                    sliders[sound.CategoryName].Add(sound.SubCategoryName, new List <ISound>());
                }
                sliders[sound.CategoryName][sound.SubCategoryName].Add(sound);
            }

            // Populate the tab container
            int buttonWidth = (int)(tabstrip.tabPages.width / sliders.Count);

            foreach (var tabGroup in sliders)
            {
                UIHelper tabHelper = this.RootHelper.AddScrollingTab(tabstrip, buttonWidth, tabGroup.Key);
                foreach (var group in tabGroup.Value)
                {
                    UIHelper groupHelper = tabHelper.AddGroup2(group.Key);
                    ((UIComponent)groupHelper.self).parent.width -= 10; // Fix some overlap with the scrollbar
                    ((UIComponent)groupHelper.self).width        -= 10; // Fix some overlap with the scrollbar
                    foreach (var sound in group.Value)
                    {
                        this.CreateSoundSlider(groupHelper, sound);
                    }
                }
            }
        }