コード例 #1
0
        public void Activate(ContentManager Content)
        {
            int buffer = 4;

            readyPositions[0] = new Vector2((ClientBounds.Width / 2) / 2, (ClientBounds.Height / 2) / 2);
            readyPositions[1] = new Vector2(3 * (ClientBounds.Width / 2) / 2, (ClientBounds.Height / 2) / 2);
            readyPositions[2] = new Vector2((ClientBounds.Width / 2) / 2, 3 * (ClientBounds.Height / 2) / 2);
            readyPositions[3] = new Vector2(3 * (ClientBounds.Width / 2) / 2, 3 * (ClientBounds.Height / 2) / 2);

            //Itialize loadout rectangles
            Rectangle[] ld_positions = new Rectangle[4];
            ld_positions[0] = new Rectangle(buffer, buffer, ClientBounds.Width / 2 - (buffer * 2),
                                            ClientBounds.Height / 2 - (buffer * 2));
            ld_positions[1] = new Rectangle(ClientBounds.Width / 2 + buffer, buffer, ClientBounds.Width / 2 - (buffer * 2),
                                            ClientBounds.Height / 2 - (buffer * 2));
            ld_positions[2] = new Rectangle(buffer, ClientBounds.Height / 2 + buffer, ClientBounds.Width / 2 - (buffer * 2),
                                            ClientBounds.Height / 2 - (buffer * 2));
            ld_positions[3] = new Rectangle(ClientBounds.Width / 2 + buffer, ClientBounds.Height / 2 + buffer, ClientBounds.Width / 2 - (buffer * 2),
                                            ClientBounds.Height / 2 - (buffer * 2));

            Item[] equip = new Item[4];
            for (int i = 0; i < 4; i++)
            {
                if (inputs[i].isActive)
                {
                    Debug.WriteLine("Player " + i + " is Active!");
                    loadouts[i] = new LoadOut_Menu(loadoutfont, loadoutdisplayfont, ld_positions[i], menuBackground, items[i]);

                    /*for (int j = 0; j < 4; j++)
                     * {
                     *  equip[i] = state_man.equipment[i, j];
                     *  Debug.WriteLine("equip[i] = " + equip[i]);
                     *  if (equip[i] != null)
                     *      loadouts[i].EquipItem(i, true);
                     * }*/
                    //loadouts[i].equipment = equip;
                    inputs[i].OnKeyRelease += HandleInput;
                    totalPlayers++;
                }
            }
        }
コード例 #2
0
        public void Activate(ContentManager Content)
        {
            int buffer = 4;

            readyPositions[0] = new Vector2((ClientBounds.Width / 2) / 2, (ClientBounds.Height / 2) / 2);
            readyPositions[1] = new Vector2(3 * (ClientBounds.Width / 2) / 2, (ClientBounds.Height / 2) / 2);
            readyPositions[2] = new Vector2((ClientBounds.Width / 2) / 2, 3 * (ClientBounds.Height / 2) / 2);
            readyPositions[3] = new Vector2(3 * (ClientBounds.Width / 2) / 2, 3 * (ClientBounds.Height / 2) / 2);

            //Itialize loadout rectangles
            Rectangle[] ld_positions = new Rectangle[4];
            ld_positions[0] = new Rectangle(buffer, buffer, ClientBounds.Width / 2 - (buffer * 2),
                ClientBounds.Height / 2 - (buffer * 2));
            ld_positions[1] = new Rectangle(ClientBounds.Width / 2 + buffer, buffer, ClientBounds.Width / 2 - (buffer * 2),
                        ClientBounds.Height / 2 - (buffer * 2));
            ld_positions[2] = new Rectangle(buffer, ClientBounds.Height / 2 + buffer, ClientBounds.Width / 2 - (buffer * 2),
                        ClientBounds.Height / 2 - (buffer * 2));
            ld_positions[3] = new Rectangle(ClientBounds.Width / 2 + buffer, ClientBounds.Height / 2 + buffer, ClientBounds.Width / 2 - (buffer * 2),
                        ClientBounds.Height / 2 - (buffer * 2));

            Item[] equip = new Item[4];
            for (int i = 0; i < 4; i++)
            {
                if(inputs[i].isActive)
                {
                    Debug.WriteLine("Player " + i + " is Active!");
                    loadouts[i] = new LoadOut_Menu(loadoutfont, loadoutdisplayfont, ld_positions[i], menuBackground, items[i]);
                    /*for (int j = 0; j < 4; j++)
                    {
                        equip[i] = state_man.equipment[i, j];
                        Debug.WriteLine("equip[i] = " + equip[i]);
                        if (equip[i] != null)
                            loadouts[i].EquipItem(i, true);
                    }*/
                    //loadouts[i].equipment = equip;
                    inputs[i].OnKeyRelease += HandleInput;
                    totalPlayers++;
                }
            }
        }