コード例 #1
0
        private void BuildGrid()
        {
            int num  = 2;
            int num2 = 26 + num;
            int num3 = 0;

            for (int i = 0; i < _sorter.Steps.Count; i++)
            {
                if (!_sorter.Steps[i].HiddenFromSortOptions)
                {
                    num3++;
                }
            }
            UIPanel uIPanel = new UIPanel
            {
                Width  = new StyleDimension(126f, 0f),
                Height = new StyleDimension(num3 * num2 + 5 + 3, 0f),
                HAlign = 1f,
                VAlign = 0f,
                Left   = new StyleDimension(-118f, 0f),
                Top    = new StyleDimension(0f, 0f)
            };

            uIPanel.BorderColor     = new Color(89, 116, 213, 255) * 0.9f;
            uIPanel.BackgroundColor = new Color(73, 94, 171) * 0.9f;
            uIPanel.SetPadding(0f);
            Append(uIPanel);
            int num4 = 0;

            for (int j = 0; j < _sorter.Steps.Count; j++)
            {
                IBestiarySortStep bestiarySortStep = _sorter.Steps[j];
                if (!bestiarySortStep.HiddenFromSortOptions)
                {
                    GroupOptionButton <int> groupOptionButton = new GroupOptionButton <int>(j, Language.GetText(bestiarySortStep.GetDisplayNameKey()), null, Color.White, null, 0.8f)
                    {
                        Width  = new StyleDimension(114f, 0f),
                        Height = new StyleDimension(num2 - num, 0f),
                        HAlign = 0.5f,
                        Top    = new StyleDimension(5 + num2 * num4, 0f)
                    };
                    groupOptionButton.ShowHighlightWhenSelected = false;
                    groupOptionButton.OnClick += ClickOption;
                    groupOptionButton.SetSnapPoint("SortSteps", num4);
                    uIPanel.Append(groupOptionButton);
                    _buttonsBySorting.Add(groupOptionButton);
                    num4++;
                }
            }
            foreach (GroupOptionButton <int> item in _buttonsBySorting)
            {
                item.SetCurrentOption(-1);
            }
        }
コード例 #2
0
        private void BuildGrid()
        {
            int num1 = 2;
            int num2 = 26 + num1;
            int num3 = 0;

            for (int index = 0; index < this._sorter.Steps.Count; ++index)
            {
                if (!this._sorter.Steps[index].HiddenFromSortOptions)
                {
                    ++num3;
                }
            }
            UIPanel uiPanel1 = new UIPanel();

            uiPanel1.Width  = new StyleDimension(126f, 0.0f);
            uiPanel1.Height = new StyleDimension((float)(num3 * num2 + 5 + 3), 0.0f);
            uiPanel1.HAlign = 1f;
            uiPanel1.VAlign = 0.0f;
            uiPanel1.Left   = new StyleDimension(-118f, 0.0f);
            uiPanel1.Top    = new StyleDimension(0.0f, 0.0f);
            UIPanel uiPanel2 = uiPanel1;

            uiPanel2.BorderColor     = new Color(89, 116, 213, (int)byte.MaxValue) * 0.9f;
            uiPanel2.BackgroundColor = new Color(73, 94, 171) * 0.9f;
            uiPanel2.SetPadding(0.0f);
            this.Append((UIElement)uiPanel2);
            int id = 0;

            for (int option = 0; option < this._sorter.Steps.Count; ++option)
            {
                IBestiarySortStep step = this._sorter.Steps[option];
                if (!step.HiddenFromSortOptions)
                {
                    GroupOptionButton <int> groupOptionButton1 = new GroupOptionButton <int>(option, Language.GetText(step.GetDisplayNameKey()), (LocalizedText)null, Color.White, (string)null, 0.8f, 0.5f, 10f);
                    groupOptionButton1.Width  = new StyleDimension(114f, 0.0f);
                    groupOptionButton1.Height = new StyleDimension((float)(num2 - num1), 0.0f);
                    groupOptionButton1.HAlign = 0.5f;
                    groupOptionButton1.Top    = new StyleDimension((float)(5 + num2 * id), 0.0f);
                    GroupOptionButton <int> groupOptionButton2 = groupOptionButton1;
                    groupOptionButton2.ShowHighlightWhenSelected = false;
                    groupOptionButton2.OnClick += new UIElement.MouseEvent(this.ClickOption);
                    groupOptionButton2.SetSnapPoint("SortSteps", id, new Vector2?(), new Vector2?());
                    uiPanel2.Append((UIElement)groupOptionButton2);
                    this._buttonsBySorting.Add(groupOptionButton2);
                    ++id;
                }
            }
            foreach (GroupOptionButton <int> groupOptionButton in this._buttonsBySorting)
            {
                groupOptionButton.SetCurrentOption(-1);
            }
        }
