Exemplo n.º 1
0
        public override bool Draw(Batcher2D batcher, int x, int y)
        {
            Vector3 vec = ShaderHuesTraslator.GetHueVector(Hue, IsPartial, Alpha, false);

            if (ScaleTexture)
            {
                if (Texture is ArtTexture artTexture)
                {
                    //var rect = new Rectangle(position.X, position.Y, Width, Height);

                    int w = Width;
                    int h = Height;

                    if (artTexture.ImageRectangle.Width < Width)
                    {
                        w = artTexture.ImageRectangle.Width;
                    }
                    if (artTexture.ImageRectangle.Height < Height)
                    {
                        h = artTexture.ImageRectangle.Height;
                    }

                    var r = artTexture.ImageRectangle;

                    return(batcher.Draw2D(Texture, x, y, w, h, r.X, r.Y, r.Width, r.Height, vec));
                }
                return(batcher.Draw2D(Texture, x, y, Width, Height, 0, 0, Texture.Width, Texture.Height, vec));
            }
            return(batcher.Draw2D(Texture, x, y, vec));
        }
Exemplo n.º 2
0
        public void Draw(Batcher2D batcher)
        {
            var pos = ConvertUnits.ToDisplayUnits(Position);

            pos.Y -= .75f * Height;
            batcher.FillRect(new RectangleF(pos, new Vector2(Height)), Assets.GrassSheet.GetSprite(DecorationType));
        }
Exemplo n.º 3
0
        public override bool Draw(Batcher2D batcher, Vector3 position, MouseOverList list)
        {
            if (AnimationGraphic != _displayed || Texture == null || Texture.IsDisposed)
            {
                _displayed = AnimationGraphic;

                if (_displayed > 0x4E29)
                {
                    return(false);
                }
                Texture = FileManager.Gumps.GetTexture(_displayed);
                Point offset = _offsets[_displayed - 20000];
                Bounds = new Rectangle(offset.X, Texture.Height - 33 + offset.Y, Texture.Width, Texture.Height);
            }

            if (Engine.Profile.Current.NoColorObjectsOutOfRange && Distance > World.ViewRange)
            {
                HueVector = new Vector3(Constants.OUT_RANGE_COLOR, 1, HueVector.Z);
            }
            else if (World.Player.IsDead && Engine.Profile.Current.EnableBlackWhiteEffect)
            {
                HueVector = new Vector3(Constants.DEAD_RANGE_COLOR, 1, HueVector.Z);
            }
            else
            {
                HueVector = ShaderHuesTraslator.GetHueVector(Hue);
            }

            Engine.DebugInfo.EffectsRendered++;
            return(base.Draw(batcher, position, list));
        }
Exemplo n.º 4
0
        public bool Draw(Batcher2D batcher, MouseOverList list, Point offset)
        {
            DrawTextOverheads(batcher, list);


            foreach (KeyValuePair <GameObject, Deque <DamageOverhead> > pair in _damageOverheads)
            {
                Mobile parent = (Mobile)pair.Key;
                var    deque  = pair.Value;

                Vector3 position = Vector3.Zero;

                position.X = parent.ScreenPosition.X - offset.X - 22;
                position.Y = parent.ScreenPosition.Y - offset.Y - 22;

                if (parent is Mobile m)
                {
                    GetAnimationDimensions(m, 0xFF, out int height, out int centerY);

                    position = new Vector3
                    {
                        X = position.X + m.Offset.X,
                        Y = position.Y + (m.Offset.Y - m.Offset.Z) - (height + centerY + 8),
                        Z = position.Z
                    };
                }

                foreach (DamageOverhead damageOverhead in deque)
                {
                    damageOverhead.View.Draw(batcher, position, list);
                }
            }

            return(true);
        }
Exemplo n.º 5
0
        public override bool Draw(Batcher2D batcher, int x, int y)
        {
            Vector3 color = IsTransparent ? ShaderHuesTraslator.GetHueVector(0, false, Alpha, true) : Vector3.Zero;

            DrawInternal(batcher, x, y, color);
            return(base.Draw(batcher, x, y));
        }
