Exemple #1
0
        private void InitializeGui()
        {
            gui = new GuiManager(Context.Input, Context.Graphics.Device, Context.Graphics.SpriteBatch);

            // Radar
            radarLogic.Initialize(Context, player, gameClient.ServerEntities);
            gui.Elements.Add(radarLogic.Radar);

            // Weapon
            weaponBar = new WeaponBar();
            weaponBar.Initialize(Context);
            gui.Elements.Add(weaponBar);

            // Health
            healthBar = new HealthBar();
            healthBar.Initialize(Context);
            gui.Elements.Add(healthBar);

            // Notifications
            notifications = new Notifications();
            notifications.Initialize(Context, 10);
            gui.Elements.Add(notifications);

            gui.UpdateLayout();
        }
Exemple #2
0
        public override void UpdateLayout(GuiManager guiManager, Rectangle availableSize)
        {
            var bounds = Font.MeasureString(Text);

            Width = bounds.X;
            Height = bounds.Y;

            guiManager.Arrange(this, availableSize);
        }
        public override void Initialize(GameContext context)
        {
            base.Initialize(context);

            gui = new GuiManager(Context.Input, Context.Graphics.Device, Context.Graphics.SpriteBatch);
            buttons = new List<Button>();

            // Enable the mouse in this scene
            Context.Input.Mouse.AutoCenter = false;
            context.Input.Mouse.ShowCursor = true;
        }
        public override void UpdateLayout(GuiManager guiManager, Rectangle availableSize)
        {
            HorizontalAlignment = HorizontalAlignment.Left;
            VerticalAlignment = VerticalAlignment.Center;
            Margin = new Thickness(4, 0, 0, 0);
            Width = 300;
            Height = 40;

            guiManager.Arrange(this, availableSize);

            positionTitle = new Vector2(Position.X, Position.Y);
        }
        public override void Initialize(GameContext context)
        {
            base.Initialize(context);

            gui = new GuiManager(Context.Input, Context.Graphics.Device, Context.Graphics.SpriteBatch);

            InitializeInput();

            audioHandler = ServiceLocator.Get<IAudioHandler>();

            context.Input.Mouse.ShowCursor = true;
            context.Input.Mouse.AutoCenter = false;
        }
Exemple #6
0
        public override void UpdateLayout(GuiManager guiManager, Rectangle availableSize)
        {
            if (Width == 0f)
            {
                Width = Source.Width;
            }

            if (Height == 0f)
            {
                Height = Source.Height;
            }

            guiManager.Arrange(this, availableSize);
        }
Exemple #7
0
        public override void UpdateLayout(GuiManager guiManager, Rectangle availableSize)
        {
            HorizontalAlignment = HorizontalAlignment.Left;
            VerticalAlignment = VerticalAlignment.Bottom;
            Margin = new Thickness(16, 0, 0, 16);
            Width = 204;
            Height = 38;

            guiManager.Arrange(this, availableSize);

            positionAmount = new Vector2(Position.X + 7, Position.Y);
            positionTitle = new Vector2(Position.X + 83, Position.Y + 4);
            positionProgressBar = new Vector2(Position.X + 83, Position.Y + 17);

            UpdateProgressBar();
        }
Exemple #8
0
        public void InitializeGui(GuiManager gui)
        {
            menuOptions = new StackPanel();
            menuOptions.HorizontalAlignment = HorizontalAlignment.Left;
            menuOptions.VerticalAlignment = VerticalAlignment.Center;
            menuOptions.Margin = new Thickness(100, 40, 0, 0);
            menuOptions.Width = 176;
            menuOptions.Height = 400;
            menuOptions.Spacing.Bottom = 32;
            gui.Elements.Add(menuOptions);

            for (int i = 0; i < 5; i++)
            {
                menuOptions.Children.Add(GetMenuOption(i));
            }

            gui.UpdateLayout();
        }
Exemple #9
0
        public override void UpdateLayout(GuiManager guiManager, Rectangle availableSize)
        {
            HorizontalAlignment = HorizontalAlignment.Right;
            VerticalAlignment = VerticalAlignment.Bottom;
            Margin = new Thickness(0, 0, 16, 16);
            Width = 204;
            Height = 38;

            guiManager.Arrange(this, availableSize);

            int titleWidth = (int)context.Resources.Fonts["Hud.Small"].MeasureString("Health").X;

            positionAmount = new Vector2(Position.X + 128, Position.Y);
            positionTitle = new Vector2(Position.X + 123 - titleWidth, Position.Y + 4);
            positionProgressBar = new Vector2(Position.X + 5, Position.Y + 17);

            UpdateProgressBar();
        }
