コード例 #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 Name:";
            roomNameLabel.Position = new Vector2(400, 100) - (roomNameLabel.Size / 2);
            roomNameLabel.HorizontalAlignment = DText.DHorizontalAlignment.Center;
            form.AddPanel(roomNameLabel);

            // init room name textbox
            roomNameTextBox = new DTextBox(guiManager);
            layout.Add(roomNameTextBox);
            roomNameTextBox.Initialize();
            roomNameTextBox.Text = "asdasd";
            roomNameTextBox.Position = new Vector2(400, 150) - (roomNameTextBox.Size / 2);
            form.AddPanel(roomNameTextBox);

            // init max players label
            maxPlayerLabel = new DText(guiManager);
            maxPlayerLabel.FontName = "Miramonte";
            layout.Add(maxPlayerLabel);
            maxPlayerLabel.Initialize();
            maxPlayerLabel.Text = "Max Players:";
            maxPlayerLabel.Position = new Vector2(400, 200) - (maxPlayerLabel.Size / 2);
            maxPlayerLabel.HorizontalAlignment = DText.DHorizontalAlignment.Center;
            form.AddPanel(maxPlayerLabel);

            // init max player textbox
            maxPlayerTextBox = new DTextBox(guiManager);
            layout.Add(maxPlayerTextBox);
            maxPlayerTextBox.Initialize();
            maxPlayerTextBox.Text = "8";
            maxPlayerTextBox.Position = new Vector2(400, 250) - (maxPlayerTextBox.Size / 2);
            form.AddPanel(maxPlayerTextBox);

            // init cancel button
            cancelButton = new DButton(guiManager);
            layout.Add(cancelButton);
            cancelButton.Text = "Cancel";
            cancelButton.Position = new Vector2(cancelButton.Size.X + 200, 400) - cancelButton.Size;
            cancelButton.Initialize();
            form.AddPanel(cancelButton);
            cancelButton.OnClick += new DButtonEventHandler(cancelButton_OnClick);

            // init create button
            createRoomButton = new DButton(guiManager);
            layout.Add(createRoomButton);
            createRoomButton.Text = "Create";
            createRoomButton.Position = new Vector2(600, 400) - createRoomButton.Size;
            createRoomButton.Initialize();
            form.AddPanel(createRoomButton);
            createRoomButton.OnClick += new DButtonEventHandler(createRoomButton_OnClick);
        }
コード例 #2
0
ファイル: DButtonBase.cs プロジェクト: konlil/pipe
        public DButtonBase(DGuiManager guiManager)
            : base(guiManager)
        {
            Size = new Vector2(WIDTH, HEIGHT);
            UseHoverColor = true;

            label = new DText(guiManager);
        }
コード例 #3
0
        protected override void LoadContent()
        {
            base.LoadContent();

            // init gundbound label

            gundboundLabel = new DText(guiManager);
            gundboundLabel.FontName = "Miramonte";
            layout.Add(gundboundLabel);
            gundboundLabel.Initialize();
            gundboundLabel.Text = "Gunbound";
            gundboundLabel.Position = new Vector2(400, 200) - (gundboundLabel.Size / 2);
            gundboundLabel.HorizontalAlignment = DText.DHorizontalAlignment.Center;
            form.AddPanel(gundboundLabel);

            // init ip address textbox
            ipAddressTextBox = new DTextBox(guiManager);
            layout.Add(ipAddressTextBox);
            ipAddressTextBox.Initialize();
            ipAddressTextBox.Text = "127.0.0.1";
            ipAddressTextBox.Position = new Vector2(400, 250) - (ipAddressTextBox.Size / 2);
            form.AddPanel(ipAddressTextBox);

            // init username textbox
            usernameTextBox = new DTextBox(guiManager);
            layout.Add(usernameTextBox);
            usernameTextBox.Initialize();
            usernameTextBox.Text = "username";
            usernameTextBox.Position = new Vector2(400, 300) - (usernameTextBox.Size / 2);
            form.AddPanel(usernameTextBox);

            // init handshake button
            handshakeButton = new DButton(guiManager);
            layout.Add(handshakeButton);
            handshakeButton.Text = "Connect";
            handshakeButton.Position = new Vector2(400, 350) - (handshakeButton.Size / 2);
            handshakeButton.Initialize();
            form.AddPanel(handshakeButton);
            handshakeButton.OnClick += new DButtonEventHandler(handshakeButton_OnClick);
        }
コード例 #4
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);
        }
コード例 #5
0
ファイル: DComboBox.cs プロジェクト: konlil/pipe
        /// <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();
        }
コード例 #6
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);
        }
