Пример #1
0
        public override void LoadContent()
        {
            panelTexture = ScreenManager.Content.Load<Texture2D>("Textures/panel");

            Controls.Add(panel = new PanelControl(ScreenManager));

            // panel.Background = new SolidColorBrush(ScreenManager) { Color = new Color(211, 191, 143) };
            panel.Background = NineTileBrush.FromFullTexture(panelTexture, 30, 30);
            panel.Position = new Index2(
                (ScreenManager.ScreenSize.X - 600) / 2,
                (ScreenManager.ScreenSize.Y - 400) / 2);
            panel.Size = new Index2(600, 400);

            headline = new LabelControl(ScreenManager)
            {
                Font = ScreenManager.NormalText,
                Text = "Inventory",
                Color = Color.Black,
                Position = new Index2(
                    ((ScreenManager.ScreenSize.X - 600) / 2) + 100,
                    ((ScreenManager.ScreenSize.Y - 400) / 2) + 40),
            };
            Controls.Add(headline);

            counter = new LabelControl(ScreenManager)
            {
                Font = ScreenManager.NormalText,
                Color = Color.Black,
                Position = new Index2(((ScreenManager.ScreenSize.X - 600) / 2) + 100,
                    ((ScreenManager.ScreenSize.Y - 400) / 2) + 140),
            };
            Controls.Add(counter);

            closeButton = new ButtonControl(ScreenManager) {
                Background = new SolidColorBrush(ScreenManager) { Color = Color.DarkBlue },
                Hovered = new SolidColorBrush(ScreenManager) { Color = Color.Blue },
                Font = ScreenManager.NormalText,
                Text = "Close",
                Color = Color.White,
                Position = new Index2(
                    ((ScreenManager.ScreenSize.X - 600) / 2) + 100,
                    ((ScreenManager.ScreenSize.Y - 400) / 2) + 170),
                Size = new Index2(200, 50),
            };
            closeButton.MouseUp += closeButton_MouseUp;

            Controls.Add(closeButton);

            foreach (var control in Controls)
                control.LoadContent();
        }
Пример #2
0
        public override void LoadContent()
        {
            pix = Hud.Game.Content.Load<Texture2D>("Textures/pix");
            panelTexture = Hud.Game.Content.Load<Texture2D>("Textures/panel");

            Controls.Add(panel = new PanelControl(Hud));

            panel.BackgroundTexture = panelTexture;
            panel.Position = new Index2(
                (Hud.GraphicsDevice.Viewport.Width - 600) / 2,
                (Hud.GraphicsDevice.Viewport.Height - 400) / 2);
            panel.Size = new Index2(600, 400);

            foreach (var control in Controls)
                control.LoadContent();
        }