コード例 #3
0
        public void UpdateAvailability()
        {
            GetDisplaySettings(out int widthPerButton, out int heightPerButton, out int widthWithSpacing, out int heightWithSpacing, out int perRow, out float offsetLeft, out float offsetTop, out int _);
            _container.RemoveAllChildren();
            _filterButtons.Clear();
            _areFiltersAvailable.Clear();
            int num  = -1;
            int num2 = -1;

            for (int i = 0; i < _filterer.AvailableFilters.Count; i++)
            {
                int num3 = i / perRow;
                int num4 = i % perRow;
                IBestiaryEntryFilter bestiaryEntryFilter = _filterer.AvailableFilters[i];
                List <BestiaryEntry> entries             = _filterAvailabilityTests[i];
                if (GetIsFilterAvailableForEntries(bestiaryEntryFilter, entries))
                {
                    GroupOptionButton <int> groupOptionButton = new GroupOptionButton <int>(i, null, null, Color.White, null)
                    {
                        Width  = new StyleDimension(widthPerButton, 0f),
                        Height = new StyleDimension(heightPerButton, 0f),
                        HAlign = 0f,
                        VAlign = 0f,
                        Top    = new StyleDimension(offsetTop + (float)(num3 * heightWithSpacing), 0f),
                        Left   = new StyleDimension(offsetLeft + (float)(num4 * widthWithSpacing), 0f)
                    };
                    groupOptionButton.OnClick += ClickOption;
                    groupOptionButton.SetSnapPoint("Filters", i);
                    groupOptionButton.ShowHighlightWhenSelected = false;
                    AddOnHover(bestiaryEntryFilter, groupOptionButton);
                    _container.Append(groupOptionButton);
                    UIElement image = bestiaryEntryFilter.GetImage();
                    if (image != null)
                    {
                        image.Left = new StyleDimension(num, 0f);
                        image.Top  = new StyleDimension(num2, 0f);
                        groupOptionButton.Append(image);
                    }
                    _filterButtons.Add(groupOptionButton);
                }
                else
                {
                    _filterer.ActiveFilters.Remove(bestiaryEntryFilter);
                    GroupOptionButton <int> groupOptionButton2 = new GroupOptionButton <int>(-2, null, null, Color.White, null)
                    {
                        Width         = new StyleDimension(widthPerButton, 0f),
                        Height        = new StyleDimension(heightPerButton, 0f),
                        HAlign        = 0f,
                        VAlign        = 0f,
                        Top           = new StyleDimension(offsetTop + (float)(num3 * heightWithSpacing), 0f),
                        Left          = new StyleDimension(offsetLeft + (float)(num4 * widthWithSpacing), 0f),
                        FadeFromBlack = 0.5f
                    };
                    groupOptionButton2.ShowHighlightWhenSelected = false;
                    groupOptionButton2.SetPadding(0f);
                    groupOptionButton2.SetSnapPoint("Filters", i);
                    Asset <Texture2D> obj           = Main.Assets.Request <Texture2D>("Images/UI/Bestiary/Icon_Tags_Shadow", (AssetRequestMode)1);
                    UIImageFramed     uIImageFramed = new UIImageFramed(obj, obj.Frame(16, 5, 0, 4))
                    {
                        HAlign = 0.5f,
                        VAlign = 0.5f,
                        Color  = Color.White * 0.2f
                    };
                    uIImageFramed.Left = new StyleDimension(num, 0f);
                    uIImageFramed.Top  = new StyleDimension(num2, 0f);
                    groupOptionButton2.Append(uIImageFramed);
                    _filterButtons.Add(groupOptionButton2);
                    _container.Append(groupOptionButton2);
                }
            }
            UpdateButtonSelections();
        }
