Exemplo n.º 1
0
        /// <summary>
        /// @Author Steven
        /// </summary>
        /// <param name="game"></param>
        /// <param name="title"></param>
        public LobbyMenu(Game1 game, String title)
        {
            this.game = game;
            game.mainScreen.Desktop.Children.Clear(); //Clear the gui
            lobbyTitle = title;

            /* White background for UI */
            WhiteBackground = new Rectangle((int)game.mainScreen.Width / 2 - UIConstants.LOBBY_WHITE_BG.X, (int)game.mainScreen.Height / 2 - UIConstants.LOBBY_WHITE_BG.Y,
                                            UIConstants.LOBBY_WHITE_BG.Width, UIConstants.LOBBY_WHITE_BG.Height);

            /* Scrolling background */

            /* Menu's Banner */
            TexBanner = Game1.Assets.suMultiLobby;
            Banner    = new Rectangle((int)game.mainScreen.Width / 2 - UIConstants.SU_BANNER.X, (int)game.mainScreen.Height / 2 - UIConstants.SU_BANNER.Y,
                                      UIConstants.SU_BANNER.Width, UIConstants.SU_BANNER.Height);

            /* For constructing the list of players with LabelControls */
            playerLabelList = new List <LabelControl>();
            playerLabelList.Add(player1Label = GuiHelper.CreateLabel("Empty", 0, 0, UIConstants.LOBBY_PLAYER_LABEL.Width, UIConstants.LOBBY_PLAYER_LABEL.Height));
            playerLabelList.Add(player2Label = GuiHelper.CreateLabel("Empty", 0, 0, UIConstants.LOBBY_PLAYER_LABEL.Width, UIConstants.LOBBY_PLAYER_LABEL.Height));
            playerLabelList.Add(player3Label = GuiHelper.CreateLabel("Empty", 0, 0, UIConstants.LOBBY_PLAYER_LABEL.Width, UIConstants.LOBBY_PLAYER_LABEL.Height));
            playerLabelList.Add(player4Label = GuiHelper.CreateLabel("Empty", 0, 0, UIConstants.LOBBY_PLAYER_LABEL.Width, UIConstants.LOBBY_PLAYER_LABEL.Height));
            playerLabelList.Add(player5Label = GuiHelper.CreateLabel("Empty", 0, 0, UIConstants.LOBBY_PLAYER_LABEL.Width, UIConstants.LOBBY_PLAYER_LABEL.Height));
            playerLabelList.Add(player6Label = GuiHelper.CreateLabel("Empty", 0, 0, UIConstants.LOBBY_PLAYER_LABEL.Width, UIConstants.LOBBY_PLAYER_LABEL.Height));

            /* List of names used to correlate to the labels */
            playerNameList = new List <string>();
            playerNameList.Add("Player 1");
            playerNameList.Add("Player 2");
            playerNameList.Add("Player 3");
            playerNameList.Add("Player 4");
            playerNameList.Add("Player 5");
            playerNameList.Add("Player 6");

            /* List of Ships */
            shipSelectionList = new List <ShipButton>();
            shipSelectionList.Add(new ShipButton(new UFO(game)));
            shipSelectionList.Add(new ShipButton(new Scout(game)));
            shipSelectionList.Add(new ShipButton(new Zoid(game)));

            /* List of choices for ships */
            shipChoiceList = new List <ChoiceControl>();
            shipChoiceList.Add(shipChoice_1 = GuiHelper.CreateChoice("", 0, 0, UIConstants.LOBBY_CHOICE_RADIO.Width, UIConstants.LOBBY_CHOICE_RADIO.Height));
            shipChoiceList.Add(shipChoice_2 = GuiHelper.CreateChoice("", 0, 0, UIConstants.LOBBY_CHOICE_RADIO.Width, UIConstants.LOBBY_CHOICE_RADIO.Height));
            shipChoiceList.Add(shipChoice_3 = GuiHelper.CreateChoice("", 0, 0, UIConstants.LOBBY_CHOICE_RADIO.Width, UIConstants.LOBBY_CHOICE_RADIO.Height));

            /* Sets the default selected ship */
            lastButton = shipSelectionList[0];
            shipSelectionList[0].selected = true;
            shipChoiceList[0].Selected    = true;

            setGridDisplay(game.getScreenWidth() - UIConstants.LOBBY_SHIP_GRID.X, game.getScreenHeight() - UIConstants.LOBBY_SHIP_GRID.Y);

            CreateMenuControls(game.mainScreen);
            Background = Game1.Assets.guiRectangle;
            new Thread(updatePlayerList).Start();
        }
