public PowerStripUIElement(string gamepadGroupName, List <UIElement> buttons)
        {
            _buttonsBySorting      = new List <UIElement>(buttons);
            _gamepadPointGroupname = gamepadGroupName;
            int     count   = buttons.Count;
            int     num     = 4;
            int     num2    = 40;
            int     num3    = 40;
            int     num4    = num3 + num;
            UIPanel uIPanel = new UIPanel
            {
                Width  = new StyleDimension(num2 + num * 2, 0f),
                Height = new StyleDimension(num3 * count + num * (1 + count), 0f)
            };

            SetPadding(0f);
            Width  = uIPanel.Width;
            Height = uIPanel.Height;
            uIPanel.BorderColor     = new Color(89, 116, 213, 255) * 0.9f;
            uIPanel.BackgroundColor = new Color(73, 94, 171) * 0.9f;
            uIPanel.SetPadding(0f);
            Append(uIPanel);
            for (int i = 0; i < count; i++)
            {
                UIElement uIElement = buttons[i];
                uIElement.HAlign = 0.5f;
                uIElement.Top    = new StyleDimension(num + num4 * i, 0f);
                uIElement.SetSnapPoint(_gamepadPointGroupname, i);
                uIPanel.Append(uIElement);
                _buttonsBySorting.Add(uIElement);
            }
        }
예제 #2
0
        public PowerStripUIElement(string gamepadGroupName, List <UIElement> buttons)
        {
            this._buttonsBySorting      = new List <UIElement>((IEnumerable <UIElement>)buttons);
            this._gamepadPointGroupname = gamepadGroupName;
            int     count    = buttons.Count;
            int     num1     = 4;
            int     num2     = 40;
            int     num3     = 40;
            int     num4     = num3 + num1;
            UIPanel uiPanel1 = new UIPanel();

            uiPanel1.Width  = new StyleDimension((float)(num2 + num1 * 2), 0.0f);
            uiPanel1.Height = new StyleDimension((float)(num3 * count + num1 * (1 + count)), 0.0f);
            UIPanel uiPanel2 = uiPanel1;

            this.SetPadding(0.0f);
            this.Width               = uiPanel2.Width;
            this.Height              = uiPanel2.Height;
            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);
            for (int id = 0; id < count; ++id)
            {
                UIElement button = buttons[id];
                button.HAlign = 0.5f;
                button.Top    = new StyleDimension((float)(num1 + num4 * id), 0.0f);
                button.SetSnapPoint(this._gamepadPointGroupname, id, new Vector2?(), new Vector2?());
                uiPanel2.Append(button);
                this._buttonsBySorting.Add(button);
            }
        }
        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);
            }
        }
        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);
            }
        }
        private void AddSearchBar(UIElement searchArea)
        {
            UIImageButton uiImageButton1 = new UIImageButton((Asset <Texture2D>)Main.Assets.Request <Texture2D>("Images/UI/Bestiary/Button_Search", (AssetRequestMode)1));

            uiImageButton1.VAlign = 0.5f;
            uiImageButton1.HAlign = 0.0f;
            UIImageButton uiImageButton2 = uiImageButton1;

            uiImageButton2.OnClick += new UIElement.MouseEvent(this.Click_SearchArea);
            uiImageButton2.SetHoverImage((Asset <Texture2D>)Main.Assets.Request <Texture2D>("Images/UI/Bestiary/Button_Search_Border", (AssetRequestMode)1));
            uiImageButton2.SetVisibility(1f, 1f);
            uiImageButton2.SetSnapPoint("CreativeInfinitesSearch", 0, new Vector2?(), new Vector2?());
            searchArea.Append((UIElement)uiImageButton2);
            UIPanel uiPanel1 = new UIPanel();

            uiPanel1.Width  = new StyleDimension((float)(-(double)uiImageButton2.Width.Pixels - 3.0), 1f);
            uiPanel1.Height = new StyleDimension(0.0f, 1f);
            uiPanel1.VAlign = 0.5f;
            uiPanel1.HAlign = 1f;
            UIPanel uiPanel2 = uiPanel1;

            this._searchBoxPanel     = uiPanel2;
            uiPanel2.BackgroundColor = new Color(35, 40, 83);
            uiPanel2.BorderColor     = new Color(35, 40, 83);
            uiPanel2.SetPadding(0.0f);
            searchArea.Append((UIElement)uiPanel2);
            UISearchBar uiSearchBar1 = new UISearchBar(Language.GetText("UI.PlayerNameSlot"), 0.8f);

            uiSearchBar1.Width  = new StyleDimension(0.0f, 1f);
            uiSearchBar1.Height = new StyleDimension(0.0f, 1f);
            uiSearchBar1.HAlign = 0.0f;
            uiSearchBar1.VAlign = 0.5f;
            uiSearchBar1.Left   = new StyleDimension(0.0f, 0.0f);
            uiSearchBar1.IgnoresMouseInteraction = true;
            UISearchBar uiSearchBar2 = uiSearchBar1;

            this._searchBar   = uiSearchBar2;
            uiPanel2.OnClick += new UIElement.MouseEvent(this.Click_SearchArea);
            uiSearchBar2.OnContentsChanged += new Action <string>(this.OnSearchContentsChanged);
            uiPanel2.Append((UIElement)uiSearchBar2);
            uiSearchBar2.OnStartTakingInput       += new Action(this.OnStartTakingInput);
            uiSearchBar2.OnEndTakingInput         += new Action(this.OnEndTakingInput);
            uiSearchBar2.OnNeedingVirtualKeyboard += new Action(this.OpenVirtualKeyboardWhenNeeded);
            uiSearchBar2.OnCancledTakingInput     += new Action(this.OnCancledInput);
        }
