コード例 #1
0
        private MenuCategory CreateCheatUpgradeMenu()
        {
            int NumberOfCheats = 6;

            SelectionUpgradeWidth = MenuSelectionTotalArea.Height / NumberOfCheats;
            Rectangle          temp         = new Rectangle(0, 0, MenuSelectionTotalArea.Width, SelectionUpgradeWidth);
            MenuCategory       menu         = new MenuCategory("Cheats", UpgradeCheatsRec, "Upgrade Cheats", Color.Red, MenuSelectionTotalArea);
            List <UpgradeSlot> upgradeSlots = new List <UpgradeSlot>();

            //base widget tree
            for (int i = 0; i < NumberOfCheats; ++i)
            {
                Color      tempColor        = new Color(250 - (75 * i), 75 * i, 50 - (i * 10));
                WidgetTree tree             = new WidgetTree(temp);
                Rectangle  baseSlotDrawArea = new Rectangle(Viewport.Width / 2, SelectionUpgradeWidth / 2, SelectionUpgradeWidth, MenuSelectionTotalArea.Width);
                tree.AddDrawArea(baseSlotDrawArea, new ColorTexture(TextureBank.GetTexture("GSMbackground"), tempColor));
                Rectangle   currentSlotPosition = new Rectangle(0, (SelectionUpgradeWidth * i), temp.Width, temp.Height);
                UpgradeSlot slot = null;
                try
                {
                    slot = new UpgradeSlot(currentSlotPosition, ScreenManager, ScreenManager.Font);
                }
                catch (Exception)
                {
                }
                slot.SetWidgetTree(tree);
                upgradeSlots.Add(slot);
            }
            menu.SetUpgradeSlot(upgradeSlots);
            return(menu);
        }
コード例 #2
0
        private MenuCategory CreateWeaponUpgradeMenu()
        {
            int NumberOfWeapons = 4;

            SelectionUpgradeWidth = MenuSelectionTotalArea.Height / NumberOfWeapons;
            MenuCategory       menu         = new MenuCategory("Weapons", UpgradeWeaponRec, "Upgrade Weapons", Color.Beige, MenuSelectionTotalArea);
            List <UpgradeSlot> upgradeSlots = new List <UpgradeSlot>();

            //base widget tree
            for (int i = 0; i < NumberOfWeapons; ++i)
            {
                Rectangle   temp = new Rectangle(0, 0, MenuSelectionTotalArea.Width, SelectionUpgradeWidth);
                Rectangle   currentSlotPosition = new Rectangle(0, (SelectionUpgradeWidth * i), temp.Width, temp.Height);
                UpgradeSlot slot = new UpgradeSlot(currentSlotPosition, ScreenManager, ScreenManager.Font);
                switch (i)
                {
                case 0:
                    slot.SetUpgradeField(UpgradeFieldEnum.ShotgunDamage, Upgrade_List[UpgradeFieldEnum.ShotgunDamage]);
                    break;

                case 1:
                    slot.SetUpgradeField(UpgradeFieldEnum.RifleDamage, Upgrade_List[UpgradeFieldEnum.RifleDamage]);
                    break;

                case 2:
                    slot.SetUpgradeField(UpgradeFieldEnum.PlasmaDamage, Upgrade_List[UpgradeFieldEnum.PlasmaDamage]);
                    break;

                default:
                    slot.SetUpgradeField(UpgradeFieldEnum.RifleDamage, Upgrade_List[UpgradeFieldEnum.RifleDamage]);
                    break;
                }
                Color      tempColor        = new Color(250 - (75 * i), 75 * i, 50 - (i * 10));
                WidgetTree tree             = new WidgetTree(temp);
                Rectangle  baseSlotDrawArea = new Rectangle(Viewport.Width / 2, SelectionUpgradeWidth / 2, SelectionUpgradeWidth, MenuSelectionTotalArea.Width);
                tree.AddDrawArea(baseSlotDrawArea, new ColorTexture(TextureBank.GetTexture("GSMbackground"), tempColor));
                WidgetTree slotTop          = new WidgetTree(new Rectangle(0, 0, baseSlotDrawArea.Width, baseSlotDrawArea.Height));
                Rectangle  tapButton        = new Rectangle(baseSlotDrawArea.Height / 2, baseSlotDrawArea.Width / 2, 150, 150);
                Rectangle  valueArea        = new Rectangle(tapButton.X - 200, tapButton.Y, 200, 100);
                Rectangle  descriptionArea  = new Rectangle(tapButton.X + 200, valueArea.Y, 200, 10);
                Rectangle  upgradeLevelArea = new Rectangle(descriptionArea.X - 50, descriptionArea.Y, 100, 10);
                slotTop.AddDrawArea(tapButton, new ColorTexture(TextureBank.GetTexture("GSMbackground"), Color.Black));
                slotTop.AddDrawArea(valueArea, slot.NextUpgradeCostString);
                slotTop.AddDrawArea(descriptionArea, slot.NameString);
                slotTop.AddDrawArea(upgradeLevelArea, slot.LevelString);
                slotTop.AddHitArea(tapButton);
                tree.AddWidgetTree(slotTop);

                slot.SetWidgetTree(tree);
                slot.Value = i * 100;
                upgradeSlots.Add(slot);
            }
            menu.SetUpgradeSlot(upgradeSlots);
            return(menu);
        }