Exemplo n.º 2
0
        private void MenuVehiculo(Screen mainScreen)
        {
            ChoiceControl motoChoice            = new ChoiceControl();
            ChoiceControl autoChoice            = new ChoiceControl();
            ChoiceControl cuatroPorCuatroChoice = new ChoiceControl();

            motoChoice.Bounds = new UniRectangle(
                graphics.PreferredBackBufferWidth / 2 - 60, 275, 120.0f, 16.0f);
            motoChoice.Text     = "Moto";
            motoChoice.Selected = true;
            mainScreen.Desktop.Children.Add(motoChoice);
            //
            // autoChoice
            //
            autoChoice.Bounds = new UniRectangle(
                graphics.PreferredBackBufferWidth / 2 - 60, 295, 120.0f, 16.0f);
            autoChoice.Text = "Auto";
            mainScreen.Desktop.Children.Add(autoChoice);
            //
            // cuatroPorCuatroChoice
            //
            cuatroPorCuatroChoice.Bounds = new UniRectangle(
                graphics.PreferredBackBufferWidth / 2 - 60, 315, 120.0f, 16.0f);
            cuatroPorCuatroChoice.Text = "4x4";
            mainScreen.Desktop.Children.Add(cuatroPorCuatroChoice);

            ButtonControl jugarButton = new ButtonControl();

            jugarButton.Bounds = new UniRectangle(
                graphics.PreferredBackBufferWidth / 2 - 60, 350, 120.0f, 50.0f);
            jugarButton.Text = "Aceptar";
            mainScreen.Desktop.Children.Add(jugarButton);

            jugarButton.Pressed += delegate(object sender, EventArgs arguments)
            {
                if (motoChoice.Selected)
                {
                    vehiculo = Vehiculo.Moto();
                }
                else
                if (autoChoice.Selected)
                {
                    vehiculo = Vehiculo.Auto();
                }
                else
                if (cuatroPorCuatroChoice.Selected)
                {
                    vehiculo = Vehiculo.CuatroPorCuatro();
                }

                jugador = new Jugador(nombre, vehiculo);
                mainScreen.Desktop.Children.Clear();
                menuVehiculo   = false;
                menuDificultad = true;
            };
        }
Exemplo n.º 3
0
        private void MenuDificultad(Screen mainScreen)
        {
            ChoiceControl facilChoice    = new ChoiceControl();
            ChoiceControl moderadoChoice = new ChoiceControl();
            ChoiceControl dificilChoice  = new ChoiceControl();

            facilChoice.Bounds = new UniRectangle(
                graphics.PreferredBackBufferWidth / 2 - 60, 275, 120.0f, 16.0f);
            facilChoice.Text     = "Facil";
            facilChoice.Selected = true;
            mainScreen.Desktop.Children.Add(facilChoice);
            //
            // moderadoChoice
            //
            moderadoChoice.Bounds = new UniRectangle(
                graphics.PreferredBackBufferWidth / 2 - 60, 295, 120.0f, 16.0f);
            moderadoChoice.Text = "Moderado";
            mainScreen.Desktop.Children.Add(moderadoChoice);
            //
            // dificilChoice
            //
            dificilChoice.Bounds = new UniRectangle(
                graphics.PreferredBackBufferWidth / 2 - 60, 315, 120.0f, 16.0f);
            dificilChoice.Text = "Dificil";
            mainScreen.Desktop.Children.Add(dificilChoice);

            ButtonControl aceptarButton = new ButtonControl();

            aceptarButton.Bounds = new UniRectangle(
                graphics.PreferredBackBufferWidth / 2 - 60, 350, 120.0f, 50.0f);
            aceptarButton.Text = "Jugar";
            mainScreen.Desktop.Children.Add(aceptarButton);

            aceptarButton.Pressed += delegate(object sender, EventArgs arguments)
            {
                if (facilChoice.Selected)
                {
                    juego = new JuegoFacil(jugador);
                }
                else
                if (moderadoChoice.Selected)
                {
                    juego = new JuegoModerado(jugador);
                }
                else
                if (dificilChoice.Selected)
                {
                    juego = new JuegoDificil(jugador);
                }

                mapa           = juego.Mapa;
                menuDificultad = false;
                juegoActivo    = true;
                mainScreen.Desktop.Children.Clear();
            };
        }
