本文整理汇总了C#中int2.WithY方法的典型用法代码示例。如果您正苦于以下问题:C# int2.WithY方法的具体用法?C# int2.WithY怎么用?C# int2.WithY使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类int2
的用法示例。
在下文中一共展示了int2.WithY方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Draw
public override void Draw()
{
var pos = RenderOrigin;
var chatLogArea = new Rectangle(pos.X, pos.Y, Bounds.Width, Bounds.Height);
var chatpos = new int2(chatLogArea.X + 5, chatLogArea.Bottom - 5);
var font = Game.Renderer.Fonts["Regular"];
Game.Renderer.EnableScissor(chatLogArea);
foreach (var line in recentLines.AsEnumerable().Reverse())
{
var inset = 0;
string owner = null;
if (!string.IsNullOrEmpty(line.Owner))
{
owner = line.Owner + ":";
inset = font.Measure(owner).X + 5;
}
var text = WidgetUtils.WrapText(line.Text, chatLogArea.Width - inset - 6, font);
chatpos = chatpos.WithY(chatpos.Y - (Math.Max(15, font.Measure(text).Y) + 5));
if (chatpos.Y < pos.Y)
break;
if (owner != null)
{
if (UseContrast)
font.DrawTextWithContrast(owner, chatpos,
line.Color, BackgroundColorDark, BackgroundColorLight, 1);
else if (UseShadow)
font.DrawTextWithShadow(owner, chatpos,
line.Color, BackgroundColorDark, BackgroundColorLight, 1);
else
font.DrawText(owner, chatpos, line.Color);
}
if (UseContrast)
font.DrawTextWithContrast(text, chatpos + new int2(inset, 0),
Color.White, Color.Black, 1);
else if (UseShadow)
font.DrawTextWithShadow(text, chatpos + new int2(inset, 0),
Color.White, Color.Black, 1);
else
font.DrawText(text, chatpos + new int2(inset, 0), Color.White);
}
Game.Renderer.DisableScissor();
}
示例2: DrawTags
IEnumerable<IRenderable> DrawTags(WorldRenderer wr, Actor self, int2 basePosition)
{
var tagImages = new Animation(self.World, "pips");
var pal = wr.Palette(Info.Palette);
var tagxyOffset = new int2(0, 6);
foreach (var tags in self.TraitsImplementing<ITags>())
{
foreach (var tag in tags.GetTags())
{
if (tag == TagType.None)
continue;
tagImages.PlayRepeating(TagStrings[(int)tag]);
var pos = basePosition + tagxyOffset - (0.5f * tagImages.Image.Size).ToInt2();
yield return new UISpriteRenderable(tagImages.Image, pos, 0, pal, 1f);
// Increment row
tagxyOffset = tagxyOffset.WithY(tagxyOffset.Y + 8);
}
}
}