Ejemplo n.º 1
0
        public void CreateDefaultMenuScreen(string mainmenuName, ColorScheme activeColorScheme, List <string> labels)
        {
            ColorScheme scheme     = activeColorScheme;
            Color       background = scheme.Color1;
            Color       button1Col = scheme.Color3;
            Color       button2Col = scheme.Color1;

            AddBackground("blank", background);

            Panel leftPanel =
                new Panel(
                    new Rectangle(GUIManager.GetFractionOfWidth(0.1f), 0, GUIManager.GetFractionOfWidth(0.3f),
                                  SystemCore.GraphicsDevice.Viewport.Height), GUITexture.Textures["blank"]);

            leftPanel.MainColor = scheme.Color3;
            leftPanel.MainAlpha = 0.6f;
            AddControl(leftPanel);
            leftPanel.AddFadeInTransition(1000);


            Vector2 buttonSpace = new Vector2(0, GUIManager.GetFractionOfHeight(0.02f));
            float   spacing     = 50;


            int maxWidth  = 0;
            int maxHeight = 0;

            foreach (string l in labels)
            {
                Vector2 labelSize = GUIFonts.Fonts["neuropolitical"].MeasureString(l);
                if (labelSize.X > maxWidth)
                {
                    maxWidth = (int)labelSize.X;
                }
                if (labelSize.Y > maxHeight)
                {
                    maxHeight = (int)labelSize.Y;
                }
            }


            foreach (string label in labels)
            {
                var button1 = AddDefaultLabelledButton(new Vector2(GUIManager.GetFractionOfWidth(0.25f), screenMidPoint.Y - 100) + buttonSpace, label, maxWidth, maxHeight, button1Col, button2Col, Color.Black);
                button1.Name           = label;
                button1.MainAlpha      = 0f;
                button1.HighlightAlpha = 0.8f;
                buttonSpace.Y         += spacing;
                button1.AddFadeInTransition(2000);
            }



            var lab = new Label(GUIFonts.Fonts["neuropolitical"], mainmenuName);

            lab.Position  = new Vector2(GUIManager.GetFractionOfWidth(0.25f), GUIManager.GetFractionOfHeight(0.30f));
            lab.TextColor = Color.Black;
            AddControl(lab);
            lab.Name = "mainMenuLabel";
            lab.AddFadeInTransition(2000);
            lab.AddMovementTransition(500, new Vector2(0, -40));
        }