Exemplo n.º 4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="FieldControl"/> class.
        /// </summary>
        public FieldControl()
        {
            _bubbles    = new BubbleField(Size, this);
            Bounds.Size = new UniVector(Bubble.Size * Size + 100, Bubble.Size * Size);

            var left = new UniScalar(1.0f, -80);

            _labelScore         = Children.AddLabel("Score: 0", left, new UniScalar(0, 0));
            _labelSelectedScore = Children.AddLabel("Selected: 0", left, new UniScalar(0, 15));
            _rStandart          = Children.AddRadio("Standart", left, new UniScalar(0, 30));
            _rContinuous        = Children.AddRadio("Continuous", left, new UniScalar(0, 45));
            _rShifter           = Children.AddRadio("Shifter", left, new UniScalar(0, 60));
            _rMegaShifter       = Children.AddRadio("Mega Shifter", left, new UniScalar(0, 75));
        }
Exemplo n.º 5
0
        /// <summary>
        /// Takes the center of the control and places it at the center of the client,
        /// makes the center of the client coordinate (0, 0)
        /// @Added by Steven
        /// </summary>
        /// <param name="text"></param>
        /// <param name="offSetX"></param>
        /// <param name="offSetY"></param>
        /// <param name="width"></param>
        /// <param name="height"></param>
        /// <param name="center"></param>
        /// <param name="XPos"></param>
        /// <param name="YPos"></param>
        /// <returns></returns>
        public static ChoiceControl CreateChoice(String text, int offSetX, int offSetY, int width, int height, bool center = true, float XPos = 0.0f, float YPos = 0.0f)
        {
            if (center)
            {
                XPos    = 0.5f;
                YPos    = 0.5f;
                offSetX = offSetX + (-1 * width / 2);
                offSetY = offSetY + (-1 * height / 2);
            }
            ChoiceControl choice = new ChoiceControl();

            choice.Text   = text;
            choice.Bounds = new UniRectangle(
                new UniScalar(XPos, offSetX), new UniScalar(YPos, offSetY), width, height);
            return(choice);
        }
Exemplo n.º 6
0
        private List <string> GetChoice()
        {
            List <string> choices = new List <string>();

            foreach (var item in Choices.Children)
            {
                if (item is Label)
                {
                    continue;
                }
                ChoiceControl choiceControl = item as ChoiceControl;
                choices.Add(choiceControl.GetChoiceinformation().ToString());
            }

            return(choices);
        }
Exemplo n.º 7
0
        private void CreatePanel()
        {
            _panel = new Container();
            _panel.Bounds.Location = new UniVector(Left, new UniScalar(0.0f, -30f));
            _panel.Bounds.Size     = new UniVector(200, 200);
            _screen.Desktop.Children.Add(_panel);
            var left = new UniScalar(0.0f, 0f);

            _radioEasy   = _panel.Children.AddRadio("Easy", left, new UniScalar(0.0f, 0f));
            _radioNormal = _panel.Children.AddRadio("Normal", left, new UniScalar(0.0f, 20f));
            _radioHard   = _panel.Children.AddRadio("Hard", left, new UniScalar(0.0f, 40f));

            _radioEasy.Selected = true;

            // Button to open another "New Game" dialog
            var newGameButton = _panel.Children.AddButton("New Game", left, new UniScalar(0.0f, 60f));

            newGameButton.Pressed += (sender, arguments) => _box.Controller.NewGame(Difficulty);
        }
