本文整理汇总了C#中RenderingContext.AddFrame方法的典型用法代码示例。如果您正苦于以下问题:C# RenderingContext.AddFrame方法的具体用法?C# RenderingContext.AddFrame怎么用?C# RenderingContext.AddFrame使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RenderingContext
的用法示例。
在下文中一共展示了RenderingContext.AddFrame方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Render
public override void Render(RenderingContext rc)
{
Element glw = poe.Internal.IngameState.IngameUi.GemLvlUpPanel;
if (glw.IsVisible && glw.Height >0)
{
Rect r = glw.GetClientRect();
foreach (Element e in glw.Children) // there is a subwindow for every Gem to level
{
Element LevelUpButton = e.Children[1]; // Element for the levelUp Button
if (LevelUpButton.IsVisible && LevelUpButton.Height > 0)
{
Rect lur = LevelUpButton.GetClientRect();
rc.AddFrame(r, Color.Gold, 2); // should only be display one time, but who cares
rc.AddFrame(lur, Color.Cornsilk, 1);
//DoMouseClick(lur.X + lur.W / 2, lur.Y + lur.H / 2);
}
}
}
}
示例2: drawElt
private static void drawElt(RenderingContext rc, Element root, Vec2 parent, ref int x, ref int yPos, int[] path, int depth = 0)
{
if (!root.IsVisibleLocal || depth > 3)
{
return;
}
//Rect rC = new Rect(parent.X + (int)(root.X * 0.75), parent.Y + (int)(root.Y * 0.75), (int)(root.Width * 0.75), (int)(root.Height * 0.75));
Rect rC = new Rect(parent.X + (int)(root.X * 0.75), parent.Y + (int)(root.Y * 0.75), (int)(root.Width * 0.75), (int)(root.Height * 0.75));
if (rC.W < 20)
return;
string sPath = path[0].ToString("X3") + "-" + String.Join("-", path.Skip(1).Take(depth-1));
int ix = depth > 0 ? path[depth - 1] : 0;
var c = Color.FromArgb(255, 255 - 25 * (ix % 10), 255 - 25 * ((ix % 100) / 10), 255);
string msg = string.Format("[{2}] {1:X8} : {0}", rC, root.Address, sPath);
var v = rc.AddTextWithHeight(new Vec2(x, yPos), msg, c, 9, DrawTextFormat.Left);
rc.AddTextWithHeight(new Vec2(rC.X, rC.Y + depth * 10 - 10), sPath, c, 8, DrawTextFormat.Left);
rc.AddFrame(rC, c);
yPos += v.Y;
if (yPos > 1100)
{
yPos = 80;
x += 300;
}
var pp = new Vec2(rC.X, rC.Y);
for (int i = 0; i < root.Children.Count; i++)
{
var elt = root.Children[i];
path[depth] = i;
if (depth < 8)
drawElt(rc, elt, pp, ref x, ref yPos, path, depth + 1);
}
}
示例3: Render
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;
}
}
示例4: drawElt
private static void drawElt(RenderingContext rc, Element root, Vec2 parent, ref int x, ref int yPos, int[] path, int depth = 0)
{
if ( /* !root.IsVisibleLocal || */ depth > MAX_DEPTH)
{
return;
}
var scale = root.Scale;
Vec2f position = new Vec2f(parent.X + root.X * scale, parent.Y + root.Y * scale);
Vec2 size = new Vec2((int)(root.Width * scale), (int)(root.Height * scale));
// if (rC.W < 20) return;
string sPath = path[0].ToString("X3") + "-" + String.Join("-", path.Skip(1).Take(depth-1));
int ix = depth > 0 ? path[depth - 1] : 0;
var c = Color.FromArgb(255, 255 - 25 * (ix % 10), 255 - 25 * ((ix % 100) / 10), 255);
string msg = string.Format("[{2}] {1:X8} : {0} {3}", position, root.Address, sPath, size);
var v = rc.AddTextWithHeight(new Vec2(x, yPos), msg, c, 9, DrawTextFormat.Left);
rc.AddTextWithHeight(new Vec2f(position.X, position.Y + depth * 10 - 10), sPath, c, 8, DrawTextFormat.Left);
// rc.AddTextWithHeightAndOutline(new Vec2(rC.X, rC.Y + depth * 10 - 10), sPath, c, Color.Black, 8, DrawTextFormat.Left);
rc.AddFrame(new Rect(position, size), c);
yPos += v.Y;
if (yPos > 1100)
{
yPos = 80;
x += 300;
}
position.Y += root.ScrollY * root.Scale;
List<Element> children = root.Children;
for (int i = 0; i < children.Count && i < MAX_CHILDREN; i++)
{
var elt = children[i];
path[depth] = i;
drawElt(rc, elt, position, ref x, ref yPos, path, depth + 1);
}
}
示例5: drawItem
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);
}
示例6: Render
public override void Render(RenderingContext rc, Dictionary<UiMountPoint, Vec2> mountPoints)
{
if (!Settings.ShowText && !Settings.ShowBorder) return;
var playerPos = model.Player.GetComponent<Positioned>().GridPos;
Vec2 rightTopAnchor = mountPoints[UiMountPoint.UnderMinimap];
int y = rightTopAnchor.Y;
int fontSize = Settings.TextFontSize;
var itemsOnGroundLabels = model.Internal.IngameState.IngameUi.ItemsOnGroundLabels;
const int VMargin = 2;
foreach (KeyValuePair<EntityWrapper, AlertDrawStyle> kv in currentAlerts.Where(a => a.Key.IsValid))
{
string text = GetItemName(kv);
if( null == text ) continue;
if (Settings.ShowBorder)
{
if (!groundItemLabels.Any(labeledItem => labeledItem.ItemOnGround.Address == kv.Key.Address))
{
ItemsOnGroundLabelElement labeledItem = model.Internal.IngameState.IngameUi.ItemsOnGroundLabels.FirstOrDefault(z => z.ItemOnGround.Address == kv.Key.Address);
if (labeledItem != null)
{
groundItemLabels.Add(labeledItem);
}
}
if (groundItemLabels.Any(labeledItem => labeledItem.ItemOnGround.Address == kv.Key.Address && labeledItem.Label.IsVisible))
{
var rect = groundItemLabels.First(labeledItem => labeledItem.ItemOnGround.Address == kv.Key.Address).Label.GetClientRect();
int thickness = Settings.ShowBorder.Thickness.Value;
Color color = Settings.ShowBorder.Color.Value;
if(Settings.ShowBorder.Customize.Enabled)
{
Entity e = kv.Key.GetComponent<WorldItem>().ItemEntity;
foreach(ShowBorderCustomizeSetting type in Settings.ShowBorder.Customize.GetSettings().Where(t => t.Enabled))
{
switch(type.BlockName)
{
case "Uniques":
if (!e.GetComponent<Mods>().ItemRarity.Equals(Game.Rarity.Unique))
continue;
break;
case "Sockets":
if (!new int[] { 0, 3, 4, 5 }.Contains(kv.Value.IconIndex))
continue;
break;
case "RGB":
if (!kv.Value.IconIndex.Equals(1))
continue;
break;
case "CraftingBases":
if (!kv.Value.IconIndex.Equals(2))
continue;
break;
default:
if (!e.Path.Contains(type.BlockName))
continue;
break;
}
thickness = type.Thickness.Value;
color = type.Color.Value;
break;
}
}
if (thickness > 0
&& (model.Internal.IngameState.IngameUi.InventoryPanel.IsVisible ? !rect.IntersectsWith(model.Internal.IngameState.IngameUi.InventoryPanel.GetClientRect()) : true)
&& (model.Internal.IngameState.IngameUi.CharacterPanel.IsVisible ? !rect.IntersectsWith(model.Internal.IngameState.IngameUi.CharacterPanel.GetClientRect()) : true)
&& (model.Internal.IngameState.IngameUi.SocialPanel.IsVisible ? !rect.IntersectsWith(model.Internal.IngameState.IngameUi.SocialPanel.GetClientRect()) : true)
&& (model.Internal.IngameState.IngameUi.TreePanel.IsVisible ? !rect.IntersectsWith(model.Internal.IngameState.IngameUi.TreePanel.GetClientRect()) : true)
&& (model.Internal.IngameState.IngameUi.OptionsPanel.IsVisible ? !rect.IntersectsWith(model.Internal.IngameState.IngameUi.OptionsPanel.GetClientRect()) : true)
&& (model.Internal.IngameState.IngameUi.AchievementsPanel.IsVisible ? !rect.IntersectsWith(model.Internal.IngameState.IngameUi.AchievementsPanel.GetClientRect()) : true)
&& (model.Internal.IngameState.IngameUi.WorldPanel.IsVisible ? !rect.IntersectsWith(model.Internal.IngameState.IngameUi.WorldPanel.GetClientRect()) : true))
{
rc.AddFrame(rect, color, thickness);
}
}
}
if (Settings.ShowText)
{
Vec2 itemPos = kv.Key.GetComponent<Positioned>().GridPos;
var delta = itemPos - playerPos;
Vec2 vPadding = new Vec2(5, 2);
Vec2 itemDrawnSize = drawItem(rc, kv.Value, delta, rightTopAnchor.X, y, vPadding, text, fontSize);
y += itemDrawnSize.Y + VMargin;
}
}
}