Пример #1
0
        protected override void DrawStyle(Style style, float opacity)
        {
            base.DrawStyle(style, opacity);

            var texture = Gui.Renderer.GetTexture(Texture);

            if (texture < 0)
            {
                return;
            }

            if (ColorByTint)
            {
                Color = style.Tint;
            }

            var color = Color;

            if (Tint != -1)
            {
                color = ColorInt.Blend(Tint, color);
            }

            color = ColorInt.FromArgb(opacity, color);

            if (TextureRect.IsEmpty())
            {
                var texsize = Gui.Renderer.GetTextureSize(texture);
                TextureRect = new Rectangle(Point.Zero, texsize);
            }

            //bool atlas = SpriteBatch.AutoAtlas;

            //if (ExcludeFromAtlas)
            //    SpriteBatch.AutoAtlas = false;

            if (Tiling == TextureMode.Grid || Tiling == TextureMode.GridRepeat)
            {
                SliceTexture(texture, Tiling, TextureRect, Grid, opacity, color);
            }
            else if (Tiling == TextureMode.Stretch)
            {
                Gui.Renderer.DrawTexture(texture, Location.X + Inset.Left, Location.Y + Inset.Top, Size.X - (Inset.Left + Inset.Right), Size.Y - (Inset.Top + Inset.Bottom), TextureRect, color);
            }
            else if (Tiling == TextureMode.Center)
            {
                var center   = Location + Size / 2;
                var rectsize = new Point(TextureRect.Width, TextureRect.Height);
                var pos      = center - rectsize / 2;

                Gui.Renderer.DrawTexture(texture, pos.X, pos.Y, rectsize.X, rectsize.Y, TextureRect, color);
            }
            else
            {
                RepeatTexture(texture, Location, TextureRect, Tiling, opacity, color);
            }

            //if (ExcludeFromAtlas)
            //    SpriteBatch.AutoAtlas = atlas;
        }
Пример #2
0
 IEnumerator ColorFadeAnimation()
 {
     while (true)
     {
         _contextMessageBackground.Color = ColorInt.Blend(_contextMessageBackground.Color, _targetBackgroundColor, 0.80f);
         yield return(null);
     }
 }