Example #1
0
 //-----------------------------------------------------------------------------
 // Slots
 //-----------------------------------------------------------------------------
 // Adds the slot to the slot group.
 public Slot AddSlot(Point2I position, int width)
 {
     Slot slot = new Slot(this, position, width);
     slots.Add(slot);
     if (slots.Count == 1)
         currentSlot = slot;
     return slot;
 }
        //-----------------------------------------------------------------------------
        // Constructors
        //-----------------------------------------------------------------------------
        public MenuSecondaryItems(GameManager gameManager)
            : base(gameManager)
        {
            this.backgroundSprite = Resources.GetImage("UI/menu_key_items_a");

            SlotGroup group = new SlotGroup();
            currentSlotGroup = group;
            this.slotGroups.Add(group);
            Slot[,] slots = new Slot[5, 4];
            Slot ringBagSlot = null;

            Point2I gridSize = new Point2I(5, 4);

            for (int y = 0; y < gridSize.Y; y++) {
                for (int x = 0; x < gridSize.X; x++) {
                    if (y == gridSize.Y - 1) {
                        if (x == 0)
                            ringBagSlot = group.AddSlot(new Point2I(12, 80), 16);
                        slots[x, y] = group.AddSlot(new Point2I(32 + 24 * x, 80), 16);
                    }
                    else {
                        slots[x, y] = group.AddSlot(new Point2I(24 + 24 * x, 8 + 24 * y), (x == (gridSize.X - 1) ? 24 : 16));
                        group.GetSlotAt(group.NumSlots - 1);
                    }
                }
            }
            for (int y = 0; y < gridSize.Y; y++) {
                for (int x = 0; x < gridSize.X; x++) {
                    if (x == 0 && y == gridSize.Y - 1)
                        slots[x, y].SetConnection(Directions.Left, ringBagSlot);
                    else if (x == 0)
                        slots[x, y].SetConnection(Directions.Left, slots[gridSize.X - 1, (y + gridSize.Y - 1) % gridSize.Y]);
                    else
                        slots[x, y].SetConnection(Directions.Left, slots[x - 1, y]);

                    if (x == gridSize.X - 1 && y == gridSize.Y - 2)
                        slots[x, y].SetConnection(Directions.Right, ringBagSlot);
                    else if (x == gridSize.X - 1)
                        slots[x, y].SetConnection(Directions.Right, slots[0, (y + 1) % gridSize.Y]);
                    else
                        slots[x, y].SetConnection(Directions.Right, slots[x + 1, y]);

                    slots[x, y].SetConnection(Directions.Up, slots[x, (y + gridSize.Y - 1) % gridSize.Y]);
                    slots[x, y].SetConnection(Directions.Down, slots[x, (y + 1) % gridSize.Y]);
                }
            }

            ringBagSlot.SetConnection(Directions.Left, slots[gridSize.X - 1, gridSize.Y - 2]);
            ringBagSlot.SetConnection(Directions.Right, slots[0, gridSize.Y - 1]);
            ringBagSlot.SetConnection(Directions.Up, slots[0, gridSize.Y - 2]);
            ringBagSlot.SetConnection(Directions.Down, slots[0, 0]);
        }
Example #3
0
        //-----------------------------------------------------------------------------
        // Slots
        //-----------------------------------------------------------------------------
        public virtual void DrawSlotCursor(Graphics2D g, Slot slot)
        {
            Sprite tR = new Sprite(GameData.SHEET_MENU_SMALL_LIGHT, new Point2I(9, 0));
            Sprite bR = new Sprite(GameData.SHEET_MENU_SMALL_LIGHT, new Point2I(9, 1));
            Sprite tL = new Sprite(GameData.SHEET_MENU_SMALL_LIGHT, new Point2I(10, 0));
            Sprite bL = new Sprite(GameData.SHEET_MENU_SMALL_LIGHT, new Point2I(10, 1));

            g.DrawSprite(tR, slot.Position + new Point2I(-8, 0));
            g.DrawSprite(bR, slot.Position + new Point2I(-8, 8));

            g.DrawSprite(tL, slot.Position + new Point2I(slot.Width, 0));
            g.DrawSprite(bL, slot.Position + new Point2I(slot.Width, 8));
        }
Example #4
0
        //-----------------------------------------------------------------------------
        // Constructors
        //-----------------------------------------------------------------------------
        public MenuWeapons(GameManager gameManager)
            : base(gameManager)
        {
            this.backgroundSprite	= Resources.GetImage("UI/menu_weapons_a");

            this.ammoSlot			= 0;
            this.ammoMenuSize		= new Point2I(16, 8);
            this.ammoSlotGroup		= null;
            this.oldEquippedWeapons		= new ItemWeapon[2];

            SlotGroup group = new SlotGroup();
            currentSlotGroup = group;
            this.slotGroups.Add(group);
            Slot[,] slots = new Slot[4, 4];

            Point2I gridSize = new Point2I(4, 4);

            for (int y = 0; y < gridSize.Y; y++) {
                for (int x = 0; x < gridSize.X; x++) {
                    slots[x, y] = group.AddSlot(new Point2I(24 + 32 * x, 8 + 24 * y), 24);
                }
            }
            for (int y = 0; y < gridSize.Y; y++) {
                for (int x = 0; x < gridSize.X; x++) {
                    if (x == 0)
                        slots[x, y].SetConnection(Directions.Left, slots[gridSize.X - 1, (y + gridSize.Y - 1) % gridSize.Y]);
                    else
                        slots[x, y].SetConnection(Directions.Left, slots[x - 1, y]);

                    if (x == gridSize.X - 1)
                        slots[x, y].SetConnection(Directions.Right, slots[0, (y + 1) % gridSize.Y]);
                    else
                        slots[x, y].SetConnection(Directions.Right, slots[x + 1, y]);

                    slots[x, y].SetConnection(Directions.Up, slots[x, (y + gridSize.Y - 1) % gridSize.Y]);
                    slots[x, y].SetConnection(Directions.Down, slots[x, (y + 1) % gridSize.Y]);
                }
            }
        }
Example #5
0
 public override void DrawSlotCursor(Graphics2D g, Slot slot)
 {
     if (!inSubMenu) {
         base.DrawSlotCursor(g, slot);
     }
     else if (IsAmmoMenuFullyOpen) {
         Sprite arrowSprite = new Sprite(GameData.SHEET_MENU_SMALL_LIGHT, new Point2I(5, 5));
         g.DrawSprite(arrowSprite, slot.Position + new Point2I(4, 20));
     }
 }
Example #6
0
 // Sets the current slot in the slot group.
 public void SetCurrentSlot(Slot slot)
 {
     this.currentSlot = slot;
 }
Example #7
0
 //-----------------------------------------------------------------------------
 // Constructor
 //-----------------------------------------------------------------------------
 public SlotGroup()
 {
     this.slots = new List<Slot>();
     this.currentSlot = null;
 }