Пример #1
0
        public StandardForm CreateHUDButtons()
        {
            var sf = new StandardForm(InternalWindows, _spriteBatch, _content, "");

            sf.SetBackgroundMaterial(@"GUI\Windows\ButtonBackground");
            sf.Size = new WindowSize(sf.BackgroundMaterial.Width, sf.BackgroundMaterial.Height);
            sf.SetFont(_textureManager.HUD_Font);
            sf.SetTitleColor(Color.Transparent);
            sf.IsTextVisible  = false;
            sf.IsStatic       = true;
            sf.Location       = new Vector2(_spriteBatch.GraphicsDevice.Viewport.Width / 2, 0);
            sf.OnUpdateEvent += HUDButtonsWindow_OnUpdateEvent;


            //System Button
            Button systemButton = CreateButton("", sf);

            systemButton.SetBackgroundMaterial(@"GUI\Windows\Button_SystemIcon");
            systemButton.OnClickEvent  += systemButton_OnClickEvent;
            systemButton.OnUpdateEvent += systemButton_OnUpdateEvent;
            systemButton.Size           = new WindowSize(systemButton.BackgroundMaterial.Width,
                                                         systemButton.BackgroundMaterial.Height);
            systemButton.Location = new Vector2(sf.Location.X, sf.Location.Y + 4);
            systemButton.IsStatic = true;

            //Galaxy Button
            Button galaxyButton = CreateButton("", sf);

            galaxyButton.SetBackgroundMaterial(@"GUI\Windows\Button_GalaxyIcon");
            galaxyButton.OnClickEvent  += galaxyButton_OnClickEvent;
            galaxyButton.OnUpdateEvent += galaxyButton_OnUpdateEvent;
            galaxyButton.Size           = new WindowSize(galaxyButton.BackgroundMaterial.Width,
                                                         galaxyButton.BackgroundMaterial.Height);
            galaxyButton.Location = new Vector2((sf.Location.X) + 1 * galaxyButton.BackgroundMaterial.Width,
                                                sf.Location.Y + 4);
            galaxyButton.IsStatic = true;

            //Galaxy Button
            Button debugButton = CreateButton("", sf);

            debugButton.SetBackgroundMaterial(@"GUI\Windows\Button_GalaxyIcon");
            debugButton.OnClickEvent  += debugButton_OnClickEvent;
            debugButton.OnUpdateEvent += debugButton_OnUpdateEvent;
            debugButton.Size           = new WindowSize(debugButton.BackgroundMaterial.Width,
                                                        debugButton.BackgroundMaterial.Height);
            debugButton.Location = new Vector2((sf.Location.X) + 1 * debugButton.BackgroundMaterial.Width,
                                               sf.Location.Y + 4);
            debugButton.IsStatic = true;
            sf.Show();
            return(sf);
        }
Пример #2
0
        public StandardForm CreateSystemWindow()
        {
            var sf = new StandardForm(InternalWindows, _spriteBatch, _content, "System");

            sf.SetFont(_textureManager.HUD_Font);
            sf.SetTitleColor(Color.Transparent);
            sf.Text = "Options";
            sf.SetBackgroundMaterial(_textureManager.Window700x560);
            sf.Size           = new WindowSize(sf.BackgroundMaterial.Width, sf.BackgroundMaterial.Height);
            sf.IsStatic       = false;
            sf.Centered       = true;
            sf.Transparency   = 5;
            sf.OnUpdateEvent += SystemWindow_OnUpdateEvent;
            sf.Location       = new Vector2(200, 50);
            sf.Show();
            return(sf);
        }
Пример #3
0
        public StandardForm CreateNotification(string context)
        {
            var sf = new StandardForm(InternalWindows, _spriteBatch, _content, "Notification");

            sf.SetFont(_textureManager.HUD_Font);
            sf.SetTitleColor(Color.Transparent);
            sf.Text     = context;
            sf.IsStatic = true;
            sf.Centered = true;
            sf.SetBackgroundMaterial(@"GUI\Windows\Notification250x100");
            sf.Size         = new WindowSize(sf.BackgroundMaterial.Width, sf.BackgroundMaterial.Height);
            sf.Location     = new Vector2(_spriteBatch.GraphicsDevice.Viewport.Width / 2 - sf.Size.Width / 2, 10);
            sf.WindowDown   = false;
            sf.Timer        = 1;
            sf.Transparency = 255;
            sf.Show();
            sf.OnUpdateEvent += NotificationUpdateEvent;
            return(sf);
        }
