public override bool Draw(UltimaBatcher2D batcher, int x, int y) { base.Draw(batcher, x, y); ResetHueVector(); for (int i = 0; i < _container.Count; i++) { if (i + 1 >= _container.Count) { break; } Control c0 = _container[i]; Control c1 = _container[i + 1]; batcher.DrawLine ( Texture2DCache.GetTexture(Color.White), c0.ScreenCoordinateX, c0.ScreenCoordinateY, c1.ScreenCoordinateX, c1.ScreenCoordinateY, c0.ScreenCoordinateX + (c1.ScreenCoordinateX - c0.ScreenCoordinateX) / 2, c0.ScreenCoordinateY + (c1.ScreenCoordinateY - c0.ScreenCoordinateY) / 2 ); } return(true); }
protected override void LoadContent() { _textures = new Texture2DCache(typeof(Textures)); _spriteBatch = new SpriteBatch(Globals.GraphicsDevice); _markerAnchor_Blue = StaticSprite.Acquire(_textures[(int)Textures.Marker_Blue], new Vector2(4, 4)); _markerAnchor_Blue.LayerDepth = 0; _renderParamsTemplate.GetTexture_MarkCenter = new Getter <ISprite>(() => { return(_markerAnchor_Blue); }); _markerTopLeft_Red = StaticSprite.Acquire(_textures[(int)Textures.Marker_Red], new Vector2(4, 4)); _markerTopLeft_Red.LayerDepth = 0; _renderParamsTemplate.GetTexture_MarkOrigin = new Getter <ISprite>(() => { return(_markerTopLeft_Red); }); _markerCompositeAnchor_Green = StaticSprite.Acquire(_textures[(int)Textures.Marker_Green], new Vector2(4, 4)); _markerCompositeAnchor_Green.LayerDepth = 0; _renderParamsTemplate.GetTexture_MarkTopLeft = new Getter <ISprite>(() => { return(_markerCompositeAnchor_Green); }); List <Vector2> vertices = new List <Vector2>(); vertices.Add(new Vector2(100, 100)); vertices.Add(new Vector2(150, 50)); vertices.Add(new Vector2(200, 100)); vertices.Add(new Vector2(120, 120)); _polygon = new PolygonExtent(); _polygon.Reset(vertices); _polygon.ReAnchor(_polygon.ActualCenter); _contentLoaded = true; }
protected override void LoadContent() { _textures = new Texture2DCache(typeof(Textures)); _spriteBatch = new SpriteBatch(Globals.GraphicsDevice); _child1 = StaticSprite.Acquire(_textures[(int)Textures.ColoredRect], new Vector2(100, 100)); _child1.LayerDepth = 1; _child2 = StaticSprite.Acquire(_textures[(int)Textures.GrayRect], new Vector2(25, 50)); _child2.RenderingExtent.Anchor = new Vector2(250, 250); _child2.LayerDepth = 1; _markerAnchor_Blue = StaticSprite.Acquire(_textures[(int)Textures.Marker_Blue], new Vector2(4, 4)); _markerAnchor_Blue.LayerDepth = 0; _renderParamsTemplate.GetTexture_MarkCenter = new Getter <ISprite>(() => { return(_markerAnchor_Blue); }); _markerTopLeft_Red = StaticSprite.Acquire(_textures[(int)Textures.Marker_Red], new Vector2(4, 4)); _markerTopLeft_Red.LayerDepth = 0; _renderParamsTemplate.GetTexture_MarkOrigin = new Getter <ISprite>(() => { return(_markerTopLeft_Red); }); _markerCompositeAnchor_Green = StaticSprite.Acquire(_textures[(int)Textures.Marker_Green], new Vector2(4, 4)); _markerCompositeAnchor_Green.LayerDepth = 0; _renderParamsTemplate.GetTexture_MarkTopLeft = new Getter <ISprite>(() => { return(_markerCompositeAnchor_Green); }); _compositeExtent = new CompositeExtent(); _compositeExtent.Add(_child1.RenderingExtent); _compositeExtent.Add(_child2.RenderingExtent); _contentLoaded = true; }
public override void UnloadContent() { SDL.SDL_GetWindowBordersSize(Window.Handle, out int top, out int left, out int bottom, out int right); Settings.GlobalSettings.WindowPosition = new Point(Math.Max(0, Window.ClientBounds.X - left), Math.Max(0, Window.ClientBounds.Y - top)); Settings.GlobalSettings.Save(); Plugin.OnClosing(); _hues_sampler[0]?.Dispose(); _hues_sampler[0] = null; _hues_sampler[1]?.Dispose(); _hues_sampler[1] = null; _scene?.Dispose(); AuraManager.Dispose(); UIManager.Dispose(); Texture2DCache.Dispose(); //NOTE: We force the sockets to disconnect in case they haven't already been disposed //This is good practice since the Client can be quit while the socket is still active if (NetClient.LoginSocket.IsDisposed == false) { NetClient.LoginSocket.Disconnect(); } if (NetClient.Socket.IsDisposed == false) { NetClient.Socket.Disconnect(); } base.UnloadContent(); }
protected override void LoadContent() { _textures = new Texture2DCache(typeof(Textures)); _spriteBatch = new SpriteBatch(Globals.GraphicsDevice); for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { var sprite = StaticSprite.Acquire(_textures[(int)Textures.ColoredRect]); sprite.LayerDepth = 1; sprite.RenderingExtent.Anchor = new Vector2(100 + i * 250, 100 + j * 250); _sprites.Add(sprite); } } _viewportCenter = StaticSprite.Acquire(_textures[(int)Textures.Marker_Red], new Vector2(4, 4)); _viewportCenter.LayerDepth = 0; _sprites.Add(_viewportCenter); ScreenUtility.InitGraphicsMode(800, 480, false); _viewport.ResetWithScreenSize(800, 480); _contentLoaded = true; }
public override bool Draw(UltimaBatcher2D batcher, int x, int y) { ResetHueVector(); batcher.DrawRectangle(Texture2DCache.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) { ResetHueVector(); base.Draw(batcher, x, y); batcher.DrawRectangle(Texture2DCache.GetTexture(Color.Gray), x, y, Width, Height, ref _hueVector); return(true); }
public override bool Draw(UltimaBatcher2D batcher, int x, int y) { ResetHueVector(); ShaderHueTranslator.GetHueVector(ref _hueVector, Hue, false, Alpha); return(batcher.Draw2D(Texture2DCache.GetTexture(Color.Black), x, y, Width, Height, ref _hueVector)); }
protected override void LoadContent() { _spriteBatch = new SpriteBatch(Globals.GraphicsDevice); _textureCache = new Texture2DCache(typeof(Textures)); _animationStripTexture = _textureCache[(int)Textures.Explosion]; _sprite.ResetFromCenter(_animationStripTexture, 5, 5, new Vector2(100, 100)); }
public override bool Draw(UltimaBatcher2D batcher, int x, int y) { if (DrawBackgroundCurrentIndex && MouseIsOver && !string.IsNullOrWhiteSpace(Text)) { ResetHueVector(); batcher.Draw2D(Texture2DCache.GetTexture(Color.Gray), x, y + 2, Width - 4, Height - 4, ref _hueVector); } return(base.Draw(batcher, x, y)); }
protected override void LoadContent() { _spriteBatch = new SpriteBatch(Globals.GraphicsDevice); _textures = new Texture2DCache(typeof(Textures)); _spriteRed = StaticSprite.Acquire(_textures[(int)Textures.RectRedVertical]); _spriteRed.LayerDepth = 0; //front _spriteBlue = StaticSprite.Acquire(_textures[(int)Textures.RectBlueHorizontal]); _spriteBlue.LayerDepth = 1; //back }
public override bool Draw(UltimaBatcher2D batcher, int x, int y) { if (!string.IsNullOrWhiteSpace(_label.Text) && MouseIsOver) { ResetHueVector(); batcher.Draw2D(Texture2DCache.GetTexture(Color.Gray), x + 2, y + 5, Width - 4, Height - 10, ref _hueVector); } return(base.Draw(batcher, x, y)); }
public Line(int x, int y, int w, int h, uint color) { X = x; Y = y; Width = w; Height = h; _texture = Texture2DCache.GetTexture(new Color() { PackedValue = color }); }
public override void UnloadContent() { SDL.SDL_GetWindowBordersSize(Window.Handle, out int top, out int left, out int bottom, out int right); Settings.GlobalSettings.WindowPosition = new Point(Math.Max(0, Window.ClientBounds.X - left), Math.Max(0, Window.ClientBounds.Y - top)); _scene?.Unload(); Settings.GlobalSettings.Save(); Plugin.OnClosing(); ArtLoader.Instance.Dispose(); GumpsLoader.Instance.Dispose(); TexmapsLoader.Instance.Dispose(); AnimationsLoader.Instance.Dispose(); LightsLoader.Instance.Dispose(); TileDataLoader.Instance.Dispose(); AnimDataLoader.Instance.Dispose(); ClilocLoader.Instance.Dispose(); FontsLoader.Instance.Dispose(); HuesLoader.Instance.Dispose(); MapLoader.Instance.Dispose(); MultiLoader.Instance.Dispose(); MultiMapLoader.Instance.Dispose(); ProfessionLoader.Instance.Dispose(); SkillsLoader.Instance.Dispose(); SoundsLoader.Instance.Dispose(); SpeechesLoader.Instance.Dispose(); Verdata.File?.Dispose(); World.Map?.Destroy(); //NOTE: My dispose related changes, see if they're still necessary _hues_sampler[0]?.Dispose(); _hues_sampler[0] = null; _hues_sampler[1]?.Dispose(); _hues_sampler[1] = null; _scene?.Dispose(); AuraManager.Dispose(); UIManager.Dispose(); Texture2DCache.Dispose(); RenderedText.Dispose(); //NOTE: We force the sockets to disconnect in case they haven't already been disposed //This is good practice since the Client can be quit while the socket is still active if (NetClient.LoginSocket.IsDisposed == false) { NetClient.LoginSocket.Disconnect(); } if (NetClient.Socket.IsDisposed == false) { NetClient.Socket.Disconnect(); } base.UnloadContent(); }
public HitBox(int x, int y, int w, int h) { CanMove = false; AcceptMouseInput = true; Alpha = 0.75f; _texture = Texture2DCache.GetTexture(Color.White); X = x; Y = y; Width = w; Height = h; WantUpdateSize = false; }
public override bool Draw(UltimaBatcher2D batcher, int x, int y) { base.Draw(batcher, x, y); Texture2D color = Texture2DCache.GetTexture(MouseIsOver ? Color.Yellow : 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); }
protected override void LoadContent() { _textures = new Texture2DCache(typeof(Textures)); _spriteBatch = new SpriteBatch(Globals.GraphicsDevice); _sprite = StaticSprite.Acquire(_textures[(int)Textures.ColoredRect], new Vector2(100, 100)); _sprite.LayerDepth = 1; _markerAnchor_Blue = StaticSprite.Acquire(_textures[(int)Textures.Marker_Blue], new Vector2(4, 4)); _markerAnchor_Blue.LayerDepth = 0; _markerTopLeft_Red = StaticSprite.Acquire(_textures[(int)Textures.Marker_Red], new Vector2(4, 4)); _markerTopLeft_Red.LayerDepth = 0; }
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); }
private void BuildGump() { Width = 88; Height = 44; label = new Label(_macro.Name, true, 1001, Width, 255, FontStyle.BlackBorder, TEXT_ALIGN_TYPE.TS_CENTER) { X = 0, Width = Width - 10, }; label.Y = (Height >> 1) - (label.Height >> 1); Add(label); backgroundTexture = Texture2DCache.GetTexture(new Color(30, 30, 30)); }
public override bool Draw(UltimaBatcher2D batcher, int x, int y) { base.Draw(batcher, x, y); ResetHueVector(); if (_var != InfoBarVars.NameNotoriety && ProfileManager.Current.InfoBarHighlightType == 1 && _warningLinesHue != 0x0481) { ShaderHueTranslator.GetHueVector(ref _hueVector, _warningLinesHue); batcher.Draw2D(Texture2DCache.GetTexture(Color.White), _data.ScreenCoordinateX, _data.ScreenCoordinateY, _data.Width, 2, ref _hueVector); batcher.Draw2D(Texture2DCache.GetTexture(Color.White), _data.ScreenCoordinateX, _data.ScreenCoordinateY + Parent.Height - 2, _data.Width, 2, ref _hueVector); } return(true); }
public HitBox(int x, int y, int w, int h, string tooltip = null, float alpha = 0.75f) { CanMove = false; AcceptMouseInput = true; Alpha = alpha; _texture = Texture2DCache.GetTexture(Color.White); X = x; Y = y; Width = w; Height = h; WantUpdateSize = false; SetTooltip(tooltip); }
public override bool Draw(UltimaBatcher2D batcher, int x, int y) { ResetHueVector(); base.Draw(batcher, x, y); 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) { 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) { if (!string.IsNullOrWhiteSpace(_label.Text) && MouseIsOver) { ResetHueVector(); batcher.Draw2D(Texture2DCache.GetTexture(Color.Gray), x + 2, y + 5, Width - 4, Height - 10, ref _hueVector); } base.Draw(batcher, x, y); if (_entry.Items != null && _entry.Items.Count != 0) { _moreMenuLabel.Draw(batcher, x + Width - _moreMenuLabel.Width, y + (Height >> 1) - (_moreMenuLabel.Height >> 1) - 1); } return(true); }
public override bool Draw(UltimaBatcher2D batcher, int x, int y) { //batcher.SetBlendState(_checkerBlend.Value); //batcher.SetStencil(_checkerStencil.Value); //batcher.Draw2D(TransparentTexture, new Rectangle(position.X, position.Y, Width, Height), Vector3.Zero /*ShaderHuesTraslator.GetHueVector(0, false, 0.5f, false)*/); //batcher.SetBlendState(null); //batcher.SetStencil(null); //return true; ResetHueVector(); _hueVector.Z = 0.5f; //batcher.SetStencil(_checkerStencil.Value); batcher.Draw2D(Texture2DCache.GetTexture(Color.Black), x, y, Width, Height, ref _hueVector); //batcher.SetStencil(null); return(true); }
public override void UnloadContent() { SDL.SDL_GetWindowBordersSize(Window.Handle, out int top, out int left, out int bottom, out int right); Settings.GlobalSettings.WindowPosition = new Point(Math.Max(0, Window.ClientBounds.X - left), Math.Max(0, Window.ClientBounds.Y - top)); Settings.GlobalSettings.Save(); Plugin.OnClosing(); _hues_sampler[0]?.Dispose(); _hues_sampler[0] = null; _hues_sampler[1]?.Dispose(); _hues_sampler[1] = null; _scene?.Dispose(); AuraManager.Dispose(); UIManager.Dispose(); Texture2DCache.Dispose(); base.UnloadContent(); }
protected override void LoadContent() { _textures = new Texture2DCache(typeof(Textures)); _spriteBatch = new SpriteBatch(Globals.GraphicsDevice); _fonts = new SpriteFontCache(typeof(Fonts)); _markerIntersect_Blue = StaticSprite.Acquire(_textures[(int)Textures.Marker_Blue], new Vector2(4, 4)); _markerIntersect_Blue.LayerDepth = 0; _markerPoint_Red = StaticSprite.Acquire(_textures[(int)Textures.Marker_Red], new Vector2(4, 4)); _markerPoint_Red.LayerDepth = 0; _markerPoint_Red.RenderingExtent.Anchor = new Vector2(_xValue, _yValue); var vertices = new List <Vector2>(); vertices.Add(new Vector2(22, 122)); vertices.Add(new Vector2(66, 23)); vertices.Add(new Vector2(150, 5)); vertices.Add(new Vector2(293, 78)); vertices.Add(new Vector2(256, 194)); vertices.Add(new Vector2(230, 86)); vertices.Add(new Vector2(202, 175)); vertices.Add(new Vector2(113, 157)); vertices.Add(new Vector2(168, 69)); vertices.Add(new Vector2(165, 148)); vertices.Add(new Vector2(203, 60)); vertices.Add(new Vector2(105, 50)); vertices.Add(new Vector2(77, 140)); vertices.Add(new Vector2(40, 147)); _insidePolygon = XenString.Acquire(); _insidePolygon.Reset(_fonts[(int)Fonts.Arial], "Inside!"); _polygonExtent = new PolygonExtent(); _polygonExtent.Reset(vertices); }
public override bool Draw(UltimaBatcher2D batcher, int x, int y) { base.Draw(batcher, x, y); 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); }
protected override void OnMouseExit(int x, int y) { label.Hue = 1001; backgroundTexture = Texture2DCache.GetTexture(new Color(30, 30, 30)); base.OnMouseExit(x, 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); } 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)); }