Inheritance: XNAInterfaceComponents.AbstractComponents.ChildComponent, Drawable
Exemplo n.º 1
0
        public MPLoadScreen()
            : base(null, Rectangle.Empty)
        {
            int userCount = Game1.GetInstance().multiplayerGame.GetUserCount();
            int panelHeight = (((itemHeight * 2) + (itemPadding * 2) + userPadding) * userCount) + 40;
            progressBars = new XNAProgressBar[userCount];
            loadingWhatLabels = new XNALabel[userCount];

            this.bounds = new Rectangle((Game1.GetInstance().graphics.PreferredBackBufferWidth / 2) - 200,
            (Game1.GetInstance().graphics.PreferredBackBufferHeight / 2) - (panelHeight / 2),
            400, panelHeight);

            for (int i = 0; i < userCount; i++)
            {
                progressBars[i] = new XNAProgressBar(this,
                    new Rectangle(20, (i * itemHeight) + (i * itemPadding) + ((i + 1) * userPadding), this.bounds.Width - 40, itemHeight),
                    100);
                progressBars[i].progressDisplayLabel.font = MenuManager.BUTTON_FONT;
                progressBars[i].progressDisplayLabel.fontColor = Color.White;
                progressBars[i].currentValue = 0;
                progressBars[i].maxValue = 100;

                loadingWhatLabels[i] = new XNALabel(this,
                    new Rectangle(20, ((i + 1) * itemHeight) + ((i + 1) * itemPadding) + ((i + 1) * userPadding),
                        this.bounds.Width - 40, itemHeight), "Startup..");
                loadingWhatLabels[i].textAlign = XNALabel.TextAlign.CENTER;
                loadingWhatLabels[i].border = null;
            }

            loadingLabel = new XNALabel(this, new Rectangle(20, this.bounds.Height - 30, this.bounds.Width - 40, itemHeight), "Loading..");
            loadingLabel.textAlign = XNALabel.TextAlign.CENTER;
            loadingLabel.border = null;
        }
Exemplo n.º 2
0
        public UserDisplayPanel(ParentComponent parent, User user, int index)
            : base(parent, new Rectangle())
        {
            this.user = user;
            this.UpdateBounds(index);
            Boolean enabled = false;
            if (user.id == ChatServerConnectionManager.GetInstance().user.id) enabled = true;

            readyCheckBox = new XNACheckBox(this, new Rectangle(10, 10, 20, 20), "");
            readyCheckBox.onClickListeners += this.OnReadyChanged;
            readyCheckBox.enabled = enabled;
            // readyCheckBox

            usernameLbl = new XNALabel(this, new Rectangle(40, 5, 230, 30), user.username);
            usernameLbl.font = MenuManager.BIG_TEXTFIELD_FONT;

            teamDropdown = new XNADropdown(this, new Rectangle(280, 5, 50, 30));
            teamDropdown.dropdownLineSpace = 15;
            teamDropdown.arrowSize = 8;
            teamDropdown.onOptionSelectedChangedListeners += this.OnTeamChanged;
            for (int i = 0; i < 8; i++) teamDropdown.AddOption((i + 1) + "");
            teamDropdown.enabled = enabled;

            colorDropdown = new XNADropdown(this, new Rectangle(340, 5, 50, 30));
            colorDropdown.dropdownLineSpace = 15;
            colorDropdown.arrowSize = 8;
            for (int i = 0; i < colors.Length; i++)
            {
                colorDropdown.AddOption("");
                colorDropdown.SetBackgroundColor(i + 1, colors[i]);
            }
            colorDropdown.onOptionSelectedChangedListeners += this.OnColorChanged;
            colorDropdown.enabled = enabled;

            kickBtn = new XNAButton(this, new Rectangle(400, 5, 75, 30), "Kick");
            kickBtn.visible = false;

            if (((GameLobby)MenuManager.GetInstance().GetCurrentlyDisplayedMenu()).IsCurrentUserHost() &&
                this.user.id != ChatServerConnectionManager.GetInstance().user.id)
            {
                kickBtn.visible = true;
                kickBtn.onClickListeners += this.OnKickButtonPressed;
            }

            if (this.user.id == 1)
            {
                // Wotuu
                this.SelectColor(1);
                this.readyCheckBox.selected = true;
                this.teamDropdown.SelectItem(0);
            }
            else if (this.user.id == 2)
            {
                this.SelectColor(3);
                this.readyCheckBox.selected = true;
                this.teamDropdown.SelectItem(1);
            }
        }
