Beispiel #1
0
        public UICreativeItemsInfiniteFilteringOptions(EntryFilterer <Item, IItemEntryFilter> filterer, string snapPointsName)
        {
            _filterer = filterer;
            int num   = 40;
            int count = _filterer.AvailableFilters.Count;
            int num2  = num * count;

            Height = new StyleDimension(num, 0f);
            Width  = new StyleDimension(num2, 0f);
            Top    = new StyleDimension(4f, 0f);
            SetPadding(0f);
            Asset <Texture2D> val = Main.Assets.Request <Texture2D>("Images/UI/Creative/Infinite_Tabs_B", (AssetRequestMode)1);

            for (int i = 0; i < _filterer.AvailableFilters.Count; i++)
            {
                IItemEntryFilter itemEntryFilter = _filterer.AvailableFilters[i];
                val.Frame(2, 4).OffsetSize(-2, -2);
                UIImageFramed uIImageFramed = new UIImageFramed(val, val.Frame(2, 4).OffsetSize(-2, -2));
                uIImageFramed.Left.Set(num * i, 0f);
                uIImageFramed.OnClick     += singleFilterButtonClick;
                uIImageFramed.OnMouseOver += button_OnMouseOver;
                uIImageFramed.SetPadding(0f);
                uIImageFramed.SetSnapPoint(snapPointsName, i);
                AddOnHover(itemEntryFilter, uIImageFramed, i);
                UIElement image = itemEntryFilter.GetImage();
                image.IgnoresMouseInteraction = true;
                image.Left   = new StyleDimension(6f, 0f);
                image.HAlign = 0f;
                uIImageFramed.Append(image);
                _filtersByButtons[uIImageFramed] = itemEntryFilter;
                _iconsByButtons[uIImageFramed]   = image;
                Append(uIImageFramed);
                UpdateVisuals(uIImageFramed, i);
            }
        }
        public UICreativeItemsInfiniteFilteringOptions(
            EntryFilterer <Item, IItemEntryFilter> filterer,
            string snapPointsName)
        {
            this._filterer = filterer;
            int num1  = 40;
            int count = this._filterer.AvailableFilters.Count;
            int num2  = num1 * count;

            this.Height = new StyleDimension((float)num1, 0.0f);
            this.Width  = new StyleDimension((float)num2, 0.0f);
            this.Top    = new StyleDimension(4f, 0.0f);
            this.SetPadding(0.0f);
            Asset <Texture2D> asset = (Asset <Texture2D>)Main.Assets.Request <Texture2D>("Images/UI/Creative/Infinite_Tabs_B", (AssetRequestMode)1);

            for (int index = 0; index < this._filterer.AvailableFilters.Count; ++index)
            {
                IItemEntryFilter availableFilter = this._filterer.AvailableFilters[index];
                asset.Frame(2, 4, 0, 0, 0, 0).OffsetSize(-2, -2);
                UIImageFramed button = new UIImageFramed(asset, asset.Frame(2, 4, 0, 0, 0, 0).OffsetSize(-2, -2));
                button.Left.Set((float)(num1 * index), 0.0f);
                button.OnClick     += new UIElement.MouseEvent(this.singleFilterButtonClick);
                button.OnMouseOver += new UIElement.MouseEvent(this.button_OnMouseOver);
                button.SetPadding(0.0f);
                button.SetSnapPoint(snapPointsName, index, new Vector2?(), new Vector2?());
                this.AddOnHover(availableFilter, (UIElement)button, index);
                UIElement image = availableFilter.GetImage();
                image.IgnoresMouseInteraction = true;
                image.Left   = new StyleDimension(6f, 0.0f);
                image.HAlign = 0.0f;
                button.Append(image);
                this._filtersByButtons[button] = availableFilter;
                this._iconsByButtons[button]   = image;
                this.Append((UIElement)button);
                this.UpdateVisuals(button, index);
            }
        }