public void Draw(ScreenManager screenManager, Rectangle rect) { string str; Color color; screenManager.SpriteBatch.Draw(ResourceManager.TextureDict["UI/dan_button"], rect, Color.White); Vector2 tPos = new Vector2((float)(rect.X + 25), (float)(rect.Y + 12 - Fonts.Arial12Bold.LineSpacing / 2)); Vector2 pos = tPos; if (GlobalStats.Config.Language == "German") { pos.X = pos.X - 9f; } SpriteBatch spriteBatch = screenManager.SpriteBatch; SpriteFont arial12Bold = Fonts.Arial12Bold; str = (this.Toggled ? this.ToggledText : this.Text); Vector2 vector2 = pos; if (this.Hover) { color = new Color(255, 255, 255, 150); } else { color = (this.Toggled ? new Color(121, 98, 75) : Color.White); } spriteBatch.DrawString(arial12Bold, str, vector2, color); }
public void Draw(ScreenManager screenManager) { if (this.Hover) { screenManager.SpriteBatch.Draw(ResourceManager.TextureDict[this.hPath], this.r, Color.White); return; } screenManager.SpriteBatch.Draw(ResourceManager.TextureDict[this.tPath], this.r, Color.White); }
public void Draw(ScreenManager screenManager) { if (this.Hover) { screenManager.SpriteBatch.Draw(ResourceManager.TextureDict["NewUI/Close_Hover"], this.rect, Color.White); return; } screenManager.SpriteBatch.Draw(ResourceManager.TextureDict["NewUI/Close_Normal"], this.rect, Color.White); }
public ModEntry(ScreenManager sm, ModInformation mi, string name) { this.ModPath = name; this.mi = mi; this.PortraitTex = sm.Content.Load<Texture2D>(string.Concat("../Mods/", name, "/Textures/", mi.PortraitPath)); this.MainMenuTex = sm.Content.Load<Texture2D>(string.Concat("../Mods/", name, "/Textures/", mi.ModImagePath_1920x1280)); this.MainMenuMusic = mi.CustomMenuMusic; this.Version = mi.Version; }
public void HandleInput(InputState input, ScreenManager screenManager) { if (HelperFunctions.CheckIntersection(this.rect, input.CursorPosition)) { ToolTip.CreateTooltip(string.Concat(ResourceManager.GoodsDict[this.Good].Name, " storage. \n\n Click to change Import/Export settings"), screenManager); if (input.InGameSelect) { AudioManager.PlayCue("sd_ui_accept_alt3"); ThreeStateButton threeStateButton = this; threeStateButton.state = (ThreeStateButton.State)((int)threeStateButton.state + (int)ThreeStateButton.State.Out); if (this.state > ThreeStateButton.State.Store) { this.state = ThreeStateButton.State.In; } } } }
public void Draw(float points, ScreenManager screenManager, Vector2 Position, float width) { Color orange; Color color; string toDraw = this.Name; while (Fonts.Arial12Bold.MeasureString(toDraw).X < width - 20f) { toDraw = string.Concat(toDraw, " ."); } if (points < (float)this.Cost) { screenManager.SpriteBatch.DrawString(Fonts.Arial12Bold, toDraw, Position, Color.Gray); Position.X = Position.X + width; Position.X = Position.X - Fonts.Arial12Bold.MeasureString(this.Cost.ToString()).X; screenManager.SpriteBatch.DrawString(Fonts.Arial12Bold, this.Cost.ToString(), Position, Color.Gray); return; } SpriteBatch spriteBatch = screenManager.SpriteBatch; SpriteFont arial12Bold = Fonts.Arial12Bold; string str = toDraw; Vector2 position = Position; if (this.Selected) { orange = Color.Orange; } else { orange = (this.Hover ? Color.White : Color.LightGray); } spriteBatch.DrawString(arial12Bold, str, position, orange); Position.X = Position.X + width; Position.X = Position.X - Fonts.Arial12Bold.MeasureString(this.Cost.ToString()).X; SpriteBatch spriteBatch1 = screenManager.SpriteBatch; SpriteFont spriteFont = Fonts.Arial12Bold; string str1 = this.Cost.ToString(); Vector2 vector2 = Position; if (this.Selected) { color = Color.Orange; } else { color = (this.Hover ? Color.White : Color.LightGray); } spriteBatch1.DrawString(spriteFont, str1, vector2, color); }
public void Draw(ScreenManager screenManager) { if (this.Toggled) { Primitives2D.FillRectangle(screenManager.SpriteBatch, this.r, this.ToggleColor); } screenManager.SpriteBatch.Draw(ResourceManager.TextureDict[this.tPath], this.r, (this.Hover ? this.HoverColor : this.BaseColor)); if (this.SecondSkin != null) { if (this.Toggled) { Rectangle secondRect = new Rectangle(this.r.X + this.r.Width / 2 - ResourceManager.TextureDict[this.SecondSkin].Width / 2, this.r.Y + this.r.Height / 2 - ResourceManager.TextureDict[this.SecondSkin].Height / 2, ResourceManager.TextureDict[this.SecondSkin].Width, ResourceManager.TextureDict[this.SecondSkin].Height); screenManager.SpriteBatch.Draw(ResourceManager.TextureDict[this.SecondSkin], secondRect, Color.White); return; } Rectangle secondRect0 = new Rectangle(this.r.X + this.r.Width / 2 - ResourceManager.TextureDict[this.SecondSkin].Width / 2, this.r.Y + this.r.Height / 2 - ResourceManager.TextureDict[this.SecondSkin].Height / 2, ResourceManager.TextureDict[this.SecondSkin].Width, ResourceManager.TextureDict[this.SecondSkin].Height); screenManager.SpriteBatch.Draw(ResourceManager.TextureDict[this.SecondSkin], secondRect0, (this.Hover ? Color.LightGray : Color.Black)); } }
public void Draw(ScreenManager screenManager) { string str; Color color; Vector2 pos = this.TextPos; if (GlobalStats.Config.Language == "German") { pos.X = pos.X - 9f; } screenManager.SpriteBatch.Draw(ResourceManager.TextureDict["UI/dan_button"], this.r, Color.White); SpriteBatch spriteBatch = screenManager.SpriteBatch; SpriteFont arial12Bold = Fonts.Arial12Bold; str = (this.Toggled ? this.ToggledText : this.Text); Vector2 vector2 = pos; if (this.Hover) { color = new Color(255, 255, 255, 150); } else { color = (this.Toggled ? new Color(121, 98, 75) : Color.White); } spriteBatch.DrawString(arial12Bold, str, vector2, color); }
public bool HandleInput(InputState input, ScreenManager sm) { if (!HelperFunctions.CheckIntersection(this.clickRect, input.CursorPosition)) { //this.Hover = false; this.hovering = false; } else { //this.Hover = true; ToolTip.CreateTooltip(this.ID_tip, sm); if (this.SimpleToggle && input.InGameSelect) { AudioManager.PlayCue("sd_ui_accept_alt3"); switch (this.orderType) { case OrderType.TradeFood: { for (int i = 0; i < this.ShipList.Count; i++) { this.ShipList[i].GetAI().OrderTrade(); } return true; } //fbedard: keep only 1 trade button //case OrderType.TradeProduction: //{ // for (int i = 0; i < this.ShipList.Count; i++) // { // this.ShipList[i].GetAI().OrderTrade(); // } // return true; //} case OrderType.PassTran: { for (int i = 0; i < this.ShipList.Count; i++) { this.ShipList[i].GetAI().OrderTransportPassengers(); } return true; } case OrderType.TroopToggle: { return true; } case OrderType.Explore: { for (int i = 0; i < this.ShipList.Count; i++) { this.ShipList[i].GetAI().OrderExplore(); } return true; } case OrderType.OrderResupply: { for (int i = 0; i < this.ShipList.Count; i++) { this.ShipList[i].GetAI().OrderResupplyNearest(); } return true; } case OrderType.EmpireDefense: { for (int i = 0; i < this.ShipList.Count; i++) { Ship ship = this.ShipList[i]; lock (ship) { if (!EmpireManager.GetEmpireByName(Ship.universeScreen.PlayerLoyalty).GetGSAI().DefensiveCoordinator.DefensiveForcePool.Contains(ship)) { EmpireManager.GetEmpireByName(Ship.universeScreen.PlayerLoyalty).GetGSAI().DefensiveCoordinator.DefensiveForcePool.Add(ship); ship.GetAI().OrderQueue.Clear(); ship.GetAI().HasPriorityOrder = false; ship.GetAI().SystemToDefend = null; ship.GetAI().SystemToDefendGuid = Guid.Empty; ship.GetAI().State = AIState.SystemDefender; } else { EmpireManager.GetEmpireByName(Ship.universeScreen.PlayerLoyalty).GetGSAI().DefensiveCoordinator.remove(ship); ship.GetAI().OrderQueue.Clear(); ship.GetAI().HasPriorityOrder = false; ship.GetAI().SystemToDefend = null; ship.GetAI().SystemToDefendGuid = Guid.Empty; ship.GetAI().State = AIState.AwaitingOrders; } } } return true; } case OrderType.Scrap: { for (int i = 0; i < this.ShipList.Count; i++) { this.ShipList[i].GetAI().OrderScrapShip(); } return true; } default: { return true; } } } if (input.InGameSelect) { AudioManager.PlayCue("sd_ui_accept_alt3"); this.ValueToModify.Value = !this.ValueToModify.Value; return true; } if (input.RightMouseClick) { AudioManager.PlayCue("sd_ui_accept_alt3"); if (this.RightClickValueToModify != null) { this.RightClickValueToModify.Value = !this.RightClickValueToModify.Value; } return true; } } return this.hovering; }
protected override void Initialize() { base.Window.Title = "StarDrive"; base.Content.RootDirectory = "Content"; this.screenManager = new ScreenManager(this, this.graphics) { splashScreenGameComponent = new SplashScreenGameComponent(this, this.graphics) }; base.Components.Add(this.screenManager.splashScreenGameComponent); AudioManager.Initialize(this, "Content/Audio/ShipGameProject.xgs", "Content/Audio/Wave Bank.xwb", "Content/Audio/Sound Bank.xsb"); Game1.Instance = this; base.Initialize(); }