コード例 #4
0
        public void UpdateAvailability()
        {
            int   widthPerButton;
            int   heightPerButton;
            int   widthWithSpacing;
            int   heightWithSpacing;
            int   perRow;
            float offsetLeft;
            float offsetTop;

            this.GetDisplaySettings(out widthPerButton, out heightPerButton, out widthWithSpacing, out heightWithSpacing, out perRow, out offsetLeft, out offsetTop, out int _);
            this._container.RemoveAllChildren();
            this._filterButtons.Clear();
            this._areFiltersAvailable.Clear();
            int num1 = -1;
            int num2 = -1;

            for (int index = 0; index < this._filterer.AvailableFilters.Count; ++index)
            {
                int num3 = index / perRow;
                int num4 = index % perRow;
                IBestiaryEntryFilter availableFilter  = this._filterer.AvailableFilters[index];
                List <BestiaryEntry> availabilityTest = this._filterAvailabilityTests[index];
                if (this.GetIsFilterAvailableForEntries(availableFilter, availabilityTest))
                {
                    GroupOptionButton <int> groupOptionButton1 = new GroupOptionButton <int>(index, (LocalizedText)null, (LocalizedText)null, Color.White, (string)null, 1f, 0.5f, 10f);
                    groupOptionButton1.Width  = new StyleDimension((float)widthPerButton, 0.0f);
                    groupOptionButton1.Height = new StyleDimension((float)heightPerButton, 0.0f);
                    groupOptionButton1.HAlign = 0.0f;
                    groupOptionButton1.VAlign = 0.0f;
                    groupOptionButton1.Top    = new StyleDimension(offsetTop + (float)(num3 * heightWithSpacing), 0.0f);
                    groupOptionButton1.Left   = new StyleDimension(offsetLeft + (float)(num4 * widthWithSpacing), 0.0f);
                    GroupOptionButton <int> groupOptionButton2 = groupOptionButton1;
                    groupOptionButton2.OnClick += new UIElement.MouseEvent(this.ClickOption);
                    groupOptionButton2.SetSnapPoint("Filters", index, new Vector2?(), new Vector2?());
                    groupOptionButton2.ShowHighlightWhenSelected = false;
                    this.AddOnHover(availableFilter, (UIElement)groupOptionButton2);
                    this._container.Append((UIElement)groupOptionButton2);
                    UIElement image = availableFilter.GetImage();
                    if (image != null)
                    {
                        image.Left = new StyleDimension((float)num1, 0.0f);
                        image.Top  = new StyleDimension((float)num2, 0.0f);
                        groupOptionButton2.Append(image);
                    }
                    this._filterButtons.Add(groupOptionButton2);
                }
                else
                {
                    this._filterer.ActiveFilters.Remove(availableFilter);
                    GroupOptionButton <int> groupOptionButton1 = new GroupOptionButton <int>(-2, (LocalizedText)null, (LocalizedText)null, Color.White, (string)null, 1f, 0.5f, 10f);
                    groupOptionButton1.Width         = new StyleDimension((float)widthPerButton, 0.0f);
                    groupOptionButton1.Height        = new StyleDimension((float)heightPerButton, 0.0f);
                    groupOptionButton1.HAlign        = 0.0f;
                    groupOptionButton1.VAlign        = 0.0f;
                    groupOptionButton1.Top           = new StyleDimension(offsetTop + (float)(num3 * heightWithSpacing), 0.0f);
                    groupOptionButton1.Left          = new StyleDimension(offsetLeft + (float)(num4 * widthWithSpacing), 0.0f);
                    groupOptionButton1.FadeFromBlack = 0.5f;
                    GroupOptionButton <int> groupOptionButton2 = groupOptionButton1;
                    groupOptionButton2.ShowHighlightWhenSelected = false;
                    groupOptionButton2.SetPadding(0.0f);
                    groupOptionButton2.SetSnapPoint("Filters", index, new Vector2?(), new Vector2?());
                    Asset <M0>    asset          = Main.Assets.Request <Texture2D>("Images/UI/Bestiary/Icon_Tags_Shadow", (AssetRequestMode)1);
                    UIImageFramed uiImageFramed1 = new UIImageFramed((Asset <Texture2D>)asset, ((Asset <Texture2D>)asset).Frame(16, 5, 0, 4, 0, 0));
                    uiImageFramed1.HAlign = 0.5f;
                    uiImageFramed1.VAlign = 0.5f;
                    uiImageFramed1.Color  = Color.White * 0.2f;
                    UIImageFramed uiImageFramed2 = uiImageFramed1;
                    uiImageFramed2.Left = new StyleDimension((float)num1, 0.0f);
                    uiImageFramed2.Top  = new StyleDimension((float)num2, 0.0f);
                    groupOptionButton2.Append((UIElement)uiImageFramed2);
                    this._filterButtons.Add(groupOptionButton2);
                    this._container.Append((UIElement)groupOptionButton2);
                }
            }
            this.UpdateButtonSelections();
        }