コード例 #7
0
ファイル: DCheckbox.cs プロジェクト: konlil/pipe
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            textPos = new Vector2(Size.X + TEXTPAD, Size.Y / 2);

            label = new DText(_guiManager);
            label.Text = text;
            label.FontName = "Miramonte";
            // Left justified
            label.HorizontalAlignment = DText.DHorizontalAlignment.Left;
            label.VerticalAlignment = DText.DVerticalAlignment.Center;
            label.Position = textPos;
            label.ApplyChildClipping = false;
            label.Initialize();
            this.AddPanel(label);

            _xText = new DText(_guiManager);
            _xText.Text = "x";
            _xText.HorizontalAlignment = DText.DHorizontalAlignment.Center;
            _xText.VerticalAlignment = DText.DVerticalAlignment.Center;
            _xText.Position = (this.Size / 2) + new Vector2(0, -1);
            _xText.Initialize();
            _xText.Visible = false;
            _xText.ApplyChildClipping = false;
            this.AddPanel(_xText);

            base.LoadContent();
        }
コード例 #8
0
ファイル: DMultiLineTextBox.cs プロジェクト: konlil/pipe
 private DText CreateNewLineText()
 {
     DText defaultTextItem = new DText(_guiManager);
     defaultTextItem.FontName = FontName;
     defaultTextItem.FontColor = ColorTheme.InputFontColor;
     defaultTextItem.HorizontalAlignment = DText.DHorizontalAlignment.Left;
     defaultTextItem.VerticalAlignment = DText.DVerticalAlignment.Center;
     defaultTextItem.Initialize();
     return defaultTextItem;
 }
コード例 #9
0
ファイル: DGrid.cs プロジェクト: konlil/pipe
        protected void CreateGrid()
        {
            _panelArray = new DPanel[_columns, _rows];
            _cellWidths = new float[_columns];
            _cellHeights = new float[_rows];
            _columnLines = new Texture2D[_columns + 1];
            _rowLines = new Texture2D[_rows + 1];

            for (int i = 0; i < _columns; i++)
            {
                _cellWidths[i] = _cellWidth;
            }
            for (int i = 0; i < _rows; i++)
            {
                _cellHeights[i] = _cellHeight;
            }
            this.Size = new Vector2(_cellWidths.Length * (_cellWidth + _gridLineWidth), _cellHeights.Length * (_cellHeight + _gridLineWidth));

            if (_gridLineWidth > 0)
            {
                for (int i = 0; i < _columnLines.Length; i++)
                {
                    _columnLines[i] = DrawingSystem.DrawingHelper.CreateLineTexture(Game.GraphicsDevice, _gridLineWidth, (int)this.Size.Y, GridColor);
                }
                for (int i = 0; i < _rowLines.Length; i++)
                {
                    _rowLines[i] = DrawingSystem.DrawingHelper.CreateLineTexture(Game.GraphicsDevice, (int)this.Size.X + _gridLineWidth, _gridLineWidth, GridColor);
                }
            }

            for (int x = 0; x < _columns; x++)
            {
                for (int y = 0; y < _rows; y++)
                {
                    if (_fillType != DGridFillType.None)
                    {
                        Vector2 gridPosition = GridPosition(x,y);

                        if (_fillType == DGridFillType.DButton)
                        {
                            DButton button = new DButton(_guiManager,
                                gridPosition.X,
                                gridPosition.Y,
                                x.ToString() + ", " + y.ToString(),
                                _cellWidth,
                                _cellHeight);
                            button.FontName = "Miramonte";
                            _panelArray[x, y] = button;
                            this.AddPanel(button);
                        }
                        else if (_fillType == DGridFillType.DText)
                        {
                            DText text = new DText(_guiManager,
                                gridPosition.X + (_cellWidth / 2),
                                gridPosition.Y + (_cellHeight / 2),
                                _cellWidth,
                                _cellHeight,
                                x.ToString() + ", " + y.ToString());
                            text.HorizontalAlignment = DText.DHorizontalAlignment.Center;
                            text.VerticalAlignment = DText.DVerticalAlignment.Center;
                            text.FontName = "Miramonte";
                            _panelArray[x, y] = text;
                            this.AddPanel(text);
                        }
                    }
                }
            }
        }
コード例 #10
0
ファイル: DListBoxItem.cs プロジェクト: konlil/pipe
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            imagePos = new Vector2(PADDING, PADDING);

            if (imageName != null)
            {
                image = new DImage(_guiManager, (int) imagePos.X, (int) imagePos.Y, imageName, (int) (Size.Y - (2*PADDING)), (int) (Size.Y - (2*PADDING)));
                this.AddPanel(image);
            }

            // Align text centered vertically
            if (image != null)
                textPos = new Vector2(Size.Y + PADDING, Size.Y / 2);
            else
                textPos = new Vector2(PADDING + PADDING, Size.Y / 2);

            // Text label
            label = new DText(_guiManager);
            label.Text = text;
            label.FontName = "Miramonte";
            label.HorizontalAlignment = DText.DHorizontalAlignment.Left;
            label.VerticalAlignment = DText.DVerticalAlignment.Center;
            label.Position = textPos;
            //label.Parent = this;
            this.AddPanel(label);

            base.LoadContent();
        }