private static Vec2 drawItem(RenderingContext rc, AlertDrawStyle drawStyle, int x, int y, Vec2 vPadding, string text, int fontSize) { // collapse padding when there's a frame vPadding.X -= drawStyle.FrameWidth; vPadding.Y -= drawStyle.FrameWidth; // item will appear to have equal size Vec2 textPos = new Vec2(x - vPadding.X, y + vPadding.Y); Vec2 vTextSize = rc.AddTextWithHeight(textPos, text, drawStyle.color, fontSize, DrawTextFormat.Right); int iconSize = drawStyle.IconIndex >= 0 ? vTextSize.Y : 0; int fullHeight = vTextSize.Y + 2 * vPadding.Y + 2 * drawStyle.FrameWidth; int fullWidth = vTextSize.X + 2 * vPadding.X + iconSize + 2 * drawStyle.FrameWidth; rc.AddBox(new Rect(x - fullWidth, y, fullWidth, fullHeight), Color.FromArgb(180, 0, 0, 0)); if (iconSize > 0) { const float iconsInSprite = 4; Rect iconPos = new Rect(textPos.X - iconSize - vTextSize.X, textPos.Y, iconSize, iconSize); RectUV uv = new RectUV(drawStyle.IconIndex / iconsInSprite, 0, (drawStyle.IconIndex + 1) / iconsInSprite, 1); rc.AddSprite("item_icons.png", iconPos, uv); } if (drawStyle.FrameWidth > 0) { Rect frame = new Rect(x - fullWidth, y, fullWidth, fullHeight); rc.AddFrame(frame, drawStyle.color, drawStyle.FrameWidth); } return(new Vec2(fullWidth, fullHeight)); }
private static Vec2 drawItem(RenderingContext rc, AlertDrawStyle drawStyle, Vec2 delta, int x, int y, Vec2 vPadding, string text, int fontSize) { // collapse padding when there's a frame vPadding.X -= drawStyle.FrameWidth; vPadding.Y -= drawStyle.FrameWidth; // item will appear to have equal size double phi; var distance = delta.GetPolarCoordinates(out phi); //text = text + " @ " + (int)distance + " : " + (int)(phi / Math.PI * 180) + " : " + xSprite; int compassOffset = fontSize + 8; Vec2 textPos = new Vec2(x - vPadding.X - compassOffset, y + vPadding.Y); Vec2 vTextSize = rc.AddTextWithHeight(textPos, text, drawStyle.color, fontSize, DrawTextFormat.Right); int iconSize = drawStyle.IconIndex >= 0 ? vTextSize.Y : 0; int fullHeight = vTextSize.Y + 2 * vPadding.Y + 2 * drawStyle.FrameWidth; int fullWidth = vTextSize.X + 2 * vPadding.X + iconSize + 2 * drawStyle.FrameWidth + compassOffset; rc.AddBox(new Rect(x - fullWidth, y, fullWidth - compassOffset, fullHeight), Color.FromArgb(180, 0, 0, 0)); var rectUV = GetDirectionsUv(phi, distance); rc.AddSprite("directions.png", new Rect(x - vPadding.X - compassOffset + 6, y + vPadding.Y, vTextSize.Y, vTextSize.Y), rectUV); if (iconSize > 0) { const float iconsInSprite = 6; Rect iconPos = new Rect(textPos.X - iconSize - vTextSize.X, textPos.Y, iconSize, iconSize); RectUV uv = new RectUV(drawStyle.IconIndex / iconsInSprite, 0, (drawStyle.IconIndex + 1) / iconsInSprite, 1); rc.AddSprite("item_icons.png", iconPos, uv); } if (drawStyle.FrameWidth > 0) { Rect frame = new Rect(x - fullWidth, y, fullWidth - compassOffset, fullHeight); rc.AddFrame(frame, drawStyle.color, drawStyle.FrameWidth); } return(new Vec2(fullWidth, fullHeight)); }
public override void Render(RenderingContext rc) { if (!Settings.GetBool("ItemAlert") || !Settings.GetBool("ItemAlert.ShowText")) { return; } Rect clientRect = this.poe.Internal.game.IngameState.IngameUi.Minimap.SmallMinimap.GetClientRect(); Vec2 rightTopAnchor = new Vec2(clientRect.X + clientRect.W, clientRect.Y + clientRect.H + 5); int y = rightTopAnchor.Y; int fontSize = Settings.GetInt("ItemAlert.ShowText.FontSize"); foreach (KeyValuePair <ExileBot.Entity, AlertDrawStyle> kv in this.currentAlerts) { if (!kv.Key.IsValid) { continue; } string text = GetItemName(kv); if (null == text) { continue; } AlertDrawStyle drawStyle = kv.Value; int frameWidth = drawStyle.FrameWidth; Vec2 vPadding = new Vec2(frameWidth + 5, frameWidth); int frameMargin = frameWidth + 2; Vec2 textPos = new Vec2(rightTopAnchor.X - vPadding.X, y + vPadding.Y); var vTextFrame = rc.AddTextWithHeight(textPos, text, drawStyle.color, fontSize, DrawTextFormat.Right); int iconSize = vTextFrame.Y; bool hasIcon = drawStyle.IconIndex >= 0; int maxHeight = vTextFrame.Y + 2 * vPadding.Y + frameMargin; int maxWidth = vTextFrame.X + 2 * vPadding.X + (hasIcon ? iconSize : 0); rc.AddBox(new Rect(rightTopAnchor.X - maxWidth, y, maxWidth, maxHeight), Color.FromArgb(180, 0, 0, 0)); if (hasIcon) { const float iconsInSprite = 4; Rect iconPos = new Rect(textPos.X - iconSize - vTextFrame.X, textPos.Y, iconSize, iconSize); RectUV uv = new RectUV(drawStyle.IconIndex / iconsInSprite, 0, (drawStyle.IconIndex + 1) / iconsInSprite, 1); rc.AddSprite("item_icons.png", iconPos, uv); } if (frameWidth > 0) { Rect frame = new Rect(rightTopAnchor.X - vTextFrame.X - 2 * vPadding.X, y, vTextFrame.X + 2 * vPadding.X, vTextFrame.Y + 2 * vPadding.Y); rc.AddFrame(frame, kv.Value.color, frameWidth); } y += vTextFrame.Y + 2 * vPadding.Y + frameMargin; } }
public override void Render(RenderingContext rc, Dictionary <UiMountPoint, Vec2> mountPoints) { if (!Settings.ShowText) { return; } Rect rect = model.Window.ClientRect(); int xScreenCenter = rect.W / 2 + rect.X; int yPos = rect.H / 5 + rect.Y; var playerPos = model.Player.GetComponent <Positioned>().GridPos; int fontSize = Settings.TextFontSize; bool first = true; Rect rectBackground = new Rect(); foreach (var alert in alertTexts) { if (!alert.Key.IsAlive) { continue; } Vec2 delta = alert.Key.GetComponent <Positioned>().GridPos - playerPos; double phi; var distance = delta.GetPolarCoordinates(out phi); RectUV uv = GetDirectionsUv(phi, distance); Vec2 textSize = rc.AddTextWithHeight(new Vec2(xScreenCenter, yPos), alert.Value, Color.Red, fontSize, DrawTextFormat.Center); rectBackground = new Rect(xScreenCenter - textSize.X / 2 - 6, yPos, textSize.X + 12, textSize.Y); rectBackground.X -= textSize.Y + 3; rectBackground.W += textSize.Y; Rect rectDirection = new Rect(rectBackground.X + 3, rectBackground.Y, rectBackground.H, rectBackground.H); if (first) // vertical padding above { rectBackground.Y -= 5; rectBackground.H += 5; first = false; } rc.AddBox(rectBackground, Color.FromArgb(Settings.TextBgAlpha, 1, 1, 1)); rc.AddSprite("directions.png", rectDirection, uv, Color.Red); yPos += textSize.Y; } if (!first) // vertical padding below { rectBackground.Y = rectBackground.Y + rectBackground.H; rectBackground.H = 5; rc.AddBox(rectBackground, Color.FromArgb(Settings.TextBgAlpha, 1, 1, 1)); } }
public override void Render(RenderingContext rc) { if (!Settings.GetBool("ItemAlert") || !Settings.GetBool("ItemAlert.ShowText")) { return; } Rect clientRect = this.poe.Internal.game.IngameState.IngameUi.Minimap.SmallMinimap.GetClientRect(); Vec2 rightTopAnchor = new Vec2(clientRect.X + clientRect.W, clientRect.Y + clientRect.H + 5); int y = rightTopAnchor.Y; int fontSize = Settings.GetInt("ItemAlert.ShowText.FontSize"); foreach (KeyValuePair<ExileBot.Entity, AlertDrawStyle> kv in this.currentAlerts) { if (!kv.Key.IsValid) continue; string text = GetItemName(kv); if( null == text ) continue; AlertDrawStyle drawStyle = kv.Value; int frameWidth = drawStyle.FrameWidth; Vec2 vPadding = new Vec2(frameWidth + 5, frameWidth); int frameMargin = frameWidth + 2; Vec2 textPos = new Vec2(rightTopAnchor.X - vPadding.X, y + vPadding.Y); var vTextFrame = rc.AddTextWithHeight(textPos, text, drawStyle.color, fontSize, DrawTextFormat.Right); int iconSize = vTextFrame.Y; bool hasIcon = drawStyle.IconIndex >= 0; int maxHeight = vTextFrame.Y + 2*vPadding.Y + frameMargin; int maxWidth = vTextFrame.X + 2 * vPadding.X + (hasIcon ? iconSize : 0); rc.AddBox(new Rect(rightTopAnchor.X - maxWidth, y, maxWidth, maxHeight), Color.FromArgb(180, 0, 0, 0)); if (hasIcon) { const float iconsInSprite = 4; Rect iconPos = new Rect(textPos.X - iconSize - vTextFrame.X, textPos.Y, iconSize, iconSize); RectUV uv = new RectUV(drawStyle.IconIndex / iconsInSprite, 0, (drawStyle.IconIndex + 1) / iconsInSprite, 1); rc.AddSprite("item_icons.png", iconPos, uv); } if( frameWidth > 0) { Rect frame = new Rect(rightTopAnchor.X - vTextFrame.X - 2*vPadding.X, y, vTextFrame.X + 2*vPadding.X, vTextFrame.Y + 2*vPadding.Y); rc.AddFrame(frame, kv.Value.color, frameWidth); } y += vTextFrame.Y + 2 * vPadding.Y + frameMargin; } }
public override void Render(RenderingContext rc, Dictionary <UiMountPoint, Vec2> mountPoints) { if (!Settings.ShowText || !alertsText.Any()) { return; } Rect rect = model.Window.ClientRect(); int xScreenCenter = rect.W / 2 + rect.X; int yPos = rect.H * Settings.YPosition / 100 + rect.Y; var playerPos = model.Player.GetComponent <Positioned>().GridPos; int fontSize = Settings.TextFontSize; bool first = true; Rect rectBackground = new Rect(); foreach (var alert in alertsText) { int cntAlive = alert.Value.Count(c => c.IsAlive); if (cntAlive == 0) { continue; } Vec2 textSize = rc.MeasureString(alert.Key, fontSize, DrawTextFormat.Center); int iconSize = 3 + textSize.Y; int xPos = xScreenCenter - textSize.X / 2 - 6; rc.AddTextWithHeight(new Vec2(xPos + 6, yPos), alert.Key, Color.Red, fontSize, DrawTextFormat.Left); int cntArrows = 1; rectBackground = new Rect(xPos - cntAlive * iconSize, yPos, textSize.X + 12 + cntAlive * iconSize, textSize.Y); if (first) // vertical padding above { if (!Settings.StackUp) { rectBackground.Y -= 5; } rectBackground.H += 5; first = false; } rc.AddBox(rectBackground, Color.FromArgb(Settings.TextBgAlpha, 1, 1, 1)); foreach (EntityWrapper mob in alert.Value) { if (!mob.IsAlive) { continue; } Vec2 delta = mob.GetComponent <Positioned>().GridPos - playerPos; double phi; double distance = delta.GetPolarCoordinates(out phi); RectUV uv = GetDirectionsUv(phi, distance); Rect rectDirection = new Rect(xPos - cntArrows * iconSize, yPos, rectBackground.H, rectBackground.H); cntArrows++; rc.AddSprite("directions.png", rectDirection, uv, Color.Red); } yPos += Settings.StackUp ? -textSize.Y : textSize.Y; } if (!first) // vertical padding below { rectBackground.Y = rectBackground.Y + (Settings.StackUp ? -rectBackground.H - 5: rectBackground.H); rectBackground.H = 5; rc.AddBox(rectBackground, Color.FromArgb(Settings.TextBgAlpha, 1, 1, 1)); } }
public override void Render(RenderingContext rc, Dictionary<UiMountPoint, Vec2> mountPoints) { if (!Settings.ShowText || !alertsText.Any()) { return; } Rect rect = model.Window.ClientRect(); int xScreenCenter = rect.W / 2 + rect.X; int yPos = rect.H * Settings.YPosition / 100 + rect.Y; var playerPos = model.Player.GetComponent<Positioned>().GridPos; int fontSize = Settings.TextFontSize; bool first = true; Rect rectBackground = new Rect(); foreach (var alert in alertsText) { int cntAlive = alert.Value.Count(c => c.IsAlive); if (cntAlive == 0) continue; Vec2 textSize = rc.MeasureString(alert.Key, fontSize, DrawTextFormat.Center); int iconSize = 3 + textSize.Y; int xPos = xScreenCenter - textSize.X / 2 - 6; rc.AddTextWithHeight(new Vec2(xPos + 6, yPos), alert.Key, Color.Red, fontSize, DrawTextFormat.Left); int cntArrows = 1; rectBackground = new Rect(xPos - cntAlive * iconSize, yPos, textSize.X + 12 + cntAlive * iconSize, textSize.Y); if (first) // vertical padding above { if( !Settings.StackUp) rectBackground.Y -= 5; rectBackground.H += 5; first = false; } rc.AddBox(rectBackground, Color.FromArgb(Settings.TextBgAlpha, 1, 1, 1)); foreach (EntityWrapper mob in alert.Value) { if (!mob.IsAlive) continue; Vec2 delta = mob.GetComponent<Positioned>().GridPos - playerPos; double phi; double distance = delta.GetPolarCoordinates(out phi); RectUV uv = GetDirectionsUv(phi, distance); Rect rectDirection = new Rect(xPos - cntArrows * iconSize, yPos, rectBackground.H, rectBackground.H); cntArrows++; rc.AddSprite("directions.png", rectDirection, uv, Color.Red); } yPos += Settings.StackUp ? -textSize.Y : textSize.Y; } if (!first) // vertical padding below { rectBackground.Y = rectBackground.Y + (Settings.StackUp ? - rectBackground.H - 5: rectBackground.H); rectBackground.H = 5; rc.AddBox(rectBackground, Color.FromArgb(Settings.TextBgAlpha, 1, 1, 1)); } }
private static Vec2 drawItem(RenderingContext rc, AlertDrawStyle drawStyle, Vec2 delta, int x, int y, Vec2 vPadding, string text, int fontSize) { // collapse padding when there's a frame vPadding.X -= drawStyle.FrameWidth; vPadding.Y -= drawStyle.FrameWidth; // item will appear to have equal size double phi; var distance = delta.GetPolarCoordinates(out phi); //text = text + " @ " + (int)distance + " : " + (int)(phi / Math.PI * 180) + " : " + xSprite; int compassOffset = fontSize + 8; Vec2 textPos = new Vec2(x - vPadding.X - compassOffset, y + vPadding.Y); Vec2 vTextSize = rc.AddTextWithHeight(textPos, text, drawStyle.color, fontSize, DrawTextFormat.Right); int iconSize = drawStyle.IconIndex >= 0 ? vTextSize.Y : 0; int fullHeight = vTextSize.Y + 2 * vPadding.Y + 2 * drawStyle.FrameWidth; int fullWidth = vTextSize.X + 2 * vPadding.X + iconSize + 2 * drawStyle.FrameWidth + compassOffset; rc.AddBox(new Rect(x - fullWidth, y, fullWidth - compassOffset, fullHeight), Color.FromArgb(180, 0, 0, 0)); var rectUV = GetDirectionsUv(phi, distance); rc.AddSprite("directions.png", new Rect(x - vPadding.X - compassOffset + 6, y + vPadding.Y, vTextSize.Y, vTextSize.Y), rectUV); if (iconSize > 0) { const float iconsInSprite = 6; Rect iconPos = new Rect(textPos.X - iconSize - vTextSize.X, textPos.Y, iconSize, iconSize); RectUV uv = new RectUV(drawStyle.IconIndex/iconsInSprite, 0, (drawStyle.IconIndex + 1)/iconsInSprite, 1); rc.AddSprite("item_icons.png", iconPos, uv); } if (drawStyle.FrameWidth > 0) { Rect frame = new Rect(x - fullWidth, y, fullWidth - compassOffset , fullHeight); rc.AddFrame(frame, drawStyle.color, drawStyle.FrameWidth); } return new Vec2(fullWidth, fullHeight); }