protected override void OnLoad(Microsoft.Xna.Framework.Content.ContentManager content, Microsoft.Xna.Framework.Graphics.GraphicsDevice gd) { Overlay = new DrawableRectangle(new GREATLib.Rect(0, 0, screenService.GameWindowSize.X, screenService.GameWindowSize.Y), Color.White); Overlay.Alpha = 0f; AddChild(Overlay); AddChild(Message = new DrawableLabel(),2); Message.Scale = new Vector2(2f); Message.RelativeOrigin = new Vector2(0.5f); Message.SetPositionInScreenPercent(50, 50); base.OnLoad(content, gd); }
protected override void OnLoad(Microsoft.Xna.Framework.Content.ContentManager content, Microsoft.Xna.Framework.Graphics.GraphicsDevice gd) { RedRectangle = new DrawableRectangle(new GREATLib.Rect(0, 0, screenService.GameWindowSize.X, screenService.GameWindowSize.Y), Color.Red); RedRectangle.Alpha = 0f; AddChild(RedRectangle); DrawableLabel deathMessage = new DrawableLabel(); deathMessage.Text = "You died!"; deathMessage.Scale = new Vector2(2f); deathMessage.RelativeOrigin = new Vector2(0.5f); deathMessage.SetPositionInScreenPercent(50, 40); AddChild(deathMessage,2); DeathTimer = new DrawableLabel(); DeathTimer.Text = DeathDuration.Seconds.ToString(); DeathTimer.Scale = new Vector2(2f); DeathTimer.RelativeOrigin = new Vector2(0.5f); DeathTimer.SetPositionInScreenPercent(50, 50); AddChild(DeathTimer,2); }
private void SetScore() { Kills = new DrawableLabel() { Text = "0"}; Deaths = new DrawableLabel() { Text = "0"}; TeamKills = new DrawableLabel() { Text = "0", Tint = Color.Green}; TeamDeaths = new DrawableLabel() { Text = "0", Tint = Color.Red}; AddChild(Kills,3); AddChild(Deaths,3); AddChild(TeamKills,3); AddChild(TeamDeaths,3); Kills.SetPositionRelativeToObject(ScoreBackground, new Vector2(20, 10)); Deaths.SetPositionRelativeToObject(Kills, new Vector2(70, 0)); TeamKills.SetPositionRelativeToObject(Deaths, new Vector2(120, 0)); TeamDeaths.SetPositionRelativeToObject(TeamKills, new Vector2(70, 0)); DrawableImage killIcon = new DrawableImage("UIObjects/killIcon"); DrawableImage deathIcon = new DrawableImage("UIObjects/deathIcon"); DrawableImage teamKillIcon = new DrawableImage("UIObjects/killIcon"); AddChild(killIcon,2); AddChild(deathIcon,2); AddChild(teamKillIcon,2); killIcon.SetPositionRelativeToObject(Kills, new Vector2(23, -2)); deathIcon.SetPositionRelativeToObject(Deaths, new Vector2(23, -2)); teamKillIcon.SetPositionRelativeToObject(TeamKills, new Vector2(23, -2)); }