Exemple #10
0
        public void InitializeGui(GuiManager gui)
        {
            this.gui = gui;

            panel = new Panel();
            panel.HorizontalAlignment = HorizontalAlignment.Left;
            panel.VerticalAlignment = VerticalAlignment.Top;
            panel.Width = Context.View.Area.Width;
            panel.Height = Context.View.Area.Height;
            gui.Elements.Add(panel);

            menuOptions = new StackPanel();
            menuOptions.HorizontalAlignment = HorizontalAlignment.Left;
            menuOptions.VerticalAlignment = VerticalAlignment.Center;
            menuOptions.Margin = new Thickness(100, 40, 0, 0);
            menuOptions.Width = 176;
            menuOptions.Height = 400;
            menuOptions.Spacing.Bottom = 32;
            panel.Children.Add(menuOptions);

            // Add the address textbox to the stackpanel
            var textBoxInfo = new TextBoxInfo()
            {
                MaxLength = 100,
                SpriteFont = Context.Resources.Fonts["Global.Normal"],
                Background = Context.Resources.Textures["MainMenu.TextBox"]
            };
            textBoxIp = new TextBox("", textBoxInfo);
            textBoxIp.HorizontalAlignment = HorizontalAlignment.Left;
            textBoxIp.VerticalAlignment = VerticalAlignment.Top;
            textBoxIp.Width = 220;
            textBoxIp.Text = "";
            textBoxIp.EnterKeyDown += textBoxIp_EnterKeyDown;
            menuOptions.Children.Add(textBoxIp);

            for (int i = 0; i < 2; i++)
            {
                menuOptions.Children.Add(GetMenuOption(i));
            }

            gui.UpdateLayout();
        }
Exemple #11
0
        public override void UpdateLayout(GuiManager guiManager, Rectangle availableSize)
        {
            Width = Default.Width;
            Height = Default.Height;

            guiManager.Arrange(this, availableSize);

            textBlock.HorizontalAlignment = this.HorizontalAlignment;
            textBlock.VerticalAlignment = this.VerticalAlignment;
            textBlock.Margin = this.Margin;
            textBlock.UpdateLayout(guiManager, availableSize);
        }
Exemple #12
0
        public override void UpdateLayout(GuiManager guiManager, Rectangle availableSize)
        {
            Width = buttonStates.Default.Width;
            Height = buttonStates.Default.Height;

            guiManager.Arrange(this, availableSize);
        }
Exemple #13
0
 public virtual void UpdateLayout(GuiManager guiManager, Rectangle availableSize)
 {
 }
Exemple #14
0
        public override void UpdateLayout(GuiManager guiManager, Rectangle availableSize)
        {
            HorizontalAlignment = HorizontalAlignment.Right;
            VerticalAlignment = VerticalAlignment.Top;
            Margin = new Thickness(0, 15, 15, 0);
            Width = radarBaseImage.Width;
            Height = radarBaseImage.Height;

            guiManager.Arrange(this, availableSize);

            uiCenter = new Vector2(Position.X + (Width / 2), Position.Y + (Height / 2));
            uiCenterForRadarCompass = uiCenter;

            uiCenter -= new Vector2((radarEntityImage.Width / 2.0f), (radarEntityImage.Height / 2.0f));

            radarCompassOrigin = new Vector2((radarCompass.Width / 2), (radarCompass.Height / 2));
        }
Exemple #15
0
        public override void UpdateLayout(GuiManager guiManager, Rectangle availableSize)
        {
            guiManager.Arrange(this, availableSize);

            textBox.Width = Width;
            textBox.Height = 20;

            textBox.VerticalAlignment = VerticalAlignment.Bottom;
            textBox.HorizontalAlignment = HorizontalAlignment.Left;
            textBox.Margin = new Thickness(0, 0, 0, 0);

            var chatBoxBounds = new Rectangle((int)Position.X, (int)Position.Y, (int)Width, (int)Height);
            textBox.UpdateLayout(guiManager, chatBoxBounds);

            for (int i = 0; i < numberOfLines; i++)
            {
                textBlocks[i].Width = Width;
                textBlocks[i].Height = Height;
                textBlocks[i].VerticalAlignment = VerticalAlignment.Bottom;
                textBlocks[i].HorizontalAlignment = HorizontalAlignment.Left;
                textBlocks[i].Margin = new Thickness(5, 0, 0, 37 + (20 * i));
                textBlocks[i].UpdateLayout(guiManager, chatBoxBounds);
            }
        }
Exemple #16
0
 public override void UpdateLayout(GuiManager guiManager, Rectangle availableSize)
 {
 }