Ejemplo n.º 1
0
        private void ModFilterButton_OnRightClick(UIMouseEvent evt, UIElement listeningElement)
        {
            UIHoverImageButtonMod button = (evt.Target as UIHoverImageButtonMod);

            button.hoverText = RBText("ModFilter") + ": " + GetModFilterTooltip(false);
            UpdateModHoverImage(button);
            AllUpdateNeeded();
        }
Ejemplo n.º 2
0
        private void ModFilterButton_OnMiddleClick(UIMouseEvent evt, UIElement listeningElement)
        {
            UIHoverImageButtonMod button = (evt.Target as UIHoverImageButtonMod);

            modIndex         = mods.Length - 1;
            button.hoverText = RBText("ModFilter") + ": " + RBText("All");
            UpdateModHoverImage(button);
            AllUpdateNeeded();
        }
Ejemplo n.º 3
0
        private void UpdateModHoverImage(UIHoverImageButtonMod button)
        {
            button.texture = null;
            Mod otherMod = ModLoader.GetMod(mods[modIndex]);

            if (otherMod != null && otherMod.TextureExists("icon"))
            {
                button.texture = otherMod.GetTexture("icon");
            }
        }
Ejemplo n.º 4
0
        private void UpdateModHoverImage(UIHoverImageButtonMod button)
        {
            button.texture = null;
            Mod otherMod = ModLoader.GetMod(mods[modIndex]);

            if (otherMod != null && otherMod.FileExists("icon.png"))
            {
                var modIconTexture = Texture2D.FromStream(Main.instance.GraphicsDevice, new MemoryStream(otherMod.GetFileBytes("icon.png")));
                if (modIconTexture.Width == 80 && modIconTexture.Height == 80)
                {
                    button.texture = modIconTexture;
                }
            }
        }
Ejemplo n.º 5
0
        public override void OnInitialize()
        {
            mainPanel = new UIDragableElement(true, true, true);
            //mainPanel.SetPadding(0);
            //mainPanel.PaddingTop = 4;
            mainPanel.Left.Set(400f, 0f);
            mainPanel.Top.Set(400f, 0f);
            mainPanel.Width.Set(475f, 0f);             // + 30
            mainPanel.MinWidth.Set(415f, 0f);
            mainPanel.MaxWidth.Set(784f, 0f);
            mainPanel.Height.Set(350, 0f);
            mainPanel.MinHeight.Set(263, 0f);
            mainPanel.MaxHeight.Set(1000, 0f);
            //mainPanel.BackgroundColor = Color.LightBlue;

            recipeCatalogueUI = new RecipeCatalogueUI();
            itemCatalogueUI   = new ItemCatalogueUI();
            bestiaryUI        = new BestiaryUI();

            var recipePanel = recipeCatalogueUI.CreateRecipeCataloguePanel();

            mainPanel.Append(recipePanel);

            var cataloguePanel = itemCatalogueUI.CreateItemCataloguePanel();

            mainPanel.Append(cataloguePanel);

            var bestiaryPanel = bestiaryUI.CreateBestiaryPanel();

            mainPanel.Append(bestiaryPanel);

            tabController = new TabController(mainPanel);
            tabController.AddPanel(recipePanel);
            tabController.AddPanel(cataloguePanel);
            tabController.AddPanel(bestiaryPanel);

            mainPanel.AddDragTarget(recipePanel);
            mainPanel.AddDragTarget(recipeCatalogueUI.recipeInfo);
            mainPanel.AddDragTarget(recipeCatalogueUI.RadioButtonGroup);
            mainPanel.AddDragTarget(cataloguePanel);
            itemCatalogueUI.additionalDragTargets.ForEach(x => mainPanel.AddDragTarget(x));
            mainPanel.AddDragTarget(bestiaryPanel);

            UIPanel button = new UIBottomlessPanel();

            button.SetPadding(0);
            button.Left.Set(10, 0);
            button.Width.Set(80, 0);
            button.Height.Set(22, 0);
            button.OnClick        += (a, b) => tabController.SetPanel(RecipeCatalogue);
            button.BackgroundColor = RecipeCatalogueUI.color;

            UIText text = new UIText(RBText("Recipes"), 0.85f);

            text.HAlign = 0.5f;
            text.VAlign = 0.5f;
            button.Append(text);
            mainPanel.Append(button);
            tabController.AddButton(button);

            button = new UIBottomlessPanel();
            button.SetPadding(0);
            button.Left.Set(85, 0);
            button.Width.Set(80, 0);
            button.Height.Set(22, 0);
            button.OnClick        += (a, b) => { tabController.SetPanel(ItemCatalogue); itemCatalogueUI.updateNeeded = true; };
            button.BackgroundColor = ItemCatalogueUI.color;

            text        = new UIText(RBText("Items"), 0.85f);
            text.HAlign = 0.5f;
            text.VAlign = 0.5f;
            button.Append(text);
            mainPanel.Append(button);
            tabController.AddButton(button);

            button = new UIBottomlessPanel();
            button.SetPadding(0);
            button.Left.Set(160, 0);
            button.Width.Set(80, 0);
            button.Height.Set(22, 0);
            button.OnClick        += (a, b) => tabController.SetPanel(Bestiary);
            button.BackgroundColor = BestiaryUI.color;

            text        = new UIText(RBText("Bestiary"), 0.85f);
            text.HAlign = 0.5f;
            text.VAlign = 0.5f;
            button.Append(text);
            mainPanel.Append(button);
            tabController.AddButton(button);

            // TODO: Help panel with expandable help topics.

            button = new UIBottomlessPanel();
            button.SetPadding(0);
            button.Left.Set(-80, 1);
            button.Width.Set(70, 0);
            button.Height.Set(22, 0);
            button.BackgroundColor = Color.DarkRed;

            var modFilterButton = new UIHoverImageButtonMod(RecipeBrowser.instance.GetTexture("Images/filterMod"), RBText("ModFilter") + ": " + RBText("All"));

            modFilterButton.Left.Set(-60, 1f);
            modFilterButton.Top.Set(-0, 0f);
            modFilterButton.OnClick       += ModFilterButton_OnClick;
            modFilterButton.OnRightClick  += ModFilterButton_OnRightClick;
            modFilterButton.OnMiddleClick += ModFilterButton_OnMiddleClick;
            button.Append(modFilterButton);

            Texture2D texture = RecipeBrowser.instance.GetTexture("UIElements/closeButton");

            closeButton          = new UIHoverImageButton(texture, RBText("Close"));
            closeButton.OnClick += CloseButtonClicked;
            closeButton.Left.Set(-26, 1f);
            closeButton.VAlign = 0.5f;
            button.Append(closeButton);
            mainPanel.Append(button);

            tabController.SetPanel(0);

            //favoritedRecipes = new List<int>();
            favoritePanel = new UIDragablePanel();
            favoritePanel.SetPadding(6);
            favoritePanel.Left.Set(-310f, 0f);
            favoritePanel.HAlign = 1f;
            favoritePanel.Top.Set(90f, 0f);
            favoritePanel.Width.Set(415f, 0f);
            favoritePanel.MinWidth.Set(50f, 0f);
            favoritePanel.MaxWidth.Set(500f, 0f);
            favoritePanel.Height.Set(350, 0f);
            favoritePanel.MinHeight.Set(50, 0f);
            favoritePanel.MaxHeight.Set(300, 0f);
            //favoritePanel.BackgroundColor = new Color(73, 94, 171);
            favoritePanel.BackgroundColor = Color.Transparent;
            //Append(favoritePanel);
        }