Esempio n. 1
0
        public override void Initialize()
        {
            Viewport vp = manager.UI.GraphicsDevice.Viewport;

            settings = new ControlGroup();

            int       pad   = (int)(0.05f * vp.Width);
            Rectangle pArea = new Rectangle(pad, (int)(0.15f * vp.Height), vp.Width - 2 * pad, (int)(0.35f * vp.Height));

            settings.Add(new Panel("Main Panel", pArea, new Color(0, 0, 0, 100)));
            settings.Add(new Label("Graphics Settings", new Rectangle(pArea.X, pArea.Y, pArea.Width, (int)Fonts.Arial.MeasureString("Graphics Settings").Y),
                                   Label.Fit.AlignCenter));

            ControlMat mat = new ControlMat(pArea, 4, 3, 5);


            Checkbox drawDetailBox = new Checkbox("Terrain Detail", new Rectangle(0, 0, 50, 50));

            drawDetailBox.SetState(Sim.Settings.Graphics.Default.TerrainDetail);
            drawDetailBox.StateChanged += delegate() { Sim.Settings.Graphics.Default.TerrainDetail = drawDetailBox.State; };
            settings.Add(drawDetailBox);

            int    bHeight    = (int)(0.05f * vp.Height);
            int    bWidth     = (int)(0.125f * vp.Width);
            Button backButton = new Button("Back", new Rectangle(pad, vp.Height - bHeight - pad, bWidth,
                                                                 bHeight), delegate() { manager.ChangeScreen(new MenuScreen(manager)); });

            settings.Add(backButton);

            Button applyButton = new Button("Apply", new Rectangle(vp.Width - bWidth - pad, backButton.Area.Y,
                                                                   bWidth, bHeight), delegate() { });

            settings.Add(applyButton);
        }
        public override void Initialize()
        {
            Viewport vp = manager.UI.GraphicsDevice.Viewport;

            settings = new ControlGroup();

            int pad = (int)(0.05f * vp.Width);
            Rectangle pArea = new Rectangle(pad, (int)(0.15f * vp.Height), vp.Width - 2 * pad, (int)(0.35f * vp.Height));

            settings.Add(new Panel("Main Panel", pArea, new Color(0, 0, 0, 100)));
            settings.Add(new Label("Graphics Settings", new Rectangle(pArea.X, pArea.Y, pArea.Width, (int)Fonts.Arial.MeasureString("Graphics Settings").Y),
                Label.Fit.AlignCenter));

            ControlMat mat = new ControlMat(pArea, 4, 3, 5);


            Checkbox drawDetailBox = new Checkbox("Terrain Detail", new Rectangle(0, 0, 50, 50));
            drawDetailBox.SetState(Sim.Settings.Graphics.Default.TerrainDetail);
            drawDetailBox.StateChanged += delegate() { Sim.Settings.Graphics.Default.TerrainDetail = drawDetailBox.State; };
            settings.Add(drawDetailBox);

            int bHeight = (int)(0.05f * vp.Height);
            int bWidth = (int)(0.125f * vp.Width);
            Button backButton = new Button("Back", new Rectangle(pad, vp.Height - bHeight - pad, bWidth,
                bHeight), delegate() { manager.ChangeScreen(new MenuScreen(manager)); });
            settings.Add(backButton);

            Button applyButton = new Button("Apply", new Rectangle(vp.Width - bWidth - pad, backButton.Area.Y,
                bWidth, bHeight), delegate() { });
            settings.Add(applyButton);
        }
Esempio n. 3
0
 /// <summary>
 /// Sets the active control group from the menu groups
 /// </summary>
 private void ChangeActiveCG(ControlGroup toOpen)
 {
     if (activeGroup != null && activeGroup != toOpen)
     {
         activeGroup.Disable(manager.UI);
     }
     activeGroup = toOpen;
     activeGroup.ToggleEnabled(manager.UI);
 }
Esempio n. 4
0
        public override void Initialize()
        {
            Viewport vp = manager.UI.GraphicsDevice.Viewport;

            controls = new ControlGroup();

            int pad = (int)(0.05f * vp.Width);

            SetupComponents(vp, pad);
        }
        public override void Initialize()
        {
            Viewport vp = manager.UI.GraphicsDevice.Viewport;

            controls = new ControlGroup();

            int pad = (int)(0.05f * vp.Width);

            SetupComponents(vp, pad);
        }
Esempio n. 6
0
        public override void Initialize()
        {
            Viewport vp = manager.UI.GraphicsDevice.Viewport;

            menu = new ControlGroup();

            int       mW    = vp.Width / 4;
            int       mH    = vp.Height / 3;
            Rectangle mArea = new Rectangle((vp.Width - mW) / 2, (vp.Height - mH) / 2, mW, mH);

            ControlMat mat = new ControlMat(mArea, 5, 1, (int)(0.0125f * vp.Height));

            menu.Add(new Button("New", mat.Spaces[1],
                                delegate() { manager.ChangeScreen(new SetupScreen(manager)); }));
            //menu.Add(new Button("Settings", mat.Spaces[1],
            //    delegate() { manager.ChangeScreen(new SettingsScreen(manager)); }));
            menu.Add(new Button("Return", mat.Spaces[2],
                                delegate() { manager.ChangeScreen(manager.WorldScreen); }));
            menu.Add(new Button("Exit", mat.Spaces[3],
                                delegate() { manager.UI.Game.Exit(); }));
        }
        public override void Initialize()
        {
            Viewport vp = manager.UI.GraphicsDevice.Viewport;
            
            menu = new ControlGroup();

            int mW = vp.Width / 4;
            int mH = vp.Height / 3;
            Rectangle mArea = new Rectangle((vp.Width - mW) / 2, (vp.Height - mH) / 2, mW, mH);

            ControlMat mat = new ControlMat(mArea, 5, 1, (int)(0.0125f * vp.Height));

            menu.Add(new Button("New", mat.Spaces[1],
                delegate() { manager.ChangeScreen(new SetupScreen(manager)); }));
            //menu.Add(new Button("Settings", mat.Spaces[1],
            //    delegate() { manager.ChangeScreen(new SettingsScreen(manager)); }));
            menu.Add(new Button("Return", mat.Spaces[2],
                delegate() { manager.ChangeScreen(manager.WorldScreen); }));
            menu.Add(new Button("Exit", mat.Spaces[3],
                delegate() { manager.UI.Game.Exit(); }));
        }
 /// <summary>
 /// Sets the active control group from the menu groups
 /// </summary>
 private void ChangeActiveCG(ControlGroup toOpen)
 {
     if (activeGroup != null && activeGroup != toOpen)
         activeGroup.Disable(manager.UI);
     activeGroup = toOpen;
     activeGroup.ToggleEnabled(manager.UI);
 }