Exemplo n.º 1
0
        private void OpenCodex(UIMouseEvent evt, UIElement listeningElement)
        {
            if (Main.LocalPlayer.GetModPlayer <CodexHandler>().CodexState != 0)
            {
                Open     = true;
                NewEntry = false;
                Main.PlaySound(SoundID.MenuOpen);
            }

            if (!Elements.Any(element => element is EntryButton))
            {
                foreach (CodexEntry entry in Main.LocalPlayer.GetModPlayer <CodexHandler>().Entries)
                {
                    EntryButton button = new EntryButton(entry);
                    button.Visible = false;
                    Buttons.Add(button);
                    Append(button);
                }
            }

            if (!Elements.Any(element => element is RecipeButton))
            {
                foreach (RiftRecipe recipe in ModContent.GetInstance <StarlightRiver>().RiftRecipes)
                {
                    RecipeButton button = new RecipeButton(recipe);
                    button.Visible = false;
                    Recipes.Add(button);
                    Append(button);
                }
            }
        }
Exemplo n.º 2
0
        public void RefreshRecipes()
        {
            foreach (UIElement element in Elements.Where(element => element is RecipeButton))
            {
                (element as RecipeButton).Visible = false;
                element.Width.Set(0, 0);
            }

            for (int k = 0; k < ShownRecipes.Count; k++)
            {
                RecipeButton button = ShownRecipes.ElementAt(k);
                Vector2      offset = new Vector2(0, -110).RotatedBy(k / (float)ShownRecipes.Count * 6.28f);
                button.Left.Set(offset.X - 40, 0.5f);
                button.Top.Set(offset.Y - 40, 0.5f);
                button.Width.Set(48, 0);
                button.Height.Set(48, 0);
                button.Visible = true;
            }
        }