Beispiel #1
0
        public override void Initialize()
        {
            base.Initialize();

            gui_manager = game.GuiManager;

            form = new DForm(gui_manager, "test", null);
            form.Size = new Vector2(800, 600);
            form.Position = new Vector2(0, 0);
            form.Alpha = 0;
            form.Initialize();
            gui_manager.AddControl(form);

            DLayoutFlow layout = new DLayoutFlow(2, 2, 60, 20, DLayoutFlow.DLayoutFlowStyle.Vertically);
            layout.Position = new Vector2(10, 10);

            button1 = new DButton(gui_manager);
            layout.Add(button1);
            button1.Text = "test";
            button1.Initialize();
            form.AddPanel(button1);
            button1.OnClick += new DButtonEventHandler(button_OnClick);

            check1 = new DCheckbox(gui_manager);
            layout.Add(check1);
             check1.Text = "Enable Fog";
            check1.FontColor = Color.White;
            check1.FillColor = Color.Wheat;
            check1.Checked = true;
            check1.Initialize();
            form.AddPanel(check1);
            check1.OnToggle += new CheckboxEventHandler(check_OnCheck);
        }
        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);
        }
        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);
        }
        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);
        }
        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);
        }