Exemplo n.º 6
0
        public override bool Draw(Batcher2D batcher, int x, int y)
        {
            if (Engine.Profile == null || Engine.Profile.Current == null || Mobile == null || Mobile.IsDestroyed)
            {
                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;

            x = (int)((Mobile.RealScreenPosition.X + Mobile.Offset.X - Width / 2 + 22) / scale);
            y = (int)((Mobile.RealScreenPosition.Y + Mobile.Offset.Y - Mobile.Offset.Z + 22) / scale);

            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);
            }


            return(base.Draw(batcher, x, y));
        }
Exemplo n.º 7
0
        public override bool Draw(Batcher2D batcher, Point position, Vector3?hue = null)
        {
            Vector3 color = IsTransparent ? ShaderHuesTraslator.GetHueVector(0, false, Alpha, true) : Vector3.Zero;

            DrawInternal(batcher, position, color);
            return(base.Draw(batcher, position, hue));
        }
Exemplo n.º 8
0
        public override bool Draw(Batcher2D batcher, Vector3 position, MouseOverList objectList)
        {
            if (!AllowedToDraw || GameObject.IsDisposed)
            {
                return(false);
            }
            Item item = (Item)GameObject;

            if (item.IsCorpse)
            {
                return(DrawCorpse(batcher, position, objectList));
            }


            if (_originalGraphic != item.DisplayedGraphic || Texture == null || Texture.IsDisposed)
            {
                _originalGraphic = item.DisplayedGraphic;
                Texture          = Art.GetStaticTexture(_originalGraphic);
                Bounds           = new Rectangle((Texture.Width >> 1) - 22, Texture.Height - 44, Texture.Width, Texture.Height);
            }

            HueVector = ShaderHuesTraslator.GetHueVector(GameObject.Hue, TileData.IsPartialHue(item.ItemData.Flags), TileData.IsTranslucent(item.ItemData.Flags) ? .5f : 0, false);

            if (item.Amount > 1 && TileData.IsStackable(item.ItemData.Flags) && item.DisplayedGraphic == GameObject.Graphic)
            {
                Vector3 offsetDrawPosition = new Vector3(position.X - 5, position.Y - 5, 0);
                base.Draw(batcher, offsetDrawPosition, objectList);
            }

            bool ok = base.Draw(batcher, position, objectList);

            MessageOverHead(batcher, position, Bounds.Y);

            return(ok);
        }
Exemplo n.º 9
0
        public override bool Draw(Batcher2D batcher, Vector3 position, MouseOverList objectList)
        {
            if (!AllowedToDraw || GameObject.IsDisposed)
            {
                return(false);
            }
            Land tile = (Land)GameObject;

            if (Texture == null || Texture.IsDisposed)
            {
                if (tile.IsStretched)
                {
                    Texture = TextmapTextures.GetTextmapTexture(tile.TileData.TexID);
                }
                else
                {
                    Texture = Art.GetLandTexture(GameObject.Graphic);
                    Bounds  = new Rectangle(0, 0, 44, 44);
                }
            }

            if (tile.IsStretched)
            {
                HueVector = GetHueVector(GameObject.Hue, true);

                return(Draw3DStretched(batcher, position, objectList));
            }

            HueVector = GetHueVector(GameObject.Hue, false);

            return(base.Draw(batcher, position, objectList));
        }
Exemplo n.º 10
0
        protected override void LoadContent()
        {
            var graphicsDevice = GraphicsDevice;

            _effect = new DefaultEffect(graphicsDevice)
            {
                TextureEnabled     = true,
                VertexColorEnabled = true
            };
            _batcher     = new Batcher2D(graphicsDevice);
            _spriteBatch = new SpriteBatch(graphicsDevice);
            _bitmapFont  = Content.Load <BitmapFont>("Fonts/montserrat-32");

            // load the texture for the sprites
            _spriteTexture1 = Content.Load <Texture2D>("Textures/logo-square-128");
            _spriteTexture2 = Content.Load <Texture2D>("Textures/logo-square-512");
            _spriteOrigin   = new Vector2(_spriteTexture1.Width * 0.5f, _spriteTexture1.Height * 0.5f);
            _spriteScale    = new Vector2(0.5f);

            var viewport = GraphicsDevice.Viewport;

            // ReSharper disable once ForCanBeConvertedToForeach
            for (var index = 0; index < _sprites.Length; index++)
            {
                var sprite = _sprites[index];
                sprite.Position = new Vector2(_random.Next(viewport.X, viewport.Width),
                                              _random.Next(viewport.Y, viewport.Height));
                sprite.Rotation = MathHelper.ToRadians(_random.Next(0, 360));
                sprite.Texture  = index % 2 == 0 ? _spriteTexture1 : _spriteTexture2;
                _sprites[index] = sprite;
            }
        }
Exemplo n.º 11
0
        public override bool Draw(Batcher2D batcher, Vector3 position, MouseOverList list)
        {
            LightningEffect effect = (LightningEffect)GameObject;

            if (effect.AnimationGraphic != _displayed || Texture == null || Texture.IsDisposed)
            {
                _displayed = effect.AnimationGraphic;

                if (_displayed > 0x4E29)
                {
                    return(false);
                }
                Texture = FileManager.Gumps.GetTexture(_displayed);
                Point offset = _offsets[_displayed - 20000];
                Bounds = new Rectangle(offset.X, Texture.Height - 33 + offset.Y, Texture.Width, Texture.Height);
            }

            if (Engine.Profile.Current.NoColorObjectsOutOfRange && GameObject.Distance > World.ViewRange)
            {
                HueVector = new Vector3(0x038E, 1, HueVector.Z);
            }
            else
            {
                HueVector = ShaderHuesTraslator.GetHueVector(effect.Hue);
            }
            Engine.DebugInfo.EffectsRendered++;
            return(base.Draw(batcher, position, list));
        }
Exemplo n.º 12
0
        public override bool Draw(Batcher2D batcher, Vector3 position, MouseOverList list)
        {
            if (IsDisposed)
            {
                return(false);
            }

            if (AnimationGraphic != _displayedGraphic || Texture == null || Texture.IsDisposed)
            {
                _displayedGraphic = AnimationGraphic;
                Texture           = FileManager.Art.GetTexture(AnimationGraphic);
                Bounds            = new Rectangle(0, 0, Texture.Width, Texture.Height);
            }

            Bounds.X = (int)-Offset.X;
            Bounds.Y = (int)(Offset.Z - Offset.Y);
            Rotation = AngleToTarget;

            if (Engine.Profile.Current.NoColorObjectsOutOfRange && Distance > World.ViewRange)
            {
                HueVector = new Vector3(Constants.OUT_RANGE_COLOR, 1, HueVector.Z);
            }
            else if (World.Player.IsDead && Engine.Profile.Current.EnableBlackWhiteEffect)
            {
                HueVector = new Vector3(Constants.DEAD_RANGE_COLOR, 1, HueVector.Z);
            }
            else
            {
                HueVector = ShaderHuesTraslator.GetHueVector(Hue);
            }

            Engine.DebugInfo.EffectsRendered++;
            base.Draw(batcher, position, list);

            ref readonly StaticTiles data = ref FileManager.TileData.StaticData[_displayedGraphic];
Exemplo n.º 13
0
            public override bool Draw(Batcher2D batcher, int x, int y)
            {
                Vector3 hue = Vector3.Zero;

                ShaderHuesTraslator.GetHueVector(ref hue, 0, false, 1.0f - (_alpha / 255f));
                return(batcher.Draw2D(Texture, x, y, hue));
            }
Exemplo n.º 14
0
        public override bool Draw(Batcher2D batcher, Point position, Vector3?hue = null)
        {
            //int offsetTop = Math.Max(_gumpTexture[0].Height, _gumpTexture[2].Height) - _gumpTexture[1].Height;
            //int offsetBottom = Math.Max(_gumpTexture[5].Height, _gumpTexture[7].Height) - _gumpTexture[6].Height;
            //int offsetLeft = Math.Max(_gumpTexture[0].Width, _gumpTexture[5].Width) - _gumpTexture[3].Width;
            //int offsetRight = Math.Max(_gumpTexture[2].Width, _gumpTexture[7].Width) - _gumpTexture[4].Width;

            Vector3 color = IsTransparent ? ShaderHuesTraslator.GetHueVector(0, false, Alpha, true) : Vector3.Zero;

            //if (IsTransparent)
            //{
            //    batcher.SetBlendState(_checkerBlend.Value);
            //    DrawInternal(batcher, position, color);
            //    batcher.SetBlendState(null);

            //    batcher.SetStencil(_checkerStencil.Value);
            //    DrawInternal(batcher, position, color);
            //    batcher.SetStencil(null);
            //}
            //else
            //{
            //    DrawInternal(batcher, position, color);
            //}
            DrawInternal(batcher, position, color);
            return(base.Draw(batcher, position, hue));
        }
Exemplo n.º 15
0
        public override bool Draw(Batcher2D batcher, int x, int y)
        {
            Vector3 hue = Vector3.Zero;

            ShaderHuesTraslator.GetHueVector(ref hue, Hue, IsPartial, Alpha);

            if (ScaleTexture)
            {
                if (Texture is ArtTexture artTexture)
                {
                    int w = Width;
                    int h = Height;

                    if (artTexture.ImageRectangle.Width < Width)
                    {
                        w  = artTexture.ImageRectangle.Width;
                        x += Width / 2 - w / 2;
                    }

                    if (artTexture.ImageRectangle.Height < Height)
                    {
                        h  = artTexture.ImageRectangle.Height;
                        y += Height / 2 - h / 2;
                    }


                    var r = artTexture.ImageRectangle;

                    return(batcher.Draw2D(Texture, x, y, w, h, r.X, r.Y, r.Width, r.Height, hue));
                }
                return(batcher.Draw2D(Texture, x, y, Width, Height, 0, 0, Texture.Width, Texture.Height, hue));
            }
            return(batcher.Draw2D(Texture, x, y, hue));
        }
Exemplo n.º 16
0
        public override bool Draw(Batcher2D batcher, Vector3 position, MouseOverList list)
        {
            if (IsDisposed)
            {
                return(false);
            }

            if (AnimationGraphic != _displayedGraphic || Texture == null || Texture.IsDisposed)
            {
                _displayedGraphic = AnimationGraphic;
                Texture           = FileManager.Art.GetTexture(AnimationGraphic);
                Bounds            = new Rectangle(0, 0, Texture.Width, Texture.Height);
            }

            Bounds.X = (int)-Offset.X;
            Bounds.Y = (int)(Offset.Z - Offset.Y);
            Rotation = AngleToTarget;
            if (Engine.Profile.Current.NoColorObjectsOutOfRange && Distance > World.ViewRange)
            {
                HueVector = new Vector3(0x038E, 1, HueVector.Z);
            }
            else
            {
                HueVector = ShaderHuesTraslator.GetHueVector(Hue);
            }
            Engine.DebugInfo.EffectsRendered++;
            return(base.Draw(batcher, position, list));
        }
Exemplo n.º 17
0
        public override bool Draw(Batcher2D batcher, int x, int y)
        {
            Vector3 hue = Vector3.Zero;

            ShaderHuesTraslator.GetHueVector(ref hue, 0, false, Alpha);
            return(batcher.Draw2D(CheckerTrans.TransparentTexture, x, y, Width, Height, hue));
        }
Exemplo n.º 18
0
        public override bool Draw(Batcher2D batcher, Point position, Vector3?hue = null)
        {
            if (Engine.Profile == null || Engine.Profile.Current == null)
            {
                return(false);
            }

            Point gWinPos  = Engine.Profile.Current.GameWindowPosition;
            Point gWinSize = Engine.Profile.Current.GameWindowSize;
            float scale    = Engine.SceneManager.GetScene <GameScene>().Scale;

            if (Mobile != null && !Mobile.IsDisposed)
            {
                float x = (Mobile.RealScreenPosition.X + gWinPos.X) / scale;
                float y = (Mobile.RealScreenPosition.Y + gWinPos.Y) / scale;

                X = (int)(x + Mobile.Offset.X) - Width / 2 + 22;
                Y = (int)(y + Mobile.Offset.Y - Mobile.Offset.Z) + 22;
            }

            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;

            return(base.Draw(batcher, position, hue));
        }
Exemplo n.º 19
0
        private bool DrawCorpse(Batcher2D batcher, Vector3 position, MouseOverList objectList)
        {
            if (IsDisposed || World.CorpseManager.Exists(Serial, 0))
            {
                return(false);
            }

            byte dir    = (byte)((byte)Layer & 0x7F & 7);
            bool mirror = false;

            FileManager.Animations.GetAnimDirection(ref dir, ref mirror);
            IsFlipped = mirror;
            FileManager.Animations.Direction = dir;
            byte animIndex = (byte)AnimIndex;

            DrawLayer(batcher, position, objectList, Layer.Invalid, animIndex);

            for (int i = 0; i < Constants.USED_LAYER_COUNT; i++)
            {
                Layer layer = LayerOrder.UsedLayers[dir, i];
                DrawLayer(batcher, position, objectList, layer, animIndex);
            }

            return(true);
        }
Exemplo n.º 20
0
        public void Draw(Batcher2D batcher)
        {
            var pos    = ConvertUnits.ToDisplayUnits(Position);
            var d      = ConvertUnits.ToDisplayUnits(Size) * 1.5f;
            var sprite = Assets.ObstacleSheet.GetSprite(_type);

            batcher.FillRect(new RectangleF(pos - new Vector2(d / 2f, d / 2f - d / 10f), new Vector2(d)), sprite);
        }
Exemplo n.º 21
0
        public override bool Draw(Batcher2D batcher, int x, int y)
        {
            Vector3 hue = Vector3.Zero;

            ShaderHuesTraslator.GetHueVector(ref hue, Hue);

            return(batcher.Draw2DTiled(Texture, x, y, Percent, Height, hue));
        }
Exemplo n.º 22
0
        public void Draw(Batcher2D batcher)
        {
            var pos = ConvertUnits.ToDisplayUnits(Position);
            var w   = ConvertUnits.ToDisplayUnits(Width);
            var h   = ConvertUnits.ToDisplayUnits(Height);

            batcher.FillRect(new RectangleF(pos, new Vector2(w, h)), Assets.CloudsSheet.GetSprite(_type));
        }
Exemplo n.º 23
0
            public override bool Draw(Batcher2D batcher, int x, int y)
            {
                Vector3 hue = Vector3.Zero;

                ShaderHuesTraslator.GetHueVector(ref hue, MouseIsOver && HighlightOnMouseOver ? 0x0035 : Item.Hue, Item.ItemData.IsPartialHue, 0);

                return(batcher.Draw2D(Texture, x, y, Width, Height, _point.X, _point.Y, _originalSize.X, _originalSize.Y, hue));
            }
Exemplo n.º 24
0
        public override bool Draw(Batcher2D batcher, Point position, Vector3?hue = null)
        {
            if (IsDisposed)
            {
                return(false);
            }

            return(batcher.Draw2D(Texture, position, ShaderHuesTraslator.GetHueVector(Item.Hue & 0x3FFF, _isPartialHue, Alpha, false)));
        }
Exemplo n.º 25
0
        public override bool Draw(Batcher2D batcher, int x, int y)
        {
            if (IsDisposed)
            {
                return(false);
            }

            return(batcher.Draw2D(Texture, x, y, ShaderHuesTraslator.GetHueVector(Item.Hue & 0x3FFF, _isPartialHue, Alpha, false)));
        }
Exemplo n.º 26
0
        public override bool Draw(Batcher2D batcher, Point position, Vector3?hue = null)
        {
            if (IsDisposed)
            {
                return(false);
            }

            return(batcher.Draw2D(Texture, position, ShaderHuesTraslator.GetHueVector(Item.Hue & 0x3FFF, TileData.IsPartialHue(Item.ItemData.Flags), _isTransparent ? .5f : 0, false)));
        }
Exemplo n.º 27
0
        public void Draw(Batcher2D batcher)
        {
            var rect       = new RectangleF(Position, Size);
            var borderRect = rect;

            borderRect = borderRect.Inflate(HalfBorderThickness, HalfBorderThickness);

            batcher.DrawRect(borderRect, BorderColor, BorderThickness);
            batcher.FillRect(rect, FillColor);
        }
Exemplo n.º 28
0
        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));

            return(true);
        }
Exemplo n.º 29
0
        public override bool Draw(Batcher2D batcher, Point position, Vector3?hue = null)
        {
            _rect.X      = position.X;
            _rect.Y      = position.Y;
            _rect.Width  = Width;
            _rect.Height = Height;
            batcher.Draw2D(_scene.ViewportTexture, _rect, Vector3.Zero);

            return(base.Draw(batcher, position, hue));
        }
Exemplo n.º 30
0
        public override bool Draw(Batcher2D batcher, int x, int y)
        {
            Vector3 hue = Vector3.Zero;

            ShaderHuesTraslator.GetHueVector(ref hue, Hue, _isPartial, 0);

            batcher.Draw2D(Texture, x, y, hue);

            return(base.Draw(batcher, x, y));
        }