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); }
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); }
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); }
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); }
public StandardForm CreateAuxiliaryInformationPanels() { StandardForm sf = CreateStandardForm("Auxiliary"); sf.SetFont(_textureManager.HUD_Font); sf.HasTitleBar = false; sf.IsTextVisible = false; sf.SetBackgroundColor(Color.Transparent); sf.IsStatic = true; sf.Centered = true; sf.OnUpdateEvent += portDockedHud_OnUpdateEvent; sf.Location = new Vector2(_spriteBatch.GraphicsDevice.Viewport.Width - _textureManager.DockableTextBar.Width, _spriteBatch.GraphicsDevice.Viewport.Height - _textureManager.DockableTextBar.Height); // F**k this shit, hardcoded for now. int bars = 0; // Money Bar // Bar b = CreateBar("Money Display", sf); b.SetBackgroundMaterial(_textureManager.DockableTextBar); b.Location = new Vector2(sf.Location.X, sf.Location.Y + (b.BackgroundMaterial.Height * bars)); b.OnUpdateEvent += BarAlign; b.Size = new WindowSize(b.BackgroundMaterial.Width, b.BackgroundMaterial.Height); b.IsStatic = true; Label bl = AddLabelToTextPanel(b, sf); // This is where the actual text is stored // Here we set all of the variables bl.OnUpdateEvent += portCashDisplay_OnUpdateEvent; bl.Text = "Money: " + _shipManager.currentCash; bl.Location = new Vector2( (int)b.Location.X + b.BackgroundMaterial.Width - RightHandMargin - (_debugTextManager.GetFont().MeasureString(bl.Text).X), b.Location.Y); bars++; // Money Bar // Bar b2 = CreateBar("Shields Display", sf); b2.SetBackgroundMaterial(_textureManager.DockableTextBar); b2.Location = new Vector2(sf.Location.X, sf.Location.Y - (b2.BackgroundMaterial.Height * bars) + ((numberOfBars) * 2) - 1); b2.OnUpdateEvent += BarAlign; b2.Size = new WindowSize(b2.BackgroundMaterial.Width, b2.BackgroundMaterial.Height); b2.IsStatic = true; Label bl2 = AddLabelToTextPanel(b2, sf); // This is where the actual text is stored // Here we set all of the variables bl2.OnUpdateEvent += CurrentShields_OnUpdateEvent; if (_shipManager.PlayerShip != null) { bl2.Text = GetConcatinatedString("Hull: " + _shipManager.PlayerShip.CurrentHealth, "Shields: " + _shipManager.PlayerShip.CurrentShields, bl2.Font, bl2.Owner.Size.Width - RightHandMargin, RightHandMargin); } bl2.Location = new Vector2( (int)b2.Location.X + b2.BackgroundMaterial.Width - RightHandMargin - (_debugTextManager.GetFont().MeasureString(bl2.Text).X), b2.Location.Y); // Keeps from going off screen on resize sf.Size = new WindowSize(_textureManager.DockableTextBar.Width, _textureManager.DockableTextBar.Height * bars); sf.Show(); return(sf); }