public MenuComponent(string[] Values, Rectangle Position, string ButtonBgName, Color UnActiveColor, Color ActiveColor, string FontName, Vector2 LabelOffset)
        {
            Buttons = new List<Button>();
            Labels = new List<Label>();
            //this.Values = Values;
            this.Position = Position;

            for (int i = 0; i < Values.Length; i++)
            {
                Rectangle ButtonPos = new Rectangle((int)(Position.X), (int)(Position.Y + i * Position.Height / Values.Length), (int)(Position.Width), (int)(Position.Height / Values.Length));
                Button Button = new Button(ButtonPos, "", GeneralManager.Textures[ButtonBgName], UnActiveColor, ActiveColor, FontName);
                Buttons.Add(Button);

                Label L = new Label();
                L.Font = GeneralManager.Fonts[FontName];
                L.Name = Values[i];
                L.Position = new Rectangle(ButtonPos.X + (int)LabelOffset.X, ButtonPos.Y + (int)LabelOffset.Y, ButtonPos.Width - 2 * (int)LabelOffset.X, ButtonPos.Height - 2 * (int)LabelOffset.Y);
                Labels.Add(L);
            }
        }
Beispiel #2
0
        public MainMenuScreen(Game Game, int SizeX, int SizeY, Effect Effect)
            : base(Game, SizeX, SizeY, Effect)
        {
            MenuComponent Menu = new MenuComponent(new string[] { " New Game ", " Load Game " ,"Multiplayer", "Change Profile", "Options","    Exit    " }, GeneralManager.GetPartialRect(0.12f, 0.3f, 0.16f, 0.6f), "Textures/GUI/Button1", Color.DarkGray, Color.White, "Fonts/SteamWreck", new Vector2(10, 20));
            Menu.Buttons[0].Action = this.NewGame;
            Menu.Buttons[1].Action = this.LoadGame;
            Menu.Buttons[2].Action = this.Multiplayer;
            Menu.Buttons[3].Action = this.ChooseProfile;
            Menu.Buttons[4].Action = this.Settings;
            Menu.Buttons[5].Action = Parent.Exit;

            AddGUI(Menu);

            ParticleWorlds.Add(new VAPI.Particle.ParticleWorld2D(this));
            ParticleWorlds[0].Emmiters.Add(new SteamEmmiter(ParticleWorlds[0], GeneralManager.GetPartialVector(0.82f, 0.35f)));
            ParticleWorlds[0].Emmiters[0].Disable();

            Label PlayerName = new Label();
            PlayerName.Font = GeneralManager.Fonts["Fonts/SteamWreck"];
            PlayerName.Name = SteamAge.CurrentProfile.PlayerName;
            PlayerName.Position = GeneralManager.GetPartialRect(0.54f, 0.89f, 0.11f, 0.06f);
            AddGUI(PlayerName);
        }
        public ProfileSelectionScreen(Game Game, int x, int y)
            : base(Game, x, y)
        {
            float i = 0.1f;
            Buttons = new List<Button>();
            foreach (string P in Profile.AvalibleProfiles())
            {
                Button TmpButton = new Button(GeneralManager.GetPartialRect(0.3f, i, 0.3f, 0.14f), "", GeneralManager.Textures["Textures/GUI/Frame"], Color.Gray, Color.White, "Fonts/SteamWreck");
                AddGUI(TmpButton);
                Buttons.Add(TmpButton);
                Label TmpLabel = new Label();
                TmpLabel.Font = GeneralManager.Fonts["Fonts/SteamWreck"];
                TmpLabel.Name = P;
                TmpLabel.Position =GeneralManager.GetPartialRect(0.38f, i + 0.04f, 0.12f, 0.06f);
                AddGUI(TmpLabel);
                //SpriteBatch.Draw(Generanew Button(GeneralManager.GetPartialRect(0.3f, i, 0.3f, 0.14f)lManager.Textures["Textures/GUI/Frame"], GeneralManager.GetPartialRect(0.3f, i, 0.3f, 0.14f), Color.White);
                i += 0.15f;
            }

            Button ChooseButton = new Button(GeneralManager.GetPartialRect(0.15f, 0.85f, 0.3f, 0.14f), "", GeneralManager.Textures["Textures/GUI/Frame"], Color.Gray, Color.White, "Fonts/SteamWreck");
            ChooseButton.Action += Choose;
            AddGUI(ChooseButton);
            Label TmpLabel2 = new Label();
            TmpLabel2.Font = GeneralManager.Fonts["Fonts/SteamWreck"];
            TmpLabel2.Name = "Choose";
            TmpLabel2.Position = GeneralManager.GetPartialRect(0.23f,0.89f, 0.12f, 0.06f);
            AddGUI(TmpLabel2);

            Button NewButton = new Button(GeneralManager.GetPartialRect(0.45f, 0.85f, 0.3f, 0.14f), "", GeneralManager.Textures["Textures/GUI/Frame"], Color.Gray, Color.White, "Fonts/SteamWreck");
            NewButton.Action += ToNewProfile;
            AddGUI(NewButton);
            Label TmpLabel3 = new Label();
            TmpLabel3.Font = GeneralManager.Fonts["Fonts/SteamWreck"];
            TmpLabel3.Name = "New  Profile";
            TmpLabel3.Position = GeneralManager.GetPartialRect(0.53f, 0.89f, 0.12f, 0.06f);
            AddGUI(TmpLabel3);
        }