Exemplo n.º 1
0
        private void SetCostItems(Type potion)
        {
            if (cost.Count > 0)
            {
                foreach (MenuItem item in costItems)
                {
                    nonSelectableItems.Remove(item);
                }

                costItems.Clear();
                int num = 0;
                if (potion != null)
                {
                    for (int i = 0; i < cost[potion].red; i++)
                    {
                        MenuItem item = new MenuItem(ingredient, new Vector2(4 + num, 14), 1, 1, null);
                        item.ChangeColor(Color.Red);
                        costItems.Add(item);
                        num++;
                    }
                    for (int i = 0; i < cost[potion].green; i++)
                    {
                        MenuItem item = new MenuItem(ingredient, new Vector2(4 + num, 14), 1, 1, null);
                        item.ChangeColor(Color.Green);
                        costItems.Add(item);
                        num++;
                    }
                    for (int i = 0; i < cost[potion].blue; i++)
                    {
                        MenuItem item = new MenuItem(ingredient, new Vector2(4 + num, 14), 1, 1, null);
                        item.ChangeColor(Color.Blue);
                        costItems.Add(item);
                        num++;
                    }
                }

                foreach (MenuItem item in costItems)
                {
                    nonSelectableItems.Add(item);
                }
            }
        }
Exemplo n.º 2
0
        public void InitMenuItems()
        {
            player = World.Player;
            menuItems.Clear();
            nonSelectableItems.Clear();
            //if (!initialized)
            {
                // pos is proportional to screen size (IE, SCREENWIDTH / 20 * pos)
                AddFlavorItem("Potion Menu", new Vector2(1, 3));
                if (player.Item != null)
                {
                    AddMenuItem("Discard current item for ingredient", new Vector2(2, 4), 0,
                        delegate() { CreateIndgredient(); });
                    AddFlavorItem(player.Item.Texture, new Vector2(15, 4), 1, 1);
                    AddFlavorItem("=>", new Vector2(16, 4));
                    AddFlavorItem(ingredient, new Vector2(17, 4), 1, 1);
                    nonSelectableItems[3].ChangeColor(GetColor());
                }

                AddMenuItem("Invincibility Potion", new Vector2(3, 5), 0,
                        delegate() { BuyPotion(new InvincibilityPotion()); });
                AddMenuItem("Confusion Potion", new Vector2(3, 6), 0,
                        delegate() { BuyPotion(new ConfusionPotion()); });
                AddMenuItem("Warp Potion", new Vector2(3, 7), 0,
                        delegate() { BuyPotion(new WarpPotion()); });
                AddMenuItem("Midas Potion", new Vector2(3, 8), 0,
                        delegate() { BuyPotion(new MidasPotion()); });
                AddMenuItem("Vampire Potion", new Vector2(3, 9), 0,
                        delegate() { BuyPotion(new VampirePotion()); });
                AddMenuItem("Curse Potion", new Vector2(3, 10), 0,
                        delegate() { BuyPotion(new CursePotion());  });

                AddFlavorItem("______________________________________________",
                    new Vector2(0, 13));
                AddFlavorItem("Cost: ",
                    new Vector2(2, 14));
                AddFlavorItem("",
                    new Vector2(2, 15));

                MenuItem list1 = new MenuItem(ingredient, new Vector2(13, 7), 2, 2, null);
                MenuItem list2 = new MenuItem(ingredient, new Vector2(13, 9), 2, 2, null);
                MenuItem list3 = new MenuItem(ingredient, new Vector2(13, 11), 2, 2, null);
                list1.ChangeColor(Color.Red);
                list2.ChangeColor(Color.Green);
                list3.ChangeColor(Color.Blue);

                nonSelectableItems.Add(list1);
                nonSelectableItems.Add(list2);
                nonSelectableItems.Add(list3);

                MenuItem item1 = new MenuItem("X " + ingredients.red, new Vector2(15, 7.8f), null);
                MenuItem item2 = new MenuItem("X " + ingredients.green, new Vector2(15, 9.8f), null);
                MenuItem item3 = new MenuItem("X " + ingredients.blue, new Vector2(15, 11.8f), null);

                ingredientRed = item1;
                ingredientBlue = item2;
                ingredientGreen = item3;

                nonSelectableItems.Add(item1);
                nonSelectableItems.Add(item2);
                nonSelectableItems.Add(item3);

                index1 = player.Item != null ? 1 : 0;
                index2 = player.Item != null ? 3 : 0;

                menuItems[0][0].Selected = true;
                yIndex = 0;
                //initialized = true;
            }
        }