Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using Turbo.Plugins.Default;
- namespace Turbo.Plugins.glq
- {
- public class GLQ_GRProgressionToTime : BasePlugin, IInGameTopPainter
- {
- public IFont TimeFont { get; set; }
- public GLQ_GRProgressionToTime()
- {
- Enabled = true;
- }
- public override void Load(IController hud)
- {
- base.Load(hud);
- }
- public void PaintTopInGame(ClipState clipState)
- {
- var ui = Hud.Render.GreaterRiftBarUiElement;
- if (clipState == ClipState.BeforeClip && Hud.Game.SpecialArea == SpecialArea.GreaterRift && ui.Visible)
- {
- var secondsLeft = (Hud.Game.CurrentTimedEventEndTick - (double)Hud.Game.CurrentGameTick) / 60.0d;
- var percent = Hud.Game.RiftPercentage;
- if (secondsLeft > 0)
- {
- var a = 9000000000 / ui.Rectangle.Width;
- var currentX = ui.Rectangle.Left + ui.Rectangle.Width / 100.0f * percent;
- var timeX = ui.Rectangle.Right - (float)(ui.Rectangle.Width / 900.0f * secondsLeft);
- var b = (currentX - timeX) * a;
- var text = "";
- if (b <= 0)
- {
- text = "- " + ValueToString((long)b, ValueFormat.LongTime);
- TimeFont = Hud.Render.CreateFont("tahoma", 7, 255, 250, 100, 100, true, false, 160, 0, 0, 0, true);
- }
- else
- {
- text = "+ " + ValueToString((long)b, ValueFormat.LongTime);
- TimeFont = Hud.Render.CreateFont("tahoma", 7, 255, 128, 255, 0, true, false, 160, 0, 0, 0, true);
- }
- var textLayout = TimeFont.GetTextLayout(text.ToString());
- var x = (float)currentX - textLayout.Metrics.Width / 2;
- var y = ui.Rectangle.Top - ui.Rectangle.Height * 0.1f - textLayout.Metrics.Height;
- TimeFont.DrawText(textLayout, x, y);
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement