示例#1
0
        public override void OnInitialize()
        {
            /// Item panel
            itemPanel          = new ItemUIPanel();
            itemPanel.OnClick += (s, e) =>
            {
                var sortMode = SortingMode.CurrentCollectibleSortMode == SortingMode.CollectibleSortingMode.NamesDesc ? SortingMode.CollectibleSortingMode.NamesAsc
                                                           : SortingMode.CurrentCollectibleSortMode == SortingMode.CollectibleSortingMode.NamesAsc ?
                               SortingMode.CollectibleSortingMode.Normal : SortingMode.CollectibleSortingMode.NamesDesc;

                SortingMode.ApplySort(ref MultiShop.instance.shopGUI.rightPanel, sortMode);
            };
            itemPanel.Width.Set(ShopUIPanel.panelwidth, 0f);
            itemPanel.Height.Set(ShopUIPanel.panelheight, 0f);
            base.Append(itemPanel);

            /// Header text (Item name)
            headerText   = "??";
            headerUIText = new UIText(headerText);
            headerUIText.Top.Set(Main.fontItemStack.MeasureString(headerUIText.Text).X / 2 + ShopGUI.vpadding / 4f, 0f);
            headerUIText.Left.Set(itemPanel.Width.Pixels + ShopGUI.vpadding, 0f);
            base.Append(headerUIText);

            /// Unit panel
            unitPanel          = new UIPanel();
            unitPanel.OnClick += (s, e) =>
            {
                var sortMode = SortingMode.CurrentCollectibleSortMode == SortingMode.CollectibleSortingMode.UnitDesc ?
                               SortingMode.CollectibleSortingMode.UnitAsc
                                                           : SortingMode.CollectibleSortingMode.UnitDesc;

                SortingMode.ApplySort(ref MultiShop.instance.shopGUI.rightPanel, sortMode);
            };
            unitPanel.OnMouseOver += (s, e) =>
            {
                (e as UIPanel).PanelUIHover();
            };
            unitPanel.OnMouseOut += (s, e) =>
            {
                (e as UIPanel).PanelUIHover(false);
            };
            unitPanel.Height.Set(itemPanel.Height.Pixels, 0f);
            unitPanel.Width.Set(base.Width.Pixels / 4f + ShopGUI.vpadding * 2f, 0f);
            unitPanel.Left.Set(base.Width.Pixels - unitPanel.Width.Pixels - ShopGUI.vpadding, 0f);
            base.Append(unitPanel);

            /// Unit UI Text
            unitUIText = new UIText("");
            SetUnits(_stack);
            unitPanel.Append(unitUIText);
        }
示例#2
0
        public override void OnInitialize()
        {
            _button = new UIPanel();
            //_panel.OnClick += ShopSortButton_OnClick;
            //_panel.BackgroundColor = Color.Yellow;
            _button.SetPadding(0f);
            _button.Width.Set(ShopGUI.sortPanelWidth - 10f, 0f);
            _button.Height.Set(ShopGUI.sortPanelHeight - 10f, 0f);
            _button.Left.Set(5f, 0f);
            _button.Top.Set(5f + offsetY, 0f);
            base.Append(_button);

            _inner = new ItemUIPanel(0, 0);
        }
示例#3
0
        public override void OnInitialize()
        {
            // Header
            headerUIText = new UIText(headerText);
            base.Append(headerUIText);

            // Result
            resultPanel          = new ItemUIPanel();
            resultPanel.OnClick += (s, e) =>
            {
                var sortMode = SortingMode.CurrentShopSortMode == SortingMode.ShopSortingMode.ResultNameDesc ? SortingMode.ShopSortingMode.ResultNameAsc
                                                           : SortingMode.CurrentShopSortMode == SortingMode.ShopSortingMode.ResultNameAsc ?
                               SortingMode.ShopSortingMode.Normal : SortingMode.ShopSortingMode.ResultNameDesc;

                SortingMode.ApplySort(ref MultiShop.instance.shopGUI.leftPanel, sortMode);
            };
            resultPanel.Width.Set(panelwidth * 1.5f, 0f);
            resultPanel.Height.Set(panelheight * 1.5f, 0f);
            resultPanel.Top.Set(Main.fontItemStack.MeasureString(headerText).Y, 0f);
            base.Append(resultPanel);

            // Materialpanels
            materialPanels = new ItemUIPanel[8];
            for (int i = 0; i < materialPanels.Length; i++)
            {
                materialPanels[i] = new ItemUIPanel();
                var currentPanel = materialPanels[i];
                currentPanel.Width.Set(panelwidth, 0f);
                currentPanel.Height.Set(panelheight, 0f);
                currentPanel.Top.Set(i < 4
                                        ? resultPanel.Top.Pixels
                                        : resultPanel.Top.Pixels + panelheight + ShopGUI.vpadding / 2f, 0f);
                currentPanel.Left.Set(resultPanel.Width.Pixels + ShopGUI.vpadding / 2f + (panelwidth + ShopGUI.vpadding / 2f) * (i % (materialPanels.Length / 2f)), 0f);
                base.Append(currentPanel);
            }

            // Currencypanels
            currencyPanels = new ItemUIPanel[4];
            for (int i = 0; i < currencyPanels.Length; i++)
            {
                currencyPanels[i] = new ItemUIPanel(ItemID.CopperCoin + i, 0);
                var currentPanel = currencyPanels[i];
                currentPanel.OnClick += (s, e) =>
                {
                    var sortMode = SortingMode.CurrentShopSortMode == SortingMode.ShopSortingMode.GoldDesc ? SortingMode.ShopSortingMode.GoldAsc
                                                                   : SortingMode.ShopSortingMode.GoldDesc;

                    SortingMode.ApplySort(ref MultiShop.instance.shopGUI.leftPanel, sortMode);
                };
                currentPanel.Width.Set(panelwidth, 0f);
                currentPanel.Height.Set(panelheight, 0f);
                currentPanel.Top.Set(materialPanels[materialPanels.Length - 1].Top.Pixels + ShopGUI.vpadding / 2f + panelheight, 0f);
                currentPanel.Left.Set(resultPanel.Width.Pixels + ShopGUI.vpadding / 2f + (panelwidth + ShopGUI.vpadding / 2f) * i, 0f);
                base.Append(currentPanel);
            }

            // Special slot
            specialPanel = new ItemUIPanel();
            specialPanel.item.SetDefaults(ItemID.CrystalShard);
            specialPanel.item.stack = Main.rand.Next(5);
            specialPanel.OnClick   += (s, e) =>
            {
                var sortMode = SortingMode.CurrentShopSortMode == SortingMode.ShopSortingMode.ArtifactDesc ? SortingMode.ShopSortingMode.ArtifactAsc
                                                                   : SortingMode.ShopSortingMode.ArtifactDesc;

                SortingMode.ApplySort(ref MultiShop.instance.shopGUI.leftPanel, sortMode);
            };
            specialPanel.Top.Set(resultPanel.Top.Pixels + resultPanel.Height.Pixels + ShopGUI.vpadding / 2f, 0f);
            specialPanel.Width.Set(panelwidth, 0f);
            specialPanel.Height.Set(panelheight, 0f);
            specialPanel.Left.Set(specialPanel.Width.Pixels / 4f, 0f);
            base.Append(specialPanel);

            buyUIText              = new UIText("BUY");
            buyUIText.OnMouseOver += (s, e) =>
            {
                (e as UIText).TextUIHover();
            };
            buyUIText.OnMouseOut += (s, e) =>
            {
                (e as UIText).TextUIHover(false);
            };
            var stringSize = Main.fontItemStack.MeasureString(buyUIText.Text);

            buyUIText.Top.Set(specialPanel.Top.Pixels + specialPanel.Height.Pixels + ShopGUI.vpadding / 2f, 0f);
            buyUIText.Left.Set(stringSize.X / 2f + ShopGUI.vpadding / 4f, 0f);
            base.Append(buyUIText);
        }