예제 #6
0
        private void BuildContainer()
        {
            GetDisplaySettings(out int _, out int _, out int widthWithSpacing, out int heightWithSpacing, out int perRow, out float _, out float _, out int howManyRows);
            UIPanel uIPanel = new UIPanel
            {
                Width  = new StyleDimension(perRow * widthWithSpacing + 10, 0f),
                Height = new StyleDimension(howManyRows * heightWithSpacing + 10, 0f),
                HAlign = 1f,
                VAlign = 0f,
                Left   = new StyleDimension(0f, 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);
            _container = uIPanel;
        }
        private void AddSearchBar(UIElement searchArea)
        {
            UIImageButton uIImageButton = new UIImageButton(Main.Assets.Request <Texture2D>("Images/UI/Bestiary/Button_Search", (AssetRequestMode)1))
            {
                VAlign = 0.5f,
                HAlign = 0f
            };

            uIImageButton.OnClick += Click_SearchArea;
            uIImageButton.SetHoverImage(Main.Assets.Request <Texture2D>("Images/UI/Bestiary/Button_Search_Border", (AssetRequestMode)1));
            uIImageButton.SetVisibility(1f, 1f);
            uIImageButton.SetSnapPoint("CreativeInfinitesSearch", 0);
            searchArea.Append(uIImageButton);
            UIPanel uIPanel = _searchBoxPanel = new UIPanel
            {
                Width  = new StyleDimension(0f - uIImageButton.Width.Pixels - 3f, 1f),
                Height = new StyleDimension(0f, 1f),
                VAlign = 0.5f,
                HAlign = 1f
            };

            uIPanel.BackgroundColor = new Color(35, 40, 83);
            uIPanel.BorderColor     = new Color(35, 40, 83);
            uIPanel.SetPadding(0f);
            searchArea.Append(uIPanel);
            UISearchBar uISearchBar = _searchBar = new UISearchBar(Language.GetText("UI.PlayerNameSlot"), 0.8f)
            {
                Width  = new StyleDimension(0f, 1f),
                Height = new StyleDimension(0f, 1f),
                HAlign = 0f,
                VAlign = 0.5f,
                Left   = new StyleDimension(0f, 0f),
                IgnoresMouseInteraction = true
            };

            uIPanel.OnClick += Click_SearchArea;
            uISearchBar.OnContentsChanged += OnSearchContentsChanged;
            uIPanel.Append(uISearchBar);
            uISearchBar.OnStartTakingInput       += OnStartTakingInput;
            uISearchBar.OnEndTakingInput         += OnEndTakingInput;
            uISearchBar.OnNeedingVirtualKeyboard += OpenVirtualKeyboardWhenNeeded;
            uISearchBar.OnCancledTakingInput     += OnCancledInput;
        }
        private void BuildContainer()
        {
            int widthWithSpacing;
            int heightWithSpacing;
            int perRow;
            int howManyRows;

            this.GetDisplaySettings(out int _, out int _, out widthWithSpacing, out heightWithSpacing, out perRow, out float _, out float _, out howManyRows);
            UIPanel uiPanel1 = new UIPanel();

            uiPanel1.Width  = new StyleDimension((float)(perRow * widthWithSpacing + 10), 0.0f);
            uiPanel1.Height = new StyleDimension((float)(howManyRows * heightWithSpacing + 10), 0.0f);
            uiPanel1.HAlign = 1f;
            uiPanel1.VAlign = 0.0f;
            uiPanel1.Left   = new StyleDimension(0.0f, 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);
            this._container = (UIElement)uiPanel2;
        }