Ejemplo n.º 1
0
        protected override void LoadContent()
        {
            base.LoadContent();

            // init room name label

            roomNameLabel = new DText(guiManager);
            roomNameLabel.FontName = "Miramonte";
            layout.Add(roomNameLabel);
            roomNameLabel.Initialize();
            roomNameLabel.Text = "Room ";
            roomNameLabel.Position = new Vector2(100, 100);
            roomNameLabel.HorizontalAlignment = DText.DHorizontalAlignment.Left;
            form.AddPanel(roomNameLabel);

            // init room creator label
            creatorLabel = new DText(guiManager);
            creatorLabel.FontName = "Miramonte";
            layout.Add(creatorLabel);
            creatorLabel.Initialize();
            creatorLabel.Text = "Creator: ";
            creatorLabel.Position = new Vector2(100, 125);
            creatorLabel.HorizontalAlignment = DText.DHorizontalAlignment.Left;
            form.AddPanel(creatorLabel);

            // init player label
            playersLabel = new DText(guiManager);
            playersLabel.FontName = "Miramonte";
            layout.Add(playersLabel);
            playersLabel.Initialize();
            playersLabel.Text = "Players: ";
            playersLabel.Position = new Vector2(100, 150);
            playersLabel.HorizontalAlignment = DText.DHorizontalAlignment.Left;
            form.AddPanel(playersLabel);

            // init player list box
            playerList = new DListBox(guiManager);
            layout.Add(playerList);
            playerList.Initialize();
            playerList.Position = new Vector2(100, 175);
            form.AddPanel(playerList);

            // init quit room button
            quitRoomButton = new DButton(guiManager);
            layout.Add(quitRoomButton);
            quitRoomButton.Text = "Quit";
            quitRoomButton.Position = new Vector2(quitRoomButton.Size.X + 100, 500) - quitRoomButton.Size;
            quitRoomButton.Initialize();
            form.AddPanel(quitRoomButton);
            quitRoomButton.OnClick += new DButtonEventHandler(quitRoomButton_OnClick);

            // init start room button
            startRoomButton = new DButton(guiManager);
            layout.Add(startRoomButton);
            startRoomButton.Text = "Start";
            startRoomButton.Position = new Vector2(800 - 100, 500) - startRoomButton.Size;
            startRoomButton.Enabled = false;
            startRoomButton.Initialize();
            form.AddPanel(startRoomButton);
            startRoomButton.OnClick += new DButtonEventHandler(startRoomButton_OnClick);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            float textXOffset = _PADDING;

            if (imageName != null)
            {
                imageValue = new DImage(_guiManager, _PADDING, _PADDING, imageName, (int)(Size.X - (2 * _PADDING)), (int)(Size.Y - (2 * _PADDING)));
                imageValue.Initialize();

                this.Children.Add(imageValue);

                textXOffset += imageValue.Position.X + imageValue.Size.X;
            }

            textValue = new DText(_guiManager);
            textValue.Text = text;
            textValue.FontName = "Miramonte";
            // Left justified
            textValue.HorizontalAlignment = DText.DHorizontalAlignment.Left;
            textValue.VerticalAlignment = DText.DVerticalAlignment.Center;
            textValue.Size = new Vector2(Size.X, Size.Y);
            textValue.Initialize();
            textValue.Position = new Vector2(textXOffset, _PADDING);
            this.AddPanel(textValue);

            dropDownButton = new DToggleButton(_guiManager);
            dropDownButton.Text = "";
            dropDownButton.Size = new Vector2(Size.Y, Size.Y);
            dropDownButton.Initialize();
            dropDownButton.Position = new Vector2(Size.X - Size.Y, 0);
            this.AddPanel(dropDownButton);

            dropDownButton.OnToggle += new ToggleButtonEventHandler(dropDownButton_OnToggle);

            dropDownList = new DListBox(_guiManager);
            dropDownList.Size = new Vector2(Size.X, DEFAULT_LIST_HEIGHT);
            dropDownList.Initialize();
            dropDownList.Position = new Vector2(0, this.Position.Y + Size.Y);
            dropDownList.Visible = false;
            dropDownList.ApplyChildClipping = false;

            dropDownList.OnItemSelect += new ListBoxChangeEventHandler(dropDownList_OnItemSelect);
            listShown = false;

            this.FillColor = Color.White;

            base.LoadContent();
        }
Ejemplo n.º 3
0
        protected override void LoadContent()
        {
            base.LoadContent();

            // init lobby label

            lobbyLabel = new DText(guiManager);
            lobbyLabel.FontName = "Miramonte";
            layout.Add(lobbyLabel);
            lobbyLabel.Initialize();
            lobbyLabel.Text = "Room List";
            lobbyLabel.Position = new Vector2(100, 100);
            lobbyLabel.HorizontalAlignment = DText.DHorizontalAlignment.Center;
            form.AddPanel(lobbyLabel);

            // init list box
            roomList = new DListBox(guiManager);
            layout.Add(roomList);
            roomList.Initialize();
            roomList.Position = new Vector2(100, 150);
            form.AddPanel(roomList);

            // init join room button
            joinRoomButton = new DButton(guiManager);
            layout.Add(joinRoomButton);
            joinRoomButton.Text = "Join";
            joinRoomButton.Position = new Vector2(joinRoomButton.Size.X + 100, 500) - joinRoomButton.Size;
            joinRoomButton.Initialize();
            form.AddPanel(joinRoomButton);
            joinRoomButton.OnClick += new DButtonEventHandler(joinRoomButton_OnClick);

            // init create room button
            createRoomButton = new DButton(guiManager);
            layout.Add(createRoomButton);
            createRoomButton.Text = "Create";
            createRoomButton.Position = new Vector2(800 - 100, 500) - createRoomButton.Size;
            createRoomButton.Initialize();
            form.AddPanel(createRoomButton);
            createRoomButton.OnClick += new DButtonEventHandler(createRoomButton_OnClick);
        }