예제 #1
0
        public override void Draw(SpriteBatch spriteBatch)
        {
            base.Draw(spriteBatch);
            Player player = null;

            if (_info.PlayerID >= 0 && _info.PlayerID < 255)
            {
                player = Main.player[_info.PlayerID];
                var item = player.inventory[player.selectedItem];
                player.inventory[player.selectedItem] = new Item();
                Main.instance.DrawPlayer(player,
                                         GetDimensions().Position() + new Vector2(2, 2) + Main.screenPosition, 0f, Vector2.Zero, 0f);
                player.inventory[player.selectedItem] = item;
            }
            else
            {
                player = new Player();
                Main.instance.DrawPlayer(player,
                                         GetDimensions().Position() + new Vector2(2, 2) + Main.screenPosition, 0f, Vector2.Zero, 0f);
            }
            var iconpos = gucoinText.GetDimensions().Position() + new Vector2(-35f, gucoinText.GetDimensions().Height / 2);
            var tex     = ServerSideCharacter2.ModTexturesTable["GuCoin"];

            spriteBatch.Draw(tex, iconpos, tex.Frame(1, 4, 0, frame), Color.White, 0f, new Vector2(tex.Width, tex.Height / 4f * 0.5f), 1f, SpriteEffects.None, 0f);
        }
예제 #2
0
        public override void Draw(SpriteBatch spriteBatch)
        {
            base.Draw(spriteBatch);
            var iconpos = currencyText.GetDimensions().Position() + new Vector2(5f, currencyText.GetDimensions().Height / 2);
            var tex     = ServerSideCharacter2.ModTexturesTable["GuCoin"];

            spriteBatch.Draw(tex, iconpos, tex.Frame(1, 4, 0, frame), Color.White, 0f, new Vector2(tex.Width, tex.Height / 4f * 0.5f), 1f, SpriteEffects.None, 0f);
        }
        private void InitializeHeroesPanel()
        {
            _heroesPanel = new UIPanel();

            _heroesPanel.Width.Set(0, 1f);
            _heroesPanel.Height.Set(0, 0.75f);

            _heroesPanel.Top.Set(_mainLabel.GetDimensions().Height + 100f, 0f);
            _heroesPanel.SetPadding(50f);

            //_heroesPanel.BackgroundColor = Color.Red;
            _heroesPanel.BackgroundColor = Color.Transparent;
            _heroesPanel.BorderColor     = Color.Transparent;

            _mainPanel.Append(_heroesPanel);
        }
예제 #4
0
        protected override void DrawChildren(SpriteBatch spriteBatch)
        {
            // Drawing is done manually so that the panel's opacity can be a thing - there isn't a way to set opacity of a UIImage.
            // As such, DO NOT make this call base.DrawChildren or it will break!
            // I'm looking at you, GoodPro.
            // Lord forgive me for what I'm about to do.
            CalculatedStyle mainPanelDimensions    = mainPanel.GetDimensions();
            CalculatedStyle currentImageDimensions = dimensionTransportButton.GetDimensions();
            CalculatedStyle textDimensions         = selectedDimensionName.GetDimensions();
            CalculatedStyle leftArrowDimensions    = leftArrow.GetDimensions();
            CalculatedStyle rightArrowDimensions   = rightArrow.GetDimensions();
            CalculatedStyle exitButtonDimensions   = exitButton.GetDimensions();

            spriteBatch.Draw(mainPanelTexture, new Vector2(mainPanelDimensions.X, mainPanelDimensions.Y), Color.White * opacity);
            spriteBatch.Draw(currentDimensionImage, new Vector2(currentImageDimensions.X, currentImageDimensions.Y), Color.White * opacity);
            spriteBatch.Draw(dimensionImageFrame, new Vector2(mainPanelDimensions.X, mainPanelDimensions.Y), Color.White * opacity);
            spriteBatch.DrawString(Main.fontMouseText, selectedDimensionName.Text, new Vector2(textDimensions.X, textDimensions.Y), Color.White * opacity);
            spriteBatch.Draw(currentLeftArrowTex, new Vector2(leftArrowDimensions.X, leftArrowDimensions.Y), Color.White * opacity);
            spriteBatch.Draw(currentRightArrowTex, new Vector2(rightArrowDimensions.X, rightArrowDimensions.Y), Color.White * opacity);
            spriteBatch.Draw(exitButtonTexture, new Vector2(exitButtonDimensions.X, exitButtonDimensions.Y), Color.White * opacity);
        }