Exemplo n.º 3
0
        public SPLoadScreen(Rectangle bounds)
            : base(null, bounds)
        {
            progressBar = new XNAProgressBar(this,
                new Rectangle(20, 30, this.bounds.Width - 40, 20),
                100);
            progressBar.progressDisplayLabel.font = MenuManager.BUTTON_FONT;
            progressBar.progressDisplayLabel.fontColor = Color.White;

            loadingWhatLabel = new XNALabel(this, new Rectangle(20, 80, this.bounds.Width - 40, 30), "Startup..");
            loadingWhatLabel.textAlign = XNALabel.TextAlign.CENTER;
            loadingWhatLabel.border = null;

            loadingLabel = new XNALabel(this, new Rectangle(20, this.bounds.Height - 30, this.bounds.Width - 40, 20), "Loading..");
            loadingLabel.textAlign = XNALabel.TextAlign.CENTER;
            loadingLabel.border = null;
        }
Exemplo n.º 4
0
        public GameDisplayPanel(ParentComponent parent, int index, MultiplayerGame multiplayerGame)
            : base(parent, new Rectangle())
        {
            this.index = index;
            this.bounds = new Rectangle(5, 5 + (componentHeight + componentSpacing) * this.index,
                580,
                componentHeight);
            this.border = new Border(this, 2, Color.Pink);

            this.multiplayerGame = multiplayerGame;

            XNALabel gameNameLbl = new XNALabel(this, new Rectangle(5, 5, 180, 30), this.multiplayerGame.gamename);
            mapNameLbl = new XNALabel(this, new Rectangle(195, 5, 180, 30), this.multiplayerGame.mapname);

            joinGameBtn = new XNAButton(this, new Rectangle(475, 5, 100, 30), "Join game");
            joinGameBtn.onClickListeners += this.JoinGame;
        }
Exemplo n.º 5
0
        public LoginScreen()
            : base(null, new Rectangle(
                Game1.GetInstance().graphics.PreferredBackBufferWidth / 2 - 200,
                Game1.GetInstance().graphics.PreferredBackBufferHeight / 2 - 200,
                400, 400))
        {
            XNALabel ipLbl = new XNALabel(this, new Rectangle(70, 70, 100, 30), "IP");
            ipLbl.border = null;
            ipLbl.textAlign = XNALabel.TextAlign.RIGHT;
            ipLbl.font = MenuManager.BIG_TEXTFIELD_FONT;

            ipTF = new XNATextField(this, new Rectangle(190, 70, 100, 35), 1);
            ipTF.border = new Border(ipTF, 1, Color.Blue);
            ipTF.font = MenuManager.BIG_TEXTFIELD_FONT;
            ipTF.text = "localhost";

            XNALabel usernameLbl = new XNALabel(this, new Rectangle(70, 110, 100, 30), "Username");
            usernameLbl.border = null;
            usernameLbl.textAlign = XNALabel.TextAlign.RIGHT;
            usernameLbl.font = MenuManager.BIG_TEXTFIELD_FONT;

            usernameTF = new XNATextField(this, new Rectangle(190, 110, 100, 35), 1);
            usernameTF.border = new Border(usernameTF, 1, Color.Blue);
            usernameTF.font = MenuManager.BIG_TEXTFIELD_FONT;

            connectingLbl = new XNALabel(this, new Rectangle(0, 160, 400, 30), "");
            connectingLbl.border = null;
            connectingLbl.textAlign = XNALabel.TextAlign.CENTER;
            connectingLbl.font = MenuManager.BUTTON_FONT;

            XNAButton loginButton = new XNAButton(this, new Rectangle(150, 210, 100, 40), "Log in");
            loginButton.font = MenuManager.BUTTON_FONT;
            loginButton.onClickListeners += this.LoginClicked;

            XNAButton backButton = new XNAButton(this, new Rectangle(150, 300, 100, 40), "Back");
            backButton.font = MenuManager.BUTTON_FONT;

            backButton.onClickListeners += this.BackClicked;
        }