Inheritance: XNAInterfaceComponents.Components.XNAPanel
Exemplo n.º 1
0
        public MapSelectionPanel(MapPreviewPanel previewPanel, String selectedMapName)
            : base()
        {
            this.previewPanel = previewPanel;
            this.buttonWidth = 100;
            this.buttonSpacing = 30;

            this.group = new XNARadioButtonGroup();
            int index = 0;
            CustomArrayList<String> mapNames = LoadMapNames();
            for (int i = 0; i < mapNames.Count(); i++)
            {
                String map = mapNames.ElementAt(i);

                this.panels.AddLast(new MapEntryPanel(this, map, index));
                if (selectedMapName == map) this.panels.GetLast().previewButton.selected = true;
                index++;
            }

            int panelHeight = (int)Math.Max(this.panels.Count() * MapEntryPanel.ENTRY_HEIGHT + 100, 300);
            this.bounds = new Rectangle(((CLIENT_WINDOW_WIDTH / 2) - 250),
                ((CLIENT_WINDOW_HEIGHT / 2) - (panelHeight / 2)),
                500,
                panelHeight);
            this.DoLayout();
        }
Exemplo n.º 2
0
        public GameLobby()
            : base(null,
                new Rectangle(
                Game1.GetInstance().graphics.PreferredBackBufferWidth / 2 - 400,
                Game1.GetInstance().graphics.PreferredBackBufferHeight / 2 - 300,
                800, 600))
        {
            gameOptionsPanel = new XNAPanel(this, new Rectangle(5, 5, 500, 330));
            gameOptionsPanel.border = new Border(gameOptionsPanel, 1, Color.Blue);

            mapPreviewPanel = new MapPreviewPanel(this, new Rectangle(510, 5, 285, 330));
            mapPreviewPanel.border = new Border(mapPreviewPanel, 1, Color.Blue);

            this.creationTime = new TimeSpan(DateTime.UtcNow.Ticks).TotalMilliseconds;

            XNAPanel messagesPanel = new XNAPanel(this, new Rectangle(5, 340, 790, 210));
            messagesPanel.border = new Border(messagesPanel, 1, Color.Blue);

            messagesTextField = new XNATextField(messagesPanel, new Rectangle(5, 5, 780, 170), 12);
            messagesTextField.border = new Border(messagesTextField, 1, Color.Black);
            messagesTextField.font = MenuManager.SMALL_TEXTFIELD_FONT;
            messagesTextField.isEditable = false;

            messageTextField = new XNATextField(messagesPanel, new Rectangle(5, 180, 780, 25), 1);
            messageTextField.border = new Border(messageTextField, 1, Color.Black);
            messageTextField.font = MenuManager.SMALL_TEXTFIELD_FONT;
            messageTextField.onTextFieldKeyPressedListeners += this.OnKeyPressed;

            startGameButton = new XNAButton(this,
                new Rectangle(this.bounds.Width - 105, this.bounds.Height - 45, 100, 40), "Start Game");
            startGameButton.onClickListeners += StartGame;
            startGameButton.visible = false;

            leaveGameButton = new XNAButton(this,
                new Rectangle(5, this.bounds.Height - 45, 100, 40), "Leave Game");
            leaveGameButton.onClickListeners += LeaveGame;
        }