コード例 #1
0
        public ProgressBar(String name, Rectangle area)
            : base(name, area)
        {
            barPanel = new Panel(String.Empty, area);
            barPanel.Texture = UserInterface.TexBar;
            barPanel.Color = Color.White;

            fillPanel = new Panel(String.Empty, new Rectangle(area.X, area.Y, 0, area.Height));
            fillPanel.Texture = UserInterface.TexBlank;
            fillPanel.Color = new Color(173, 216, 230, 100);

            label = new Label(name, area, Label.Fit.AlignCenter);
        }
コード例 #2
0
        public override void Initialize()
        {
            Viewport vp = manager.UI.GraphicsDevice.Viewport;

            Color bgColor = firstLoad ? Color.Black : new Color(0, 0, 0, 175);
            background = new Panel("Load BG", new Rectangle(0, 0, vp.Width, vp.Height), bgColor);

            int lbW = (int)(vp.Width * 0.8f);
            int lbH = (int)(vp.Height * 0.05f);
            Rectangle lbA = new Rectangle((vp.Width - lbW) / 2, (vp.Height - lbH) / 2, lbW, lbH);
            loadBar = new ProgressBar("Building...", lbA);

            title = new Label("Loading", new Rectangle(0, lbH/2, vp.Width, lbH*2), Label.Fit.AlignCenter);
        }
コード例 #3
0
        private void SetupMenu(Viewport vp)
        {
            menu.Clear();

            int menuHeight = vp.Height / 20;
            menuArea = new Rectangle(0, vp.Height - menuHeight, (int)(vp.Width * 0.7f), menuHeight);
            ControlMat menuSpace = new ControlMat(menuArea, 1, 5, 2, ControlMat.FillOrder.ColumnsFirst);
            int i = 0;

            Panel mPanel = new Panel("Menu Panel", new Rectangle(0, menuArea.Y, vp.Width, menuHeight), new Color(0, 0, 0, 128));
            mPanel.Texture = UserInterface.TexButtonM;
            menu.Add(mPanel);
            menu.Add(new Button("Menu", menuSpace.Spaces[i++], delegate() { manager.ChangeScreen(new MenuScreen(manager)); }));
            menu.Add(new Button("Drawing", menuSpace.Spaces[i++], delegate() { ChangeActiveCG(gc); }));
            menu.Add(new Button("Wildlife", menuSpace.Spaces[i++], delegate() { ChangeActiveCG(ac); }));
            menu.Add(new Button("Weather", menuSpace.Spaces[i++], delegate() { ChangeActiveCG(wc); }));
            menu.Add(new Button("Camera", menuSpace.Spaces[i++], delegate() { ChangeActiveCG(cc); }));
            timeLabel = new Label("Time", new Rectangle(menuSpace.Spaces[i - 1].Right, menuArea.Y, vp.Width - menuArea.Width, menuArea.Height), Label.Fit.AlignCenter);
            menu.Add(timeLabel);
        }
コード例 #4
0
        private void SetupComponents(Viewport vp, int pad)
        {
            int bHeight = (int)(0.05f * vp.Height);
            int bWidth = (int)(0.125f * vp.Width);

            Panel hmPanelBG = new Panel("HM Img BG", new Rectangle(pad, 2 * pad, vp.Width / 3, vp.Width / 3),
                new Color(0,0,0,128));
            controls.Add(hmPanelBG);
            
            Panel hmPanel = new Panel("Heightmap Img", new Rectangle(hmPanelBG.Area.X + 5, hmPanelBG.Area.Y + 5, 
                hmPanelBG.Area.Width - 10, hmPanelBG.Area.Height - 10), Color.White);
            hmPanel.Texture = Textures.Heightmaps[bs.HMIndex];
            controls.Add(hmPanel);

            // area where settings components are displayed
            Rectangle settingsPanelArea = new Rectangle(pad + hmPanel.Area.Right, 2 * pad,
                vp.Width - hmPanel.Area.Width - pad * 3, hmPanelBG.Area.Height);
            Panel settingsPanel = new Panel("Settings", settingsPanelArea, new Color(0, 0, 0, 128));
            controls.Add(settingsPanel);

            // setup the settings components for each tab
            SetupTerrainComponents(vp, settingsPanelArea);

            // button used to return to menu
            Button cancelButton = new Button("Cancel", new Rectangle(pad, vp.Height - bHeight - pad, bWidth,
                bHeight), delegate() { manager.ChangeScreen(new MenuScreen(manager)); });
            controls.Add(cancelButton);

            // button used to build the world
            Button buildButton = new Button("Build", new Rectangle(vp.Width - bWidth - pad, cancelButton.Area.Y,
                bWidth, bHeight), BuildWorld);
            controls.Add(buildButton);

            // button used to display previous heightmap
            Button prevButton = new Button("<", new Rectangle(pad, hmPanel.Area.Bottom + pad / 2,
                bWidth, bHeight), delegate() { hmPanel.Texture = Textures.Heightmaps[bs.HMIndex = bs.HMIndex == 
                    0 ? Textures.Heightmaps.Length - 1 : --bs.HMIndex]; });
            controls.Add(prevButton);

            // button used to display next heightmap
            Button nextButton = new Button(">", new Rectangle(hmPanel.Area.Right - bWidth, prevButton.Area.Y,
                bWidth, bHeight), delegate() { hmPanel.Texture = Textures.Heightmaps[bs.HMIndex = bs.HMIndex == 
                    Textures.Heightmaps.Length - 1 ? 0 : ++bs.HMIndex]; });
            controls.Add(nextButton); 
        }