예제 #5
0
        public override void OnInitialize()
        {
            float slotWidth  = Main.inventoryBackTexture.Width * inventoryScale;
            float slotHeight = Main.inventoryBackTexture.Height * inventoryScale;

            float panelTop  = Main.instance.invBottom + 60;
            float panelLeft = 20f;

            UIPanel panel           = new UIPanel();
            float   innerPanelLeft  = panelLeft + panel.PaddingLeft;
            float   innerPanelWidth = columns * (slotWidth + padding) + 20f + padding;
            float   panelWidth      = panel.PaddingLeft + innerPanelWidth + panel.PaddingRight;
            float   panelHeight     = Main.screenHeight - panelTop - 40f;

            panel.Left.Set(panelLeft, 0f);
            panel.Top.Set(panelTop, 0f);
            panel.Width.Set(panelWidth, 0f);
            panel.Height.Set(panelHeight, 0f);
            panel.Recalculate();

            UIElement topBar = new UIElement();

            topBar.Width.Set(0f, 1f);
            topBar.Height.Set(32f, 0f);
            panel.Append(topBar);

            sortButtons = new UIButtonChoice(new Texture2D[]
            {
                Main.inventorySortTexture[0],
                MagicStorage.Instance.GetTexture("Assets/SortID"),
                MagicStorage.Instance.GetTexture("Assets/SortName"),
                MagicStorage.Instance.GetTexture("Assets/SortNumber")
            },
                                             new LocalizedText[]
            {
                Language.GetText("Mods.MagicStorage.Common.SortDefault"),
                Language.GetText("Mods.MagicStorage.Common.SortID"),
                Language.GetText("Mods.MagicStorage.Common.SortName"),
                Language.GetText("Mods.MagicStorage.Common.SortStack")
            });

            sortButtons.OnClick += (a, b) => {
                if ((SortMode)sortButtons.choice != sortMode)
                {
                    sortMode = (SortMode)sortButtons.choice;
                    RefreshItems();
                }
            };

            topBar.Append(sortButtons);

            UITextPanel <LocalizedText> depositButton = new UITextPanel <LocalizedText>(Language.GetText("Mods.MagicStorage.Common.DepositAll"), 1f);

            depositButton.Left.Set(sortButtons.GetDimensions().Width + 2 * padding, 0f);
            depositButton.Width.Set(128f, 0f);
            depositButton.Height.Set(-2 * padding, 1f);
            depositButton.PaddingTop    = 8f;
            depositButton.PaddingBottom = 8f;
            depositButton.OnClick      += ClickDeposit;
            depositButton.OnMouseOver  += (a, b) => depositButton.BackgroundColor = lightBlue;
            depositButton.OnMouseOut   += (a, b) => depositButton.BackgroundColor = blue;

            topBar.Append(depositButton);

            float depositButtonRight = sortButtons.GetDimensions().Width + 2 * padding + depositButton.GetDimensions().Width;

            searchBar = new UISearchBar(Language.GetText("Mods.MagicStorage.Common.SearchName"));
            searchBar.Left.Set(depositButtonRight + padding, 0f);
            searchBar.Width.Set(-depositButtonRight - 2 * padding, 1f);
            searchBar.Height.Set(0f, 1f);

            topBar.Append(searchBar);

            UIElement topBar2 = new UIElement();

            topBar2.Width.Set(0f, 1f);
            topBar2.Height.Set(32f, 0f);
            topBar2.Top.Set(36f, 0f);

            panel.Append(topBar2);

            filterButtons = new UIButtonChoice(new Texture2D[]
            {
                MagicStorage.Instance.GetTexture("Assets/FilterAll"),
                MagicStorage.Instance.GetTexture("Assets/FilterMelee"),
                MagicStorage.Instance.GetTexture("Assets/FilterPickaxe"),
                MagicStorage.Instance.GetTexture("Assets/FilterArmor"),
                MagicStorage.Instance.GetTexture("Assets/FilterPotion"),
                MagicStorage.Instance.GetTexture("Assets/FilterTile"),
                MagicStorage.Instance.GetTexture("Assets/FilterMisc"),
            },
                                               new LocalizedText[]
            {
                Language.GetText("Mods.MagicStorage.Common.FilterAll"),
                Language.GetText("Mods.MagicStorage.Common.FilterWeapons"),
                Language.GetText("Mods.MagicStorage.Common.FilterTools"),
                Language.GetText("Mods.MagicStorage.Common.FilterEquips"),
                Language.GetText("Mods.MagicStorage.Common.FilterPotions"),
                Language.GetText("Mods.MagicStorage.Common.FilterTiles"),
                Language.GetText("Mods.MagicStorage.Common.FilterMisc")
            });

            filterButtons.OnClick += (a, b) => {
                if ((FilterMode)filterButtons.choice != filterMode)
                {
                    filterMode = (FilterMode)filterButtons.choice;
                    RefreshItems();
                }
            };

            topBar2.Append(filterButtons);

            searchBar2 = new UISearchBar(Language.GetText("Mods.MagicStorage.Common.SearchMod"));
            searchBar2.Left.Set(depositButtonRight + padding, 0f);
            searchBar2.Width.Set(-depositButtonRight - 2 * padding, 1f);
            searchBar2.Height.Set(0f, 1f);

            topBar2.Append(searchBar2);

            slotZone = new UISlotZone(GetItem, inventoryScale);
            slotZone.Width.Set(0f, 1f);
            slotZone.Top.Set(76f, 0f);
            slotZone.Height.Set(-116f, 1f);
            slotZone.OnMouseDown += PressSlotZone;

            panel.Append(slotZone);

            UIScrollbar scrollbar = new UIScrollbar();

            scrollbar.Left.Set(10, 0);
            slotZone.SetScrollbar(scrollbar);

            panel.Append(scrollbar);

            capacityText = new UIText(string.Empty);
            capacityText.Top.Set(-32f, 1f);
            capacityText.Left.Set(6f, 0f);
            capacityText.Height.Set(32f, 0);
            panel.Append(capacityText);

            float slotZoneHeight = capacityText.GetDimensions().Y - (filterButtons.GetDimensions().Y + filterButtons.GetDimensions().Height);

            slotZone.SetDimensions(columns, (int)(slotZoneHeight / (slotHeight + slotZone.padding)));

            Append(panel);
        }