本文整理汇总了C#中OpenRA.Graphics.WorldRenderer.ScreenPxPosition方法的典型用法代码示例。如果您正苦于以下问题:C# WorldRenderer.ScreenPxPosition方法的具体用法?C# WorldRenderer.ScreenPxPosition怎么用?C# WorldRenderer.ScreenPxPosition使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OpenRA.Graphics.WorldRenderer
的用法示例。
在下文中一共展示了WorldRenderer.ScreenPxPosition方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Viewport
public Viewport(WorldRenderer wr, Map map)
{
worldRenderer = wr;
var grid = Game.ModData.Manifest.Get<MapGrid>();
// Calculate map bounds in world-px
if (wr.World.Type == WorldType.Editor)
{
// The full map is visible in the editor
var width = map.MapSize.X * grid.TileSize.Width;
var height = map.MapSize.Y * grid.TileSize.Height;
if (wr.World.Map.Grid.Type == MapGridType.RectangularIsometric)
height /= 2;
mapBounds = new Rectangle(0, 0, width, height);
CenterLocation = new int2(width / 2, height / 2);
}
else
{
var tl = wr.ScreenPxPosition(map.ProjectedTopLeft);
var br = wr.ScreenPxPosition(map.ProjectedBottomRight);
mapBounds = Rectangle.FromLTRB(tl.X, tl.Y, br.X, br.Y);
CenterLocation = (tl + br) / 2;
}
Zoom = Game.Settings.Graphics.PixelDouble ? 2 : 1;
tileSize = grid.TileSize;
}
示例2: Viewport
public Viewport(WorldRenderer wr, Map map)
{
worldRenderer = wr;
// Calculate map bounds in world-px
var b = map.Bounds;
var tl = wr.ScreenPxPosition(new CPos(b.Left, b.Top).TopLeft);
var br = wr.ScreenPxPosition(new CPos(b.Right, b.Bottom).BottomRight);
mapBounds = Rectangle.FromLTRB(tl.X, tl.Y, br.X, br.Y);
CenterLocation = (tl + br) / 2;
Zoom = Game.Settings.Graphics.PixelDouble ? 2 : 1;
}
示例3: Viewport
public Viewport(WorldRenderer wr, Map map)
{
worldRenderer = wr;
// Calculate map bounds in world-px
var b = map.Bounds;
// Expand to corners of cells
var tl = wr.ScreenPxPosition(map.CenterOfCell(Map.MapToCell(map.TileShape, new CPos(b.Left, b.Top))) - new WVec(512, 512, 0));
var br = wr.ScreenPxPosition(map.CenterOfCell(Map.MapToCell(map.TileShape, new CPos(b.Right, b.Bottom))) + new WVec(511, 511, 0));
mapBounds = Rectangle.FromLTRB(tl.X, tl.Y, br.X, br.Y);
CenterLocation = (tl + br) / 2;
Zoom = Game.Settings.Graphics.PixelDouble ? 2 : 1;
}
示例4: RenderAfterWorld
public void RenderAfterWorld(WorldRenderer wr, Actor self)
{
if (devMode == null || !devMode.ShowMuzzles)
return;
if (health.Value != null)
wr.DrawRangeCircle(Color.Red, wr.ScreenPxPosition(self.CenterPosition), health.Value.Info.Radius / Game.CellSize);
var wlr = Game.Renderer.WorldLineRenderer;
var c = Color.White;
foreach (var a in armaments.Value)
{
foreach (var b in a.Barrels)
{
var muzzle = self.CenterPosition + a.MuzzleOffset(self, b);
var dirOffset = new WVec(0, -224, 0).Rotate(a.MuzzleOrientation(self, b));
var sm = wr.ScreenPosition(muzzle);
var sd = wr.ScreenPosition(muzzle + dirOffset);
wlr.DrawLine(sm, sd, c, c);
wr.DrawTargetMarker(c, sm);
}
}
}
示例5: RenderAfterWorld
public IEnumerable<IRenderable> RenderAfterWorld(WorldRenderer wr)
{
if (!self.Owner.IsAlliedWith(self.World.RenderPlayer) || self.World.FogObscures(self))
yield break;
if (Info.RenderSelectionBox)
yield return new SelectionBoxRenderable(self, Info.SelectionBoxColor);
if (Info.RenderSelectionBars)
yield return new SelectionBarsRenderable(self);
if (self.World.LocalPlayer != null && self.World.LocalPlayer.PlayerActor.Trait<DeveloperMode>().PathDebug)
yield return new TargetLineRenderable(ActivityTargetPath(), Color.Green);
var b = self.VisualBounds;
var pos = wr.ScreenPxPosition(self.CenterPosition);
var tl = wr.Viewport.WorldToViewPx(pos + new int2(b.Left, b.Top));
var bl = wr.Viewport.WorldToViewPx(pos + new int2(b.Left, b.Bottom));
var tm = wr.Viewport.WorldToViewPx(pos + new int2((b.Left + b.Right) / 2, b.Top));
foreach (var r in DrawControlGroup(wr, self, tl))
yield return r;
foreach (var r in DrawPips(wr, self, bl))
yield return r;
foreach (var r in DrawTags(wr, self, tm))
yield return r;
}
示例6: Viewport
public Viewport(WorldRenderer wr, Map map)
{
worldRenderer = wr;
var cells = wr.World.Type == WorldType.Editor ?
map.AllCells : map.CellsInsideBounds;
// Calculate map bounds in world-px
var tl = wr.ScreenPxPosition(map.CenterOfCell(cells.TopLeft) - new WVec(512, 512, 0));
var br = wr.ScreenPxPosition(map.CenterOfCell(cells.BottomRight) + new WVec(511, 511, 0));
mapBounds = Rectangle.FromLTRB(tl.X, tl.Y, br.X, br.Y);
CenterLocation = (tl + br) / 2;
Zoom = Game.Settings.Graphics.PixelDouble ? 2 : 1;
tileSize = Game.ModData.Manifest.TileSize;
}
示例7: DrawRangeCircle
public static void DrawRangeCircle(WorldRenderer wr, WPos pos, int range, Color color)
{
wr.DrawRangeCircleWithContrast(
Color.FromArgb(128, color),
wr.ScreenPxPosition(pos),
range,
Color.FromArgb(96, Color.Black));
}
示例8: RenderAfterWorld
public void RenderAfterWorld(WorldRenderer wr)
{
if (self.Owner != self.World.LocalPlayer)
return;
wr.DrawRangeCircleWithContrast(
Color.FromArgb(128, Color.LimeGreen),
wr.ScreenPxPosition(self.CenterPosition), self.Info.Traits.Get<DetectCloakedInfo>().Range,
Color.FromArgb(96, Color.Black));
}
示例9: Render
public IEnumerable<IRenderable> Render(Actor self, WorldRenderer wr)
{
var pos = wr.ScreenPxPosition(self.CenterPosition);
var bounds = self.Bounds;
bounds.Offset(pos.X, pos.Y);
var spaceBuffer = (int)(10 / wr.Viewport.Zoom);
var effectPos = wr.ProjectedPosition(new int2(pos.X, bounds.Y - spaceBuffer));
yield return new TextRenderable(font, effectPos, 0, color, name);
}
示例10: RenderAfterWorld
// Range circle
public void RenderAfterWorld(WorldRenderer wr)
{
// Visible to player and allies
if (!ValidRenderPlayer())
return;
wr.DrawRangeCircleWithContrast(
Color.FromArgb(128, Ready() ? Color.White : Color.Red),
wr.ScreenPxPosition(self.CenterPosition), Info.Range,
Color.FromArgb(96, Color.Black));
}
示例11: RenderAfterWorld
public void RenderAfterWorld(WorldRenderer wr)
{
var force = Game.GetModifierKeys().HasModifier(Modifiers.Alt);
if ((lifetime <= 0 || --lifetime <= 0) && !force)
return;
if (targets == null || targets.Count == 0)
return;
var from = wr.ScreenPxPosition(self.CenterPosition);
foreach (var target in targets)
{
if (target.Type == TargetType.Invalid)
continue;
var to = wr.ScreenPxPosition(target.CenterPosition);
Game.Renderer.WorldLineRenderer.DrawLine(from, to, c, c);
wr.DrawTargetMarker(c, from);
wr.DrawTargetMarker(c, to);
}
}
示例12: RenderAfterWorld
public void RenderAfterWorld(WorldRenderer wr)
{
if (self.Owner != self.World.LocalPlayer)
return;
// Hack: Convert world coords to cells
var pxRange = self.Trait<AttackBase>().GetMaximumRange().Range / 1024f;
wr.DrawRangeCircleWithContrast(
Color.FromArgb(128, Color.Yellow),
wr.ScreenPxPosition(self.CenterPosition), pxRange,
Color.FromArgb(96, Color.Black));
}
示例13: Render
public void Render(WorldRenderer wr, World w, ActorInfo ai, WPos centerPosition)
{
wr.DrawRangeCircleWithContrast(
Color.FromArgb(128, Color.Cyan),
wr.ScreenPxPosition(centerPosition),
ai.Traits.Get<CreatesShroudInfo>().Range,
Color.FromArgb(96, Color.Black));
foreach (var a in w.ActorsWithTrait<RenderShroudCircle>())
if (a.Actor.Owner == a.Actor.World.LocalPlayer)
a.Trait.RenderAfterWorld(wr);
}
示例14: Render
public void Render(WorldRenderer wr, World w, ActorInfo ai, WPos centerPosition)
{
wr.DrawRangeCircleWithContrast(
Color.FromArgb(128, Color.Yellow), wr.ScreenPxPosition(centerPosition),
ai.Traits.WithInterface<ArmamentInfo>()
.Select(a => Rules.Weapons[a.Weapon.ToLowerInvariant()].Range).Max(),
Color.FromArgb(96, Color.Black));
foreach (var a in w.ActorsWithTrait<RenderRangeCircle>())
if (a.Actor.Owner == a.Actor.World.LocalPlayer)
if (a.Actor.Info.Traits.Get<RenderRangeCircleInfo>().RangeCircleType == RangeCircleType)
a.Trait.RenderAfterWorld(wr);
}
示例15: DrawRollover
public void DrawRollover(WorldRenderer wr)
{
if (!Info.Selectable)
return;
var pos = wr.ScreenPxPosition(self.CenterPosition);
var bounds = self.Bounds.Value;
bounds.Offset(pos.X, pos.Y);
var xy = new float2(bounds.Left, bounds.Top);
var Xy = new float2(bounds.Right, bounds.Top);
DrawHealthBar(wr, xy, Xy);
DrawExtraBars(wr, xy, Xy);
}