Draw() 공개 메소드

Draws the sprite on a 1080-pixels height base.
public Draw ( ) : void
리턴 void
예제 #1
0
파일: GUI.cs 프로젝트: Guad/NOOSE
        public static void DrawHUD(Teammate[] mates, int seconds = -1)
        {
            string[] photos = new[]
            {
                "hc_n_gus",
                "hc_n_kar",
                "hc_n_edd",
                "hc_n_pac",
            };

            SizeF res = UIMenu.GetScreenResolutionMantainRatio();
            Point safe = UIMenu.GetSafezoneBounds();
            new Sprite("heisthud", "main_gradient", new Point(Convert.ToInt32(res.Width) - safe.X - 300, Convert.ToInt32(res.Height) - safe.Y - (seconds == -1 ? 370 : 470)), new Size(400, (seconds == -1 ? 300 : 400)), 90f, Color.White).Draw();
            for (int i = 0; i < mates.Length; i++)
            {
                new UIResRectangle(new Point(Convert.ToInt32(res.Width) - 100 - safe.X, Convert.ToInt32(res.Height) - 110 - safe.Y - 100 * i), new Size(100, 20), Color.FromArgb(200, 57, 98, 116)).Draw();
                if (mates[i].Character.IsAlive)
                    new UIResRectangle(new Point(Convert.ToInt32(res.Width) - 100 - safe.X, Convert.ToInt32(res.Height) - 110 - safe.Y - 100 * i), new Size(Convert.ToInt32((mates[i].Character.Armor / 200f) * 100), 20), Color.FromArgb(200, 75, 140, 172)).Draw();

                new UIResRectangle(new Point(Convert.ToInt32(res.Width) - 100 - safe.X, Convert.ToInt32(res.Height) - 140 - safe.Y - 100*i), new Size(100, 20), Color.FromArgb(200, 60, 103, 52)).Draw();
                if(mates[i].Character.IsAlive)
                    new UIResRectangle(new Point(Convert.ToInt32(res.Width) - 100 - safe.X, Convert.ToInt32(res.Height) - 140 - safe.Y - 100 * i), new Size(Convert.ToInt32((mates[i].Character.Health/200f)*100), 20), Color.FromArgb(200, 90, 155, 85)).Draw();

                var photoSprite = new Sprite("heisthud", photos[i], new Point(Convert.ToInt32(res.Width) - 180 - safe.X, Convert.ToInt32(res.Height) - 150 - safe.Y - 100*i), new Size(70, 70));
                photoSprite.Draw();
                if (mates[i].Character.IsDead)
                {
                    new Sprite("heisthud", "kiaoverlay", new Point(Convert.ToInt32(res.Width) - 180 - safe.X, Convert.ToInt32(res.Height) - 130 - safe.Y - 100*i),
                        new Size(70, 50)).Draw();
                }
            }
            if(seconds != -1)
                DrawBombTimer(seconds);
        }
예제 #2
0
        /// <summary>
        /// Draw this item.
        /// </summary>
        public virtual async Task Draw()
        {
            // Removed because of Progress Item height calculations
            //_rectangle.Size = new SizeF(431 + Parent.WidthOffset, 38);
            //_selectedSprite.Size = new SizeF(431 + Parent.WidthOffset, 38);

            if (Hovered && !Selected)
            {
                _rectangle.Draw();
            }
            if (Selected)
            {
                _selectedSprite.Color = HighlightColor;
                _selectedSprite.Draw();
            }
            else
            {
                _selectedSprite.Color = MainColor;
                _selectedSprite.Draw();
            }

            _text.Color = Enabled ? (Selected ? HighlightedTextColor : TextColor) : _disabledColor; // No alloc anymore there

            if (LeftBadge == BadgeStyle.None)
            {
                _text.Position = new PointF(8 + Offset.X, _text.Position.Y);
            }
            else
            {
                _text.Position         = new PointF(35 + Offset.X, _text.Position.Y);
                _badgeLeft.TextureDict = BadgeToSpriteLib(LeftBadge);
                _badgeLeft.TextureName = BadgeToSpriteName(LeftBadge, Selected);
                _badgeLeft.Color       = BadgeToColor(LeftBadge, Selected);
                _badgeLeft.Draw();
            }

            if (RightBadge != BadgeStyle.None)
            {
                _badgeRight.Position    = new PointF(385 + Offset.X + Parent.WidthOffset, _badgeRight.Position.Y);
                _badgeRight.TextureDict = BadgeToSpriteLib(RightBadge);
                _badgeRight.TextureName = BadgeToSpriteName(RightBadge, Selected);
                _badgeRight.Color       = BadgeToColor(RightBadge, Selected);
                _badgeRight.Draw();
            }

            if (!String.IsNullOrWhiteSpace(RightLabel))
            {
                if (RightBadge == BadgeStyle.None)
                {
                    _labelText.Position = new PointF(420 + Offset.X + Parent.WidthOffset, _labelText.Position.Y);
                }
                else
                {
                    _labelText.Position = new PointF(390 + Offset.X + Parent.WidthOffset, _labelText.Position.Y);
                }
                _labelText.Caption = RightLabel;
                _labelText.Color   = _text.Color = Enabled ? (Selected ? Colors.Black : Colors.WhiteSmoke) : _disabledColor; // No alloc anymore there
                _labelText.Draw();
            }
            _text.Draw();
        }