public override bool Draw(Batcher2D batcher, Point position, Vector3?hue = null) { if (_edge == null) { _edge = new Texture2D(batcher.GraphicsDevice, 1, 1, false, SurfaceFormat.Color); _edge.SetData(new Color[] { Color.Gray }); } batcher.DrawRectangle(_edge, new Rectangle(position.X, position.Y, Width, Height), Vector3.Zero); return(base.Draw(batcher, position, hue)); }
public override bool Draw(Batcher2D batcher, int x, int y) { if (_edge == null) { _edge = new Texture2D(batcher.GraphicsDevice, 1, 1, false, SurfaceFormat.Color); _edge.SetData(new Color[] { Color.Gray }); } batcher.DrawRectangle(_edge, x, y, Width, Height, Vector3.Zero); return(base.Draw(batcher, x, y)); }
public override bool Draw(Batcher2D batcher, Point position, Vector3?hue = null) { if (IsDisposed || !SetName()) { return(false); } Point gWinPos = Engine.Profile.Current.GameWindowPosition; Point gWinSize = Engine.Profile.Current.GameWindowSize; float scale = Engine.SceneManager.GetScene <GameScene>().Scale; if (Entity is Mobile m) { GetAnimationDimensions(m, 0xFF, out int height, out int centerY); float x = (m.RealScreenPosition.X + gWinPos.X) / scale; float y = (m.RealScreenPosition.Y + gWinPos.Y) / scale; X = (int)(x + m.Offset.X) - (Width >> 1) + 22; Y = (int)(y + (m.Offset.Y - m.Offset.Z) - (height + centerY + 8)) - (Height >> 1) + (m.IsMounted ? 0 : 22); } else { X = (int)(Entity.RealScreenPosition.X / scale); Y = (int)(Entity.RealScreenPosition.Y / scale); } if (_edge == null) { _edge = new Texture2D(batcher.GraphicsDevice, 1, 1, false, SurfaceFormat.Color); _edge.SetData(new Color[] { Color.Gray }); } if (X < gWinPos.X || X + Width > gWinPos.X + gWinSize.X) { return(false); } if (Y < gWinPos.Y || Y + Height > gWinPos.Y + gWinSize.Y) { return(false); } position.X = X; position.Y = Y; batcher.DrawRectangle(_edge, new Rectangle(position.X - 1, position.Y - 1, Width + 1, Height + 1), Vector3.Zero); base.Draw(batcher, position, hue); return(_renderedText.Draw(batcher, new Rectangle(position.X + 2, position.Y + 2, Width, Height), 0, 0)); }
public override bool Draw(Batcher2D batcher, int x, int y) { if (IsDisposed || !SetName()) { return(false); } float scale = Engine.SceneManager.GetScene <GameScene>().Scale; int gx = Engine.Profile.Current.GameWindowPosition.X; int gy = Engine.Profile.Current.GameWindowPosition.Y; int w = Engine.Profile.Current.GameWindowSize.X; int h = Engine.Profile.Current.GameWindowSize.Y; if (Entity is Mobile m) { GetAnimationDimensions(m, 0, out int centerX, out int centerY, out int width, out int height); x = (int)((Entity.RealScreenPosition.X + m.Offset.X + 22) / scale); y = (int)((Entity.RealScreenPosition.Y + (m.Offset.Y - m.Offset.Z) - (height + centerY + 8)) / scale); } else { x = (int)((Entity.RealScreenPosition.X + 22) / scale); y = (int)((Entity.RealScreenPosition.Y) / scale); } x -= Width / 2; y -= Height / 2; x += gx + 6; y += gy; X = x; Y = y; if (x < gx || x + Width > gx + w) { return(false); } if (y < gy || y + Height > gy + h) { return(false); } batcher.DrawRectangle(Textures.GetTexture(Color.Gray), x - 1, y - 1, Width + 1, Height + 1, Vector3.Zero); base.Draw(batcher, x, y); return(_renderedText.Draw(batcher, x + 2, y + 2, Width, Height, 0, 0)); }
public override bool Draw(Batcher2D batcher, int x, int y) { if (IsDisposed || !SetName()) { return(false); } Point gWinPos = Engine.Profile.Current.GameWindowPosition; Point gWinSize = Engine.Profile.Current.GameWindowSize; float scale = Engine.SceneManager.GetScene <GameScene>().Scale; if (Entity is Mobile m) { GetAnimationDimensions(m, 0xFF, out int height, out int centerY); float xx = (m.RealScreenPosition.X + gWinPos.X) / scale; float yy = (m.RealScreenPosition.Y + gWinPos.Y) / scale; X = (int)(xx + m.Offset.X) - (Width >> 1) + 22; Y = (int)(yy + (m.Offset.Y - m.Offset.Z) - (height + centerY + 8)) - (Height >> 1) + (m.IsMounted ? 0 : 22); } else { X = (int)(Entity.RealScreenPosition.X / scale) - (Width >> 1) + 22; Y = (int)(Entity.RealScreenPosition.Y / scale) - (Height >> 1); } if (X < gWinPos.X || X + Width > gWinPos.X + gWinSize.X) { return(false); } if (Y < gWinPos.Y || Y + Height > gWinPos.Y + gWinSize.Y) { return(false); } x = X; y = Y; batcher.DrawRectangle(Textures.GetTexture(Color.Gray), x - 1, y - 1, Width + 1, Height + 1, Vector3.Zero); base.Draw(batcher, x, y); return(_renderedText.Draw(batcher, x + 2, y + 2, Width, Height, 0, 0)); }
public override bool Draw(Batcher2D batcher, int x, int y) { base.Draw(batcher, x, y); batcher.Draw2D(_line, x + 30, y + 50, 260, 1, ShaderHuesTraslator.GetHueVector(0, false, .5f, false)); batcher.Draw2D(_line, x + 95, y + 50, 1, 200, ShaderHuesTraslator.GetHueVector(0, false, .5f, false)); batcher.Draw2D(_line, x + 245, y + 50, 1, 200, ShaderHuesTraslator.GetHueVector(0, false, .5f, false)); batcher.Draw2D(_line, x + 30, y + 250, 260, 1, ShaderHuesTraslator.GetHueVector(0, false, .5f, false)); if (_edge == null) { _edge = new Texture2D(batcher.GraphicsDevice, 1, 1, false, SurfaceFormat.Color); _edge.SetData(new Color[] { Color.Gray }); } batcher.DrawRectangle(_edge, x, y, Width, Height, Vector3.Zero); return(true); }
public override bool Draw(Batcher2D batcher, Point position, Vector3?hue = null) { base.Draw(batcher, position, hue); batcher.Draw2D(_line, new Rectangle(position.X + 30, position.Y + 50, 260, 1), ShaderHuesTraslator.GetHueVector(0, false, .5f, false)); batcher.Draw2D(_line, new Rectangle(position.X + 95, position.Y + 50, 1, 200), ShaderHuesTraslator.GetHueVector(0, false, .5f, false)); batcher.Draw2D(_line, new Rectangle(position.X + 245, position.Y + 50, 1, 200), ShaderHuesTraslator.GetHueVector(0, false, .5f, false)); batcher.Draw2D(_line, new Rectangle(position.X + 30, position.Y + 250, 260, 1), ShaderHuesTraslator.GetHueVector(0, false, .5f, false)); if (_edge == null) { _edge = new Texture2D(batcher.GraphicsDevice, 1, 1, false, SurfaceFormat.Color); _edge.SetData(new Color[] { Color.Gray }); } batcher.DrawRectangle(_edge, new Rectangle(position.X, position.Y, Width, Height), Vector3.Zero); return(true); }
public override bool Draw(Batcher2D batcher, int x, int y) { base.Draw(batcher, x, y); string text = _amount.ToString(); if (_amount >= 1000) { if (text.Length > 4) { if (text.Length > 5) // >= 100.000 { text = $"{text.Substring(0, 3)}K+"; } else // <= 10.000 { text = $"{text.Substring(0, 2)}K+"; } } else // 1.000 { text = $"{text[0]}K+"; } } batcher.DrawRectangle(Textures.GetTexture(Color.Gray), x, y, Width, Height, Vector3.Zero); if (_graphic != 0) { Vector3 hue = Vector3.Zero; hue.X = 59; hue.Y = 1; batcher.DrawString(Fonts.Bold, text, x + 2, y + Height - 15, hue); } return(true); }
public override bool Draw(Batcher2D batcher, int x, int y) { if (MouseIsOver) { batcher.DrawRectangle(Textures.GetTexture(Color.Gray), x, y, Width, Width, Vector3.Zero); } //batcher.Draw2D(CheckerTrans.TransparentTexture, new Rectangle(position.X, position.Y, Width, Width), ShaderHuesTraslator.GetHueVector(0, false, 0.5f, false)); base.Draw(batcher, x, y); string text = _amount.ToString(); if (_amount >= 1000) { text = $"{text[0]}K+"; } batcher.DrawString(Fonts.Regular, text, X + 1, Width, Vector3.Zero); return(true); }
public override bool Draw(Batcher2D batcher, Vector3 position, MouseOverList objectList) { if (!AllowedToDraw || IsDisposed) { return(false); } Texture.Ticks = Engine.Ticks; if (IsSelected && _text.Hue != 0x0035) { _text.Hue = 0x0035; _text.CreateTexture(); Texture = _text.Texture; } else if (!IsSelected && Hue != _text.Hue) { _text.Hue = Hue; _text.CreateTexture(); Texture = _text.Texture; } HueVector = ShaderHuesTraslator.GetHueVector(0); if (EdgeDetection) { GameScene gs = Engine.SceneManager.GetScene <GameScene>(); int width = Texture.Width - Bounds.X; int height = Texture.Height - Bounds.Y; if (position.X < Bounds.X) { position.X = Bounds.X; } else if (position.X > Engine.Profile.Current.GameWindowSize.X * gs.Scale - width) { position.X = Engine.Profile.Current.GameWindowSize.X * gs.Scale - width; } if (position.Y - Bounds.Y < 0) { position.Y = Bounds.Y; } else if (position.Y > Engine.Profile.Current.GameWindowSize.Y * gs.Scale - height) { position.Y = Engine.Profile.Current.GameWindowSize.Y * gs.Scale - height; } } bool ok = base.Draw(batcher, position, objectList); if (_edge == null) { _edge = new Texture2D(batcher.GraphicsDevice, 1, 1); _edge.SetData(new Color[] { Color.LightBlue }); } batcher.DrawRectangle(_edge, new Rectangle((int)position.X - Bounds.X, (int)position.Y - Bounds.Y, _text.Width, _text.Height), Vector3.Zero); return(ok); }