本文整理汇总了C#中OpenRA.float2.ToInt2方法的典型用法代码示例。如果您正苦于以下问题:C# float2.ToInt2方法的具体用法?C# float2.ToInt2怎么用?C# float2.ToInt2使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OpenRA.float2
的用法示例。
在下文中一共展示了float2.ToInt2方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DrawSupportPowers
void DrawSupportPowers( World world )
{
var powers = world.LocalPlayer.PlayerActor.traits.WithInterface<SupportPower>();
var numPowers = powers.Count(p => p.IsAvailable);
if (numPowers == 0) return;
rgbaRenderer.DrawSprite(ChromeProvider.GetImage(renderer, chromeCollection, "specialbin-top"), new float2(0, 14), "chrome");
for (var i = 1; i < numPowers; i++)
rgbaRenderer.DrawSprite(ChromeProvider.GetImage(renderer, chromeCollection, "specialbin-middle"), new float2(0, 14 + i * 51), "chrome");
rgbaRenderer.DrawSprite(ChromeProvider.GetImage(renderer, chromeCollection, "specialbin-bottom"), new float2(0, 14 + numPowers * 51), "chrome");
rgbaRenderer.Flush();
var y = 24;
SupportPower tooltipItem = null;
int2 tooltipPos = int2.Zero;
foreach (var sp in powers)
{
var image = spsprites[sp.Info.Image];
if (sp.IsAvailable)
{
var drawPos = new float2(5, y);
shpRenderer.DrawSprite(image, drawPos, "chrome");
clock.PlayFetchIndex("idle",
() => (sp.TotalTime - sp.RemainingTime)
* (clock.CurrentSequence.Length - 1) / sp.TotalTime);
clock.Tick();
shpRenderer.DrawSprite(clock.Image, drawPos, "chrome");
var rect = new Rectangle(5, y, 64, 48);
if (sp.IsReady)
{
ready.Play("ready");
shpRenderer.DrawSprite(ready.Image,
drawPos + new float2((64 - ready.Image.size.X) / 2, 2),
"chrome");
}
AddButton(rect, HandleSupportPower(sp));
if (rect.Contains(lastMousePos.ToPoint()))
{
tooltipItem = sp;
tooltipPos = drawPos.ToInt2() + new int2(72, 0);
}
y += 51;
}
}
shpRenderer.Flush();
if (tooltipItem != null)
DrawSupportPowerTooltip(world, tooltipItem, tooltipPos);
}