Add() public method

public Add ( UIElement item ) : void
item Terraria.UI.UIElement
return void
        private void BuildInfinitesMenuContents(UIElement totalContainer)
        {
            UIPanel basicPanel = UICreativeInfiniteItemsDisplay.CreateBasicPanel();

            totalContainer.Append((UIElement)basicPanel);
            basicPanel.OnUpdate    += new UIElement.ElementEvent(this.Hover_OnUpdate);
            basicPanel.OnMouseOver += new UIElement.MouseEvent(this.Hover_OnMouseOver);
            basicPanel.OnMouseOut  += new UIElement.MouseEvent(this.Hover_OnMouseOut);
            UIDynamicItemCollection dynamicItemCollection = new UIDynamicItemCollection();

            this._itemGrid = dynamicItemCollection;
            UIElement uiElement = new UIElement()
            {
                Height = new StyleDimension(24f, 0.0f),
                Width  = new StyleDimension(0.0f, 1f)
            };

            uiElement.SetPadding(0.0f);
            basicPanel.Append(uiElement);
            this.AddSearchBar(uiElement);
            this._searchBar.SetContents((string)null, true);
            UIList uiList1 = new UIList();

            uiList1.Width  = new StyleDimension(-25f, 1f);
            uiList1.Height = new StyleDimension(-28f, 1f);
            uiList1.VAlign = 1f;
            uiList1.HAlign = 0.0f;
            UIList uiList2 = uiList1;

            basicPanel.Append((UIElement)uiList2);
            float       num         = 4f;
            UIScrollbar uiScrollbar = new UIScrollbar();

            uiScrollbar.Height = new StyleDimension((float)(-28.0 - (double)num * 2.0), 1f);
            uiScrollbar.Top    = new StyleDimension(-num, 0.0f);
            uiScrollbar.VAlign = 1f;
            uiScrollbar.HAlign = 1f;
            UIScrollbar scrollbar = uiScrollbar;

            basicPanel.Append((UIElement)scrollbar);
            uiList2.SetScrollbar(scrollbar);
            uiList2.Add((UIElement)dynamicItemCollection);
            UICreativeItemsInfiniteFilteringOptions filteringOptions = new UICreativeItemsInfiniteFilteringOptions(this._filterer, "CreativeInfinitesFilter");

            filteringOptions.OnClickingOption += new Action(this.filtersHelper_OnClickingOption);
            filteringOptions.Left              = new StyleDimension(20f, 0.0f);
            totalContainer.Append((UIElement)filteringOptions);
            filteringOptions.OnUpdate    += new UIElement.ElementEvent(this.Hover_OnUpdate);
            filteringOptions.OnMouseOver += new UIElement.MouseEvent(this.Hover_OnMouseOver);
            filteringOptions.OnMouseOut  += new UIElement.MouseEvent(this.Hover_OnMouseOut);
        }
Esempio n. 2
0
        private void AddInfoToList(BestiaryEntry entry, ExtraBestiaryInfoPageInformation extraInfo)
        {
            BestiaryUICollectionInfo uICollectionInfo = GetUICollectionInfo(entry, extraInfo);
            IOrderedEnumerable <IGrouping <BestiaryInfoCategory, IBestiaryInfoElement> > orderedEnumerable = from x in new List <IBestiaryInfoElement>(entry.Info).GroupBy(GetBestiaryInfoCategory)
                                                                                                             orderby x.Key
                                                                                                             select x;
            UIElement item = null;

            foreach (IGrouping <BestiaryInfoCategory, IBestiaryInfoElement> item2 in orderedEnumerable)
            {
                if (item2.Count() == 0)
                {
                    continue;
                }
                bool flag = false;
                foreach (IBestiaryInfoElement item3 in item2)
                {
                    UIElement uIElement = item3.ProvideUIElement(uICollectionInfo);
                    if (uIElement != null)
                    {
                        _list.Add(uIElement);
                        flag = true;
                    }
                }
                if (flag)
                {
                    UIHorizontalSeparator uIHorizontalSeparator = new UIHorizontalSeparator
                    {
                        Width = StyleDimension.FromPixelsAndPercent(0f, 1f),
                        Color = new Color(89, 116, 213, 255) * 0.9f
                    };
                    _list.Add(uIHorizontalSeparator);
                    item = uIHorizontalSeparator;
                }
            }
            _list.Remove(item);
        }
        private void BuildInfinitesMenuContents(UIElement totalContainer)
        {
            UIPanel uIPanel = CreateBasicPanel();

            totalContainer.Append(uIPanel);
            uIPanel.OnUpdate    += Hover_OnUpdate;
            uIPanel.OnMouseOver += Hover_OnMouseOver;
            uIPanel.OnMouseOut  += Hover_OnMouseOut;
            UIDynamicItemCollection item = _itemGrid = new UIDynamicItemCollection();
            UIElement uIElement          = new UIElement
            {
                Height = new StyleDimension(24f, 0f),
                Width  = new StyleDimension(0f, 1f)
            };

            uIElement.SetPadding(0f);
            uIPanel.Append(uIElement);
            AddSearchBar(uIElement);
            _searchBar.SetContents(null, forced: true);
            UIList uIList = new UIList
            {
                Width  = new StyleDimension(-25f, 1f),
                Height = new StyleDimension(-28f, 1f),
                VAlign = 1f,
                HAlign = 0f
            };

            uIPanel.Append(uIList);
            float       num         = 4f;
            UIScrollbar uIScrollbar = new UIScrollbar
            {
                Height = new StyleDimension(-28f - num * 2f, 1f),
                Top    = new StyleDimension(0f - num, 0f),
                VAlign = 1f,
                HAlign = 1f
            };

            uIPanel.Append(uIScrollbar);
            uIList.SetScrollbar(uIScrollbar);
            uIList.Add(item);
            UICreativeItemsInfiniteFilteringOptions uICreativeItemsInfiniteFilteringOptions = new UICreativeItemsInfiniteFilteringOptions(_filterer, "CreativeInfinitesFilter");

            uICreativeItemsInfiniteFilteringOptions.OnClickingOption += filtersHelper_OnClickingOption;
            uICreativeItemsInfiniteFilteringOptions.Left              = new StyleDimension(20f, 0f);
            totalContainer.Append(uICreativeItemsInfiniteFilteringOptions);
            uICreativeItemsInfiniteFilteringOptions.OnUpdate    += Hover_OnUpdate;
            uICreativeItemsInfiniteFilteringOptions.OnMouseOver += Hover_OnMouseOver;
            uICreativeItemsInfiniteFilteringOptions.OnMouseOut  += Hover_OnMouseOut;
        }