Exemplo n.º 8
0
        private async void CreateChoice(string[] choices)
        {
            foreach (string choice in choices)
            {
                try
                {
                    var result = await questionServer.GetRequest(Uris.BaseUrl + Uris.ChoiceQuestion + "Get", new entity <long>()
                    {
                        id = long.Parse(choice)
                    });

                    ChoiceControl choiceControl = new ChoiceControl(index, result);
                    Choices.Children.Add(choiceControl);
                    index++;
                }
                catch (Exception e)
                {
                    continue;
                }
            }
        }
Exemplo n.º 9
0
        private void CreateControls()
        {
            _titleLabel = new LabelControl("Options")
            {
                Bounds = new UniRectangle(new UniScalar(0.5f, -32), new UniScalar(0.1f, -70), 100, 30)
            };

            _fullscreenLabel = new LabelControl("FullScreen: ")
            {
                Bounds =
                    new UniRectangle(new UniScalar(0.5f, -50), new UniScalar(0.25f, -70), 80, 30)
            };

            _fullscreenButton = new OptionControl
            {
                Bounds =
                    new UniRectangle(new UniScalar(0.5f, 30), new UniScalar(0.25f, -70), 100, 30)
            };

            _keyboardLabel = new LabelControl("Keyboard:")
            {
                Bounds =
                    new UniRectangle(new UniScalar(0.5f, -110), new UniScalar(0.4f, -70), 50, 30)
            };

            _backButton = new ButtonControl
            {
                Text   = "Back",
                Bounds = new UniRectangle(new UniScalar(0.5f, -50), new UniScalar(1.1f, -70), 100, 30)
            };

            /*
             * _upVolume = new ButtonControl
             * {
             *  Text = "+",
             *  Bounds = new UniRectangle(new UniScalar(0.5f, -50), new UniScalar(0.9f, -70), 100, 30)
             * };
             *
             * _downVolume = new ButtonControl
             * {
             *  Text = "-",
             *  Bounds = new UniRectangle(new UniScalar(0.5f, -50), new UniScalar(0.9f, -30), 100, 30)
             * };
             *
             * _volumeLabel = new LabelControl("Volume:")
             * {
             *  Bounds =
             *      new UniRectangle(new UniScalar(0.62f, -220), new UniScalar(0.94f, -70), 70, 30)
             * };
             *
             * _volumeValueLabel = new LabelControl
             * {
             *  Text = Math.Round(Settings.Default.Volume, 1).ToString(CultureInfo.InvariantCulture),
             *  Bounds =
             *      new UniRectangle(new UniScalar(1.0f, -220), new UniScalar(0.94f, -70), 70, 30)
             * };*/

            _keyboardList = new ListControl
            {
                Bounds = new UniRectangle(350f, 125f, 150f, 50f)
            };

            _keyboardList.Items.Add("A, S, D, W");
            _keyboardList.Items.Add("Arrows");
            _keyboardList.Slider.Bounds.Location.X.Offset -= 1.0f;
            _keyboardList.Slider.Bounds.Location.Y.Offset += 1.0f;
            _keyboardList.Slider.Bounds.Size.Y.Offset     -= 2.0f;
            _keyboardList.SelectionMode = ListSelectionMode.Single;

            _cursorLabel = new LabelControl("Cursor:")
            {
                Bounds =
                    new UniRectangle(new UniScalar(0.5f, -220), new UniScalar(0.58f, -70), 70, 30)
            };

            _arrowButton = new ChoiceControl
            {
                Bounds =
                    new UniRectangle(new UniScalar(0.5f, -150f), new UniScalar(0.7f, -70), 70, 30)
            };

            _plusButton = new ChoiceControl
            {
                Bounds = new UniRectangle(new UniScalar(0.5f, -60f), new UniScalar(0.7f, -70), 70, 30)
            };


            _crossButton = new ChoiceControl
            {
                Bounds = new UniRectangle(new UniScalar(0.5f, 30f), new UniScalar(0.7f, -70), 70, 30)
            };

            _targetButton = new ChoiceControl
            {
                Bounds =
                    new UniRectangle(new UniScalar(0.5f, 120f), new UniScalar(0.7f, -70), 70, 30)
            };
        }