public override bool Draw(UltimaBatcher2D batcher, int x, int y) { ResetHueVector(); batcher.DrawRectangle(Texture2DCache.GetTexture(Color.Gray), x, y, Width, Height, ref _hueVector); return(base.Draw(batcher, x, y)); }
public override bool Draw(UltimaBatcher2D batcher, int x, int y) { base.Draw(batcher, x, y); if (ShowLock) { ResetHueVector(); UOTexture32 lock_texture = GumpsLoader.Instance.GetTexture(0x082C); if (lock_texture != null) { lock_texture.Ticks = Time.Ticks; if (UIManager.MouseOverControl != null && (UIManager.MouseOverControl == this || UIManager.MouseOverControl.RootParent == this)) { _hueVector.X = 34; _hueVector.Y = 1; } batcher.Draw2D(lock_texture, x + (Width - lock_texture.Width), y, ref _hueVector); } } ResetHueVector(); if (_anchorCandidate != null) { Point drawLoc = UIManager.AnchorManager.GetCandidateDropLocation(this, _anchorCandidate); if (drawLoc != Location) { Texture2D previewColor = Texture2DCache.GetTexture(Color.Silver); ResetHueVector(); _hueVector.Z = 0.5f; batcher.Draw2D(previewColor, drawLoc.X, drawLoc.Y, Width, Height, ref _hueVector); _hueVector.Z = 0; // double rectangle for thicker "stroke" batcher.DrawRectangle(previewColor, drawLoc.X, drawLoc.Y, Width, Height, ref _hueVector); batcher.DrawRectangle(previewColor, drawLoc.X + 1, drawLoc.Y + 1, Width - 2, Height - 2, ref _hueVector); } } return(true); }
public override bool Draw(UltimaBatcher2D batcher, int x, int y) { base.Draw(batcher, x, y); ResetHueVector(); _hueVector.Z = 0.5f; batcher.DrawRectangle(Textures.GetTexture(Color.Gray), x, y, Width, Height, ref _hueVector); return(true); }
public override bool Draw(UltimaBatcher2D batcher, int x, int y) { ResetHueVector(); batcher.DrawRectangle ( SolidColorTextureCache.GetTexture(Color.Gray), x - 1, y - 1, _background.Width + 1, _background.Height + 1, ref HueVector ); return(base.Draw(batcher, x, y)); }
public override bool Draw(UltimaBatcher2D batcher, int x, int y) { base.Draw(batcher, x, y); Vector3 hue = Vector3.Zero; hue.Z = 0.5f; batcher.DrawRectangle(Textures.GetTexture(Color.Gray), x, y, Width, Height, ref hue); return(true); }
public override bool Draw(UltimaBatcher2D batcher, int x, int y) { base.Draw(batcher, x, y); Texture2D color = Textures.GetTexture(ProfileManager.Current.CounterBarHighlightOnAmount && _amount < ProfileManager.Current.CounterBarHighlightAmount && _graphic != 0 ? Color.Red : Color.Gray); ResetHueVector(); batcher.DrawRectangle(color, x, y, Width, Height, ref _hueVector); return(true); }
public override bool Draw(UltimaBatcher2D batcher, int x, int y) { ResetHueVector(); HueVector.Z = 0.1f; batcher.Draw2D(backgroundTexture, x, y, Width, Height, ref HueVector); HueVector.Z = 0; batcher.DrawRectangle(SolidColorTextureCache.GetTexture(Color.Gray), x, y, Width, Height, ref HueVector); base.Draw(batcher, x, y); return(true); }
public override bool Draw(UltimaBatcher2D batcher, int x, int y) { base.Draw(batcher, x, y); batcher.DrawRectangle(Textures.GetTexture(Color.Gray), x, y + 15, Width, Height - 15, ref _vec); if (_texture.MouseIsOver) { _vec.Z = 0.7f; batcher.Draw2D(Textures.GetTexture(Color.Yellow), x + 1, y + 15, Width - 1, Height - 15, ref _vec); _vec.Z = 0; } return(true); }
public override bool Draw(UltimaBatcher2D batcher, int x, int y) { if (!IsVisible || IsDisposed) { return(false); } ResetHueVector(); base.Draw(batcher, x, y); ResetHueVector(); batcher.DrawRectangle(Texture2DCache.GetTexture(Color.Gray), x, y, Width, Height, ref _hueVector); return(true); }
public override bool Draw(UltimaBatcher2D 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+"; } } Texture2D color = Textures.GetTexture(Color.Gray); if (Engine.Profile.Current.CounterBarHighlightOnAmount && _amount < Engine.Profile.Current.CounterBarHighlightAmount && _graphic != 0) { color = Textures.GetTexture(Color.Red); } Vector3 hue = Vector3.Zero; batcher.DrawRectangle(color, x, y, Width, Height, ref hue); if (_graphic != 0) { hue.X = 59; hue.Y = 1; hue.Z = 0; batcher.DrawString(Fonts.Bold, text, x + 2, y + Height - 15, ref hue); } return(true); }
public override bool Draw(UltimaBatcher2D batcher, int x, int y) { base.Draw(batcher, x, y); if (_anchorCandidate != null) { Point drawLoc = Engine.UI.AnchorManager.GetCandidateDropLocation(this, _anchorCandidate); if (drawLoc != Location) { Texture2D previewColor = Textures.GetTexture(Color.Silver); ResetHueVector(); _hueVector.Z = 0.5f; batcher.Draw2D(previewColor, drawLoc.X, drawLoc.Y, Width, Height, ref _hueVector); _hueVector.Z = 0; // double rectangle for thicker "stroke" batcher.DrawRectangle(previewColor, drawLoc.X, drawLoc.Y, Width, Height, ref _hueVector); batcher.DrawRectangle(previewColor, drawLoc.X + 1, drawLoc.Y + 1, Width - 2, Height - 2, ref _hueVector); } } return(true); }
public override bool Draw(UltimaBatcher2D batcher, int x, int y) { Vector3 hueVector = ShaderHueTranslator.GetHueVector(0); batcher.DrawRectangle ( SolidColorTextureCache.GetTexture(Color.Gray), x, y, Width, Height, hueVector ); return(base.Draw(batcher, x, y)); }
public override bool Draw(UltimaBatcher2D batcher, int x, int y) { base.Draw(batcher, x, y); Texture2D color = SolidColorTextureCache.GetTexture ( MouseIsOver ? Color.Yellow : ProfileManager.CurrentProfile.CounterBarHighlightOnAmount && _amount < ProfileManager.CurrentProfile.CounterBarHighlightAmount && Graphic != 0 ? Color.Red : Color.Gray ); ResetHueVector(); batcher.DrawRectangle(color, x, y, Width, Height, ref HueVector); return(true); }
public override bool Draw(UltimaBatcher2D batcher, int x, int y) { ResetHueVector(); base.Draw(batcher, x, y); ResetHueVector(); batcher.DrawRectangle(Texture2DCache.GetTexture(Color.Gray), x, y + 15, Width, Height - 15, ref _hueVector); if (_texture.MouseIsOver) { _hueVector.Z = 0.7f; batcher.Draw2D(Texture2DCache.GetTexture(Color.Yellow), x + 1, y + 15, Width - 1, Height - 15, ref _hueVector); _hueVector.Z = 0; } return(true); }
public override bool Draw(UltimaBatcher2D batcher, int x, int y) { if (!IsVisible || IsDisposed) { return(false); } base.Draw(batcher, x, y); Vector3 hueVector = ShaderHueTranslator.GetHueVector(0); batcher.DrawRectangle ( SolidColorTextureCache.GetTexture(Color.Gray), x, y, Width, Height, hueVector ); return(true); }
public override bool Draw(UltimaBatcher2D batcher, int x, int y) { base.Draw(batcher, x, y); Item item = World.Items.Get(LocalSerial); Vector3 hueVector; if (item != null) { var texture = ArtLoader.Instance.GetStaticTexture(item.DisplayedGraphic, out var bounds); var rect = ArtLoader.Instance.GetRealArtBounds(item.DisplayedGraphic); hueVector = ShaderHueTranslator.GetHueVector(item.Hue, item.ItemData.IsPartialHue, 1f); Point originalSize = new Point(_hit.Width, _hit.Height); Point point = new Point(); if (rect.Width < _hit.Width) { originalSize.X = rect.Width; point.X = (_hit.Width >> 1) - (originalSize.X >> 1); } if (rect.Height < _hit.Height) { originalSize.Y = rect.Height; point.Y = (_hit.Height >> 1) - (originalSize.Y >> 1); } batcher.Draw ( texture, new Rectangle ( x + point.X, y + point.Y + _hit.Y, originalSize.X, originalSize.Y ), new Rectangle ( bounds.X + rect.X, bounds.Y + rect.Y, rect.Width, rect.Height ), hueVector ); } hueVector = ShaderHueTranslator.GetHueVector(0); batcher.DrawRectangle ( SolidColorTextureCache.GetTexture(Color.Gray), x, y + 15, Width, Height - 15, hueVector ); if (_hit.MouseIsOver) { hueVector.Z = 0.7f; batcher.Draw ( SolidColorTextureCache.GetTexture(Color.Yellow), new Rectangle ( x + 1, y + 15, Width - 1, Height - 15 ), hueVector ); hueVector.Z = 1; } return(true); }
public override bool Draw(UltimaBatcher2D 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) { if (_positionLocked) { x = _lockedPosition.X; y = _lockedPosition.Y; } else { FileManager.Animations.GetAnimationDimensions(m.AnimIndex, m.GetGraphicForAnimation(), /*(byte) m.GetDirectionForAnimation()*/ 0, /*Mobile.GetGroupForAnimation(m, isParent:true)*/ 0, m.IsMounted, /*(byte) m.AnimIndex*/ 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) + (!m.IsMounted ? 22 : 0)) / scale); } } else if (Entity.Texture != null) { switch (Entity.Texture) { case ArtTexture artText: x = (int)((Entity.RealScreenPosition.X + 22) / scale); y = (int)((Entity.RealScreenPosition.Y - (artText.ImageRectangle.Height >> 1)) / scale); break; default: x = (int)((Entity.RealScreenPosition.X + 22) / scale); y = (int)((Entity.RealScreenPosition.Y - (Entity.Texture.Height >> 1)) / scale); break; } } else { x = (int)((Entity.RealScreenPosition.X + 22) / scale); y = (int)((Entity.RealScreenPosition.Y + 22) / scale); } x -= Width >> 1; y -= Height >> 1; 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); } ResetHueVector(); batcher.DrawRectangle(Textures.GetTexture(Color.Black), x - 1, y - 1, Width + 1, Height + 1, ref _hueVector); base.Draw(batcher, x, y); int renderedTextOffset = Math.Max(0, Width - _renderedText.Width - 4) >> 1; return(_renderedText.Draw(batcher, x + 2 + renderedTextOffset, y + 2, Width, Height, 0, 0)); }
public override bool Draw(UltimaBatcher2D batcher, int x, int y) { base.Draw(batcher, x, y); Vector3 hueVector; if (ShowLock) { hueVector = ShaderHueTranslator.GetHueVector(0); var texture = GumpsLoader.Instance.GetGumpTexture(LOCK_GRAPHIC, out var bounds); if (texture != null) { if (UIManager.MouseOverControl != null && (UIManager.MouseOverControl == this || UIManager.MouseOverControl.RootParent == this)) { hueVector.X = 34; hueVector.Y = 1; } batcher.Draw ( texture, new Vector2(x + (Width - bounds.Width), y), bounds, hueVector ); } } hueVector = ShaderHueTranslator.GetHueVector(0); if (_anchorCandidate != null) { Point drawLoc = UIManager.AnchorManager.GetCandidateDropLocation(this, _anchorCandidate); if (drawLoc != Location) { Texture2D previewColor = SolidColorTextureCache.GetTexture(Color.Silver); hueVector = ShaderHueTranslator.GetHueVector(0, false, 0.5f); batcher.Draw ( previewColor, new Rectangle ( drawLoc.X, drawLoc.Y, Width, Height ), hueVector ); hueVector.Z = 0; // double rectangle for thicker "stroke" batcher.DrawRectangle ( previewColor, drawLoc.X, drawLoc.Y, Width, Height, hueVector ); batcher.DrawRectangle ( previewColor, drawLoc.X + 1, drawLoc.Y + 1, Width - 2, Height - 2, hueVector ); } } return(true); }
public bool Draw(UltimaBatcher2D batcher, int x, int y) { if (SerialHelper.IsValid(_serial) && World.OPL.TryGetRevision(_serial, out uint revision) && _hash != revision) { _hash = revision; Text = ReadProperties(_serial, out _textHTML); } if (string.IsNullOrEmpty(Text)) { return(false); } if (_lastHoverTime > Time.Ticks) { return(false); } if (_renderedText == null) { _renderedText = RenderedText.Create(string.Empty, font: 1, isunicode: true, style: FontStyle.BlackBorder, cell: 5, isHTML: true, align: TEXT_ALIGN_TYPE.TS_CENTER, recalculateWidthByInfo: true); } else if (_renderedText.Text != Text) { if (_maxWidth == 0) { FontsLoader.Instance.SetUseHTML(true); FontsLoader.Instance.RecalculateWidthByInfo = true; int width = FontsLoader.Instance.GetWidthUnicode(1, Text); if (width > 600) { width = 600; } width = FontsLoader.Instance.GetWidthExUnicode(1, Text, width, TEXT_ALIGN_TYPE.TS_CENTER, (ushort)FontStyle.BlackBorder); if (width > 600) { width = 600; } _renderedText.MaxWidth = width; FontsLoader.Instance.RecalculateWidthByInfo = false; FontsLoader.Instance.SetUseHTML(false); } else { _renderedText.MaxWidth = _maxWidth; } _renderedText.Text = _textHTML; } if (x < 0) { x = 0; } else if (x > Client.Game.Window.ClientBounds.Width - (_renderedText.Width + 8)) { x = Client.Game.Window.ClientBounds.Width - (_renderedText.Width + 8); } if (y < 0) { y = 0; } else if (y > Client.Game.Window.ClientBounds.Height - (_renderedText.Height + 8)) { y = Client.Game.Window.ClientBounds.Height - (_renderedText.Height + 8); } Vector3 hue = Vector3.Zero; ShaderHuesTraslator.GetHueVector(ref hue, 0, false, 0.3f, true); batcher.Draw2D(Texture2DCache.GetTexture(Color.Black), x - 4, y - 2, _renderedText.Width + 8, _renderedText.Height + 4, ref hue); batcher.DrawRectangle(Texture2DCache.GetTexture(Color.Gray), x - 4, y - 2, _renderedText.Width + 8, _renderedText.Height + 4, ref hue); return(_renderedText.Draw(batcher, x + 3, y)); }
public bool Draw(UltimaBatcher2D batcher, int x, int y) { if (SerialHelper.IsValid(Serial) && World.OPL.TryGetRevision(Serial, out uint revision) && _hash != revision) { _hash = revision; Text = ReadProperties(Serial, out _textHTML); } if (string.IsNullOrEmpty(Text)) { return(false); } if (_lastHoverTime > Time.Ticks) { return(false); } byte font = 1; float alpha = 0.3f; ushort hue = 0xFFFF; float zoom = 1; if (ProfileManager.CurrentProfile != null) { font = ProfileManager.CurrentProfile.TooltipFont; alpha = 1f - ProfileManager.CurrentProfile.TooltipBackgroundOpacity / 100f; if (float.IsNaN(alpha)) { alpha = 1f; } hue = ProfileManager.CurrentProfile.TooltipTextHue; zoom = ProfileManager.CurrentProfile.TooltipDisplayZoom / 100f; } FontsLoader.Instance.SetUseHTML(true); FontsLoader.Instance.RecalculateWidthByInfo = true; if (_renderedText == null) { _renderedText = RenderedText.Create ( null, font: font, isunicode: true, style: FontStyle.BlackBorder, cell: 5, isHTML: true, align: TEXT_ALIGN_TYPE.TS_CENTER, recalculateWidthByInfo: true, hue: hue ); } if (_renderedText.Text != Text) { if (_maxWidth == 0) { int width = FontsLoader.Instance.GetWidthUnicode(font, Text); if (width > 600) { width = 600; } width = FontsLoader.Instance.GetWidthExUnicode ( font, Text, width, TEXT_ALIGN_TYPE.TS_CENTER, (ushort)FontStyle.BlackBorder ); if (width > 600) { width = 600; } _renderedText.MaxWidth = width; } else { _renderedText.MaxWidth = _maxWidth; } _renderedText.Font = font; _renderedText.Hue = hue; _renderedText.Text = _textHTML; } FontsLoader.Instance.RecalculateWidthByInfo = false; FontsLoader.Instance.SetUseHTML(false); if (_renderedText.Texture == null) { return(false); } int z_width = _renderedText.Width + 8; int z_height = _renderedText.Height + 8; if (x < 0) { x = 0; } else if (x > Client.Game.Window.ClientBounds.Width - z_width) { x = Client.Game.Window.ClientBounds.Width - z_width; } if (y < 0) { y = 0; } else if (y > Client.Game.Window.ClientBounds.Height - z_height) { y = Client.Game.Window.ClientBounds.Height - z_height; } Vector3 hue_vec = Vector3.Zero; ShaderHueTranslator.GetHueVector(ref hue_vec, 0, false, alpha); batcher.Draw2D ( SolidColorTextureCache.GetTexture(Color.Black), x - 4, y - 2, z_width * zoom, z_height * zoom, ref hue_vec ); batcher.DrawRectangle ( SolidColorTextureCache.GetTexture(Color.Gray), x - 4, y - 2, (int)(z_width * zoom), (int)(z_height * zoom), ref hue_vec ); hue_vec.X = 0; hue_vec.Y = 0; hue_vec.Z = 0; return(batcher.Draw2D ( _renderedText.Texture, x + 3, y + 3, z_width * zoom, z_height * zoom, 0, 0, z_width, z_height, ref hue_vec )); }