Esempio n. 4
0
        public override void OnInitialize()
        {
            UIElement element1 = new UIElement();
            element1.Width.Set(0.0f, 0.8f);
            element1.MaxWidth.Set(800f, 0.0f);
            element1.MinWidth.Set(600f, 0.0f);
            element1.Top.Set(220f, 0.0f);
            element1.Height.Set(-220f, 1f);
            element1.HAlign = 0.5f;
            _outerContainer = element1;
            Append(element1);
            UIPanel uiPanel = new UIPanel();
            uiPanel.Width.Set(0.0f, 1f);
            uiPanel.Height.Set(-110f, 1f);
            uiPanel.BackgroundColor = new Color(33, 43, 79) * 0.8f;
            uiPanel.PaddingTop = 0.0f;
            element1.Append(uiPanel);
            _achievementsList = new UIList();
            _achievementsList.Width.Set(-25f, 1f);
            _achievementsList.Height.Set(-50f, 1f);
            _achievementsList.Top.Set(50f, 0.0f);
            _achievementsList.ListPadding = 5f;
            uiPanel.Append(_achievementsList);
            UITextPanel uiTextPanel1 = new UITextPanel("Achievements", 1f, true);
            uiTextPanel1.HAlign = 0.5f;
            uiTextPanel1.Top.Set(-33f, 0.0f);
            uiTextPanel1.SetPadding(13f);
            uiTextPanel1.BackgroundColor = new Color(73, 94, 171);
            element1.Append(uiTextPanel1);
            UITextPanel uiTextPanel2 = new UITextPanel("Back", 0.7f, true);
            uiTextPanel2.Width.Set(-10f, 0.5f);
            uiTextPanel2.Height.Set(50f, 0.0f);
            uiTextPanel2.VAlign = 1f;
            uiTextPanel2.HAlign = 0.5f;
            uiTextPanel2.Top.Set(-45f, 0.0f);
            uiTextPanel2.OnMouseOver += new UIElement.MouseEvent(FadedMouseOver);
            uiTextPanel2.OnMouseOut += new UIElement.MouseEvent(FadedMouseOut);
            uiTextPanel2.OnClick += new UIElement.MouseEvent(GoBackClick);
            element1.Append(uiTextPanel2);
            List<Achievement> achievementsList = Main.Achievements.CreateAchievementsList();
            for (int index = 0; index < achievementsList.Count; ++index)
            {
                UIAchievementListItem achievementListItem = new UIAchievementListItem(achievementsList[index]);
                _achievementsList.Add((UIElement)achievementListItem);
                _achievementElements.Add(achievementListItem);
            }

            UIScrollbar scrollbar = new UIScrollbar();
            scrollbar.SetView(100f, 1000f);
            scrollbar.Height.Set(-50f, 1f);
            scrollbar.Top.Set(50f, 0.0f);
            scrollbar.HAlign = 1f;
            uiPanel.Append((UIElement)scrollbar);
            _achievementsList.SetScrollbar(scrollbar);
            UIElement element2 = new UIElement();
            element2.Width.Set(0.0f, 1f);
            element2.Height.Set(32f, 0.0f);
            element2.Top.Set(10f, 0.0f);
            Texture2D texture = TextureManager.Load("Images/UI/Achievement_Categories");
            for (int index = 0; index < 4; ++index)
            {
                UIToggleImage uiToggleImage = new UIToggleImage(texture, 32, 32, new Point(34 * index, 0), new Point(34 * index, 34));
                uiToggleImage.Left.Set((float)(index * 36 + 8), 0.0f);
                uiToggleImage.SetState(true);
                uiToggleImage.OnClick += new UIElement.MouseEvent(FilterList);
                _categoryButtons.Add(uiToggleImage);
                element2.Append((UIElement)uiToggleImage);
            }
            uiPanel.Append(element2);
        }