public override void Draw(int interval) { SizeF res = UIMenu.GetScreenResolutionMaintainRatio(); Point safe = UIMenu.GetSafezoneBounds(); base.Draw(interval); var start = new Point((int)res.Width - safe.X - 160, (int)res.Height - safe.Y - (28 + (4 * interval))); UIResRectangle.Draw(start.X, start.Y, 150, 15, BackgroundColor); UIResRectangle.Draw(start.X, start.Y, (int)(150 * Percentage), 15, ForegroundColor); }
private Color _disabledColor = Color.FromArgb(163, 159, 148); // Why allocating memory for same color every time? /// <summary> /// Draw this item. /// </summary> public virtual void Draw() { _rectangle.Size = new Size(431 + Parent.WidthOffset, 38); _selectedSprite.Size = new Size(431 + Parent.WidthOffset, 38); if (Hovered && !Selected) { //_rectangle.Color = Color.FromArgb(20, 255, 255, 255); // Why setting color every time? (I set it in ctor) _rectangle.Draw(); } if (Selected) { _selectedSprite.Draw(); } _text.Color = Enabled ? (Selected ? Color.Black : Color.WhiteSmoke) : _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); // TODO _badgeLeft.TextureDict = BadgeToSpriteLib(LeftBadge); // TODO _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); // TODO _badgeRight.TextureDict = BadgeToSpriteLib(RightBadge); // TODO _badgeRight.TextureName = BadgeToSpriteName(RightBadge, Selected); _badgeRight.Color = BadgeToColor(RightBadge, Selected); _badgeRight.Draw(); } if (!String.IsNullOrWhiteSpace(RightLabel)) { _labelText.Position = new PointF(420 + Offset.X + Parent.WidthOffset, _labelText.Position.Y); _labelText.Caption = RightLabel; _labelText.Color = _text.Color = Enabled ? (Selected ? Color.Black : Color.WhiteSmoke) : _disabledColor; // No alloc anymore there _labelText.Draw(); } _text.Draw(); }
internal async override Task Draw() { if (Enabled) { Background.Size = new Size(431 + ParentItem.Parent.WidthOffset, 76); Background.Draw(); BackgroundBar.Draw(); ActiveBar.Draw(); Min.Draw(); Max.Draw(); Title.Draw(); Functions(); } await Task.FromResult(0); }
/// <summary> /// Draw this item. /// </summary> public virtual void Draw() { _rectangle.Size = new Size(431 + Parent.WidthOffset, 38); _selectedSprite.Size = new Size(431 + Parent.WidthOffset, 38); if (Hovered && !Selected) { _rectangle.Color = Color.FromArgb(20, 255, 255, 255); _rectangle.Draw(); } if (Selected) { _selectedSprite.Draw(); } _text.Color = Enabled ? Selected ? Color.Black : Color.WhiteSmoke : Color.FromArgb(163, 159, 148); if (LeftBadge != BadgeStyle.None) { _text.Position = new Point(35 + Offset.X, (int)_text.Position.Y); _badgeLeft.TextureDict = BadgeToSpriteLib(LeftBadge); _badgeLeft.TextureName = BadgeToSpriteName(LeftBadge, Selected); _badgeLeft.Color = BadgeToColor(LeftBadge, Selected); _badgeLeft.Draw(); } else { _text.Position = new Point(8 + Offset.X, (int)_text.Position.Y); } if (RightBadge != BadgeStyle.None) { _badgeRight.Position = new Point(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)) { _labelText.Position = new Point(420 + Offset.X + Parent.WidthOffset, (int)_labelText.Position.Y); _labelText.Caption = RightLabel; _labelText.Color = _text.Color = Enabled ? Selected ? Color.Black : Color.WhiteSmoke : Color.FromArgb(163, 159, 148); _labelText.Draw(); } _text.Draw(); }
/// <summary> /// Draw item. /// </summary> public override async Task Draw() { base.Draw(); _arrowLeft.Color = Enabled ? Selected ? Colors.Black : Colors.WhiteSmoke : Color.FromArgb(163, 159, 148); _arrowRight.Color = Enabled ? Selected ? Colors.Black : Colors.WhiteSmoke : Color.FromArgb(163, 159, 148); if (Selected) { _arrowLeft.Draw(); _arrowRight.Draw(); } else { } _rectangleBackground.Draw(); _rectangleSlider.Draw(); _rectangleDivider.Draw(); }
public async override Task Draw() { base.Draw(); if (Selected) { _background.Color = Colors.Black; _bar.Color = Colors.White; } else { _background.Color = Colors.White; _bar.Color = Colors.Black; } Functions(); _background.Draw(); _bar.Draw(); }
/// <summary> /// Draw item. /// </summary> public override async Task Draw() { base.Draw(); _arrowLeft.Color = Enabled ? Selected ? Colors.Black : Colors.WhiteSmoke : Color.FromArgb(163, 159, 148); _arrowRight.Color = Enabled ? Selected ? Colors.Black : Colors.WhiteSmoke : Color.FromArgb(163, 159, 148); float offset = 176 + Offset.X + _rectangleBackground.Size.Width - _rectangleSlider.Size.Width; _rectangleSlider.Position = new PointF((int)(offset + (_value / (float)_max * 73)), _rectangleSlider.Position.Y); if (Selected) { _arrowLeft.Draw(); _arrowRight.Draw(); } _rectangleBackground.Draw(); _rectangleSlider.Draw(); _rectangleDivider.Draw(); }
public async override Task Draw() { await base.Draw(); if (Selected) { _background.Color = Colors.Black; Bar.Color = Colors.White; } else { _background.Color = Colors.White; Bar.Color = Colors.Black; } _background.Draw(); Bar.Draw(); Functions(); await Task.FromResult(0); }
/// <summary> /// Draw item. /// </summary> public override void Draw() { base.Draw(); _arrowLeft.Color = Enabled ? Selected ? UnknownColors.Black : UnknownColors.WhiteSmoke : Color.FromArgb(163, 159, 148); _arrowRight.Color = Enabled ? Selected ? UnknownColors.Black : UnknownColors.WhiteSmoke : Color.FromArgb(163, 159, 148); float offset = ((_rectangleBackground.Size.Width - _rectangleSlider.Size.Width)/(_items.Count - 1)) * Index; _rectangleSlider.Position = new PointF(250 + Offset.X + offset, _rectangleSlider.Position.Y); if (Selected) { _arrowLeft.Draw(); _arrowRight.Draw(); } else { } _rectangleBackground.Draw(); _rectangleSlider.Draw(); _rectangleDivider.Draw(); }
internal async override Task Draw() { if (Enabled) { Background.Size = new Size(431 + ParentItem.Parent.WidthOffset, 112); Background.Draw(); if (EnableArrow) { LeftArrow.Draw(); RightArrow.Draw(); } Text.Draw(); for (int Index = 0; Index < Bar.Count; Index++) { Bar[Index].Draw(); } SelectedRectangle.Draw(); Functions(); } await Task.FromResult(0); }
/// <summary> /// Draw this item. /// </summary> public virtual void Draw() { //if (this is UIMenuHeritageCardItem) //{ // //if (Selected) // //{ // // Selected = false; // // if (Parent.CurrentSelection == 0) // // { // // Parent.CurrentSelection++; //= Parent.MenuItems.Count + 2; // // } // // //else if (Parent.CurrentSelection == Parent.MenuItems.Count - 1) // // //{ // // // Parent.CurrentSelection = Parent.MenuItems.Count - 1; // // //} // //} // _rectangle.Size = new SizeF(431 + Parent.WidthOffset, 38 + 150); // _selectedSprite.Size = new SizeF(431 + Parent.WidthOffset, 38 + 150); //} //else //{ //bool heritage = false; //foreach (var m in this.Parent.MenuItems) //{ // if (m is UIMenuHeritageCardItem) // { // heritage = true; // break; // } //} //if (heritage) //{ // //this.Position(150); // this.Offset = new PointF(this.Offset.X, 228f); // //this.Offset.Y + 150f; //} _rectangle.Size = new SizeF(431 + Parent.WidthOffset, 38); _selectedSprite.Size = new SizeF(431 + Parent.WidthOffset, 38); //} if (Hovered && !Selected) { //_rectangle.Color = Color.FromArgb(20, 255, 255, 255); // Why setting color every time? (I set it in ctor) _rectangle.Draw(); } if (Selected) { _selectedSprite.Draw(); } _text.Color = Enabled ? (Selected ? UnknownColors.Black : UnknownColors.WhiteSmoke) : _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)) { _labelText.Position = new PointF(420 + Offset.X + Parent.WidthOffset, _labelText.Position.Y); _labelText.Caption = RightLabel; _labelText.Color = _text.Color = Enabled ? (Selected ? UnknownColors.Black : UnknownColors.WhiteSmoke) : _disabledColor; // No alloc anymore there _labelText.Draw(); } if (!String.IsNullOrWhiteSpace(_text.Caption.Trim())) { _text.Draw(); } }
/// <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(); }