Пример #4
0
        public StandardForm CreateHealthShieldBars()
        {
            var sf = new StandardForm(InternalWindows, _spriteBatch, _content, "");

            sf.SetFont(_textureManager.HUD_Font);
            sf.SetTitleColor(Color.Transparent);
            sf.IsTextVisible = false;
            sf.SetBackgroundMaterial(@"GUI\Windows\3Bars");
            sf.Size     = new WindowSize(sf.BackgroundMaterial.Width, sf.BackgroundMaterial.Height);
            sf.IsStatic = false;
            sf.Centered = true;
            sf.Location = new Vector2(0, 0);

            //Static Button

            Button staticButton = CreateStaticButton("staticButton", sf);

            staticButton.Location = sf.Location;
            staticButton.Trigger  = true;
            staticButton.Size     = new WindowSize(staticButton.BackgroundMaterial.Width,
                                                   staticButton.BackgroundMaterial.Height);

            //Health Bar
            Bar b2 = CreateBar("", sf);

            b2.SetBackgroundMaterial(@"GUI\Windows\Bar_Health");
            b2.OnUpdateEvent += HealthBarUpdate;
            b2.Size           = new WindowSize(b2.BackgroundMaterial.Width, b2.BackgroundMaterial.Height);
            b2.Location       = new Vector2(0, 0);
            b2.IsStatic       = true;

            Label lbl = CreateLabel(ref sf, "Health");

            lbl.SetFont(_textureManager.HUD_Font);
            lbl.SetTextColor(Color.AntiqueWhite);
            lbl.OnUpdateEvent += HealthLabelUpdate;
            lbl.IsStatic       = true;
            lbl.Text           = "" + _shipManager.PlayerShip.CurrentHealth;
            //lbl.TextColor = Color.AntiqueWhite;
            lbl.Location =
                new Vector2(
                    (int)b2.Location.X + (b2.BackgroundMaterial.Width / 2f) -
                    (_debugTextManager.GetFont().MeasureString(b2.Text).X / 2f),
                    b2.Location.Y + (b2.BackgroundMaterial.Height / 4f));


            //Shields Bar
            Bar b = CreateBar("", sf);

            b.SetBackgroundMaterial(@"GUI\Windows\Bar_Shields");
            b.OnUpdateEvent += ShieldsBarUpdate;
            b.Size           = new WindowSize(b.BackgroundMaterial.Width, b.BackgroundMaterial.Height);
            b.IsStatic       = true;
            b.Location       = new Vector2(0, 33);

            Label lbl2 = CreateLabel(ref sf, "Shields");

            lbl2.SetFont(_textureManager.HUD_Font);
            lbl2.SetTextColor(Color.AntiqueWhite);
            lbl2.OnUpdateEvent += ShieldsLabelUpdate;
            lbl2.IsStatic       = true;
            lbl2.Text           = "" + _shipManager.PlayerShip.CurrentShields;
            //lbl2.TextColor = Color.LightBlue;
            lbl2.Location =
                new Vector2(
                    (int)b.Location.X + (b.BackgroundMaterial.Width / 2f) -
                    (_debugTextManager.GetFont().MeasureString(b.Text).X / 2f),
                    b.Location.Y + (b.BackgroundMaterial.Height / 4f));


            //Energy Bar
            Bar b3 = CreateBar("", sf);

            b3.SetBackgroundMaterial(@"GUI\Windows\Bar_Energy");
            b3.OnUpdateEvent += EnergyBarUpdate;
            b3.Size           = new WindowSize(b3.BackgroundMaterial.Width, b3.BackgroundMaterial.Height);
            b3.IsStatic       = true;
            b3.Location       = new Vector2(0, 66);

            Label lbl3 = CreateLabel(ref sf, "Energy");

            lbl3.SetFont(_textureManager.HUD_Font);
            lbl3.SetTextColor(Color.AntiqueWhite);
            lbl3.OnUpdateEvent += EnergyLabelUpdate;
            lbl3.IsStatic       = true;
            lbl3.Text           = "" + _shipManager.PlayerShip.CurrentShields;
            //lbl3.TextColor = Color.LightBlue;
            lbl3.Location =
                new Vector2(
                    (int)b3.Location.X + (b3.BackgroundMaterial.Width / 2f) -
                    (_debugTextManager.GetFont().MeasureString(b3.Text).X / 2f),
                    b3.Location.Y + (b3.BackgroundMaterial.Height / 4f));


            sf.Show();

            return(sf);
        }