Esempio n. 1
0
        public override void Draw(UISpriteBatch batch)
        {
            if (!Visible || Opacity == 0)
            {
                return;
            }

            DrawLocalTexture(batch, ShadowImg, null, Vector2.Zero, Vector2.One, Color.Black * 0.5f);
            if (Target != null)
            {
                var effect = LotView.WorldContent.SpriteEffect;
                batch.SetEffect(effect);

                effect.CurrentTechnique = effect.Techniques["StickyEffect"];
                var off = ((Position + Size * Scale / 2) - ContainerSize / 2).X * -0.001f * (Size.Y / 240f);
                effect.Parameters["stickyOffset"].SetValue(off * OffsetMultiplier);
                effect.Parameters["stickyPersp"].SetValue((Size.Y / 240f) * -0.2f);

                DrawLocalTexture(batch, Target,
                                 new Rectangle((int)(-100 * ScaleX), 0, (int)(Target.Width + 200 * ScaleX), Target.Height),
                                 -(BackOffset.ToVector2() + new Vector2(100, 0)), new Vector2(1 / (Scale.X), 1 / (Scale.Y)));
                batch.SetEffect();
            }
            DynamicOverlay.GetChildren().ForEach(x =>
            {
                if (x.Opacity != Opacity)
                {
                    x.Opacity = Opacity;
                }
            });
            DynamicOverlay.Draw(batch);
        }