本文整理汇总了C#中OpenRA.Graphics.WorldRenderer.Palette方法的典型用法代码示例。如果您正苦于以下问题:C# WorldRenderer.Palette方法的具体用法?C# WorldRenderer.Palette怎么用?C# WorldRenderer.Palette使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OpenRA.Graphics.WorldRenderer
的用法示例。
在下文中一共展示了WorldRenderer.Palette方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Draw
internal void Draw(WorldRenderer wr)
{
if (initializePalettes)
{
fogPalette = wr.Palette("fog");
shroudPalette = wr.Palette("shroud");
initializePalettes = false;
}
if (shroud != null && shroud.dirty)
{
shroud.dirty = false;
for (int i = map.Bounds.Left; i < map.Bounds.Right; i++)
for (int j = map.Bounds.Top; j < map.Bounds.Bottom; j++)
sprites[i, j] = ChooseShroud(i, j);
for (int i = map.Bounds.Left; i < map.Bounds.Right; i++)
for (int j = map.Bounds.Top; j < map.Bounds.Bottom; j++)
fogSprites[i, j] = ChooseFog(i, j);
}
var clipRect = Game.viewport.WorldBounds(wr.world);
DrawShroud(wr, clipRect, sprites, shroudPalette);
if (wr.world.WorldActor.HasTrait<Fog>())
DrawShroud(wr, clipRect, fogSprites, fogPalette);
}
示例2: Render
public IEnumerable<IRenderable> Render(WorldRenderer wr)
{
if (building.Disposed || rb.Repairers.Count == 0 || wr.World.FogObscures(building))
return SpriteRenderable.None;
PaletteReference palette;
if (!string.IsNullOrEmpty(rb.Info.IndicatorPalette))
palette = wr.Palette(rb.Info.IndicatorPalette);
else
palette = wr.Palette(rb.Info.IndicatorPalettePrefix + rb.Repairers[shownPlayer % rb.Repairers.Count].InternalName);
return anim.Render(building.CenterPosition, palette);
}
示例3: WorldLoaded
public void WorldLoaded(World w, WorldRenderer wr)
{
if (w.Type != WorldType.Editor)
return;
palette = wr.Palette(info.Palette);
}
示例4: InitPalette
public void InitPalette( WorldRenderer wr )
{
var paletteName = "{0}{1}".F( info.BaseName, owner.InternalName );
var newpal = new Palette(wr.Palette(info.BasePalette).Palette,
new PlayerColorRemap(info.RemapIndex, owner.ColorRamp));
wr.AddPalette(paletteName, newpal, info.AllowModifiers);
}
示例5: Render
public IEnumerable<IRenderable> Render(WorldRenderer wr)
{
if (!a.IsInWorld || a.World.FogObscures(a.Location))
return SpriteRenderable.None;
return anim.Render(a.CenterPosition, wr.Palette(palette));
}
示例6: Render
public IEnumerable<Renderable> Render(WorldRenderer wr)
{
if (a.IsInWorld)
yield return new Renderable(anim.Image,
a.CenterLocation.ToFloat2() - .5f * anim.Image.size + offset,
wr.Palette("effect"), (int)a.CenterLocation.Y);
}
示例7: Render
public IEnumerable<IRenderable> Render(WorldRenderer wr)
{
if (world.FogObscures(pos))
return SpriteRenderable.None;
return anim.Render(pos, wr.Palette(palette));
}
示例8: Render
public IEnumerable<IRenderable> Render(WorldRenderer wr)
{
if (a.Destroyed || wr.world.FogObscures(a))
return SpriteRenderable.None;
return anim.Render(a.CenterPosition, wr.Palette("chrome"));
}
示例9: Render
public IEnumerable<IRenderable> Render(WorldRenderer wr)
{
var rc = cargo.Render(wr);
// Don't render anything if the cargo is invisible (e.g. under fog)
if (!rc.Any())
yield break;
var parachuteShadowPalette = wr.Palette(parachutableInfo.ParachuteShadowPalette);
foreach (var c in rc)
{
if (!c.IsDecoration && shadow == null)
yield return c.WithPalette(parachuteShadowPalette).WithZOffset(c.ZOffset - 1).AsDecoration();
yield return c.OffsetBy(pos - c.Pos);
}
var shadowPalette = !string.IsNullOrEmpty(parachutableInfo.ShadowPalette) ? wr.Palette(parachutableInfo.ShadowPalette) : rc.First().Palette;
if (shadow != null)
foreach (var r in shadow.Render(pos - new WVec(0, 0, pos.Z), WVec.Zero, 1, shadowPalette, 1f))
yield return r;
var parachutePalette = !string.IsNullOrEmpty(parachutableInfo.ParachutePalette) ? wr.Palette(parachutableInfo.ParachutePalette) : rc.First().Palette;
if (parachute != null)
foreach (var r in parachute.Render(pos, parachuteOffset, 1, parachutePalette, 1f))
yield return r;
}
示例10: TerrainRenderer
public TerrainRenderer(World world, WorldRenderer wr)
{
this.world = world;
this.map = world.Map;
var tileSize = new Size( Game.CellSize, Game.CellSize );
var tileMapping = new Cache<TileReference<ushort,byte>, Sprite>(
x => Game.modData.SheetBuilder.Add(world.TileSet.GetBytes(x), tileSize));
var vertices = new Vertex[4 * map.Bounds.Height * map.Bounds.Width];
terrainSheet = tileMapping[map.MapTiles.Value[map.Bounds.Left, map.Bounds.Top]].sheet;
int nv = 0;
var terrainPalette = wr.Palette("terrain").Index;
for( int j = map.Bounds.Top; j < map.Bounds.Bottom; j++ )
for( int i = map.Bounds.Left; i < map.Bounds.Right; i++ )
{
var tile = tileMapping[map.MapTiles.Value[i, j]];
// TODO: move GetPaletteIndex out of the inner loop.
Util.FastCreateQuad(vertices, Game.CellSize * new float2(i, j), tile, terrainPalette, nv, tile.size);
nv += 4;
if (tileMapping[map.MapTiles.Value[i, j]].sheet != terrainSheet)
throw new InvalidOperationException("Terrain sprites span multiple sheets");
}
vertexBuffer = Game.Renderer.Device.CreateVertexBuffer( vertices.Length );
vertexBuffer.SetData( vertices, nv );
}
示例11: Render
public IEnumerable<IRenderable> Render(WorldRenderer wr)
{
if (a.Destroyed || wr.World.FogObscures(a))
return SpriteRenderable.None;
return anim.Render(a.CenterPosition, wr.Palette(canPowerDown.Info.IndicatorPalette));
}
示例12: Render
public IEnumerable<IRenderable> Render(WorldRenderer wr)
{
if (!args.SourceActor.World.FogObscures(pos))
{
if (info.Shadow)
{
var shadowPos = pos - new WVec(0, 0, pos.Z);
foreach (var r in anim.Render(shadowPos, wr.Palette("shadow")))
yield return r;
}
var palette = wr.Palette(info.Palette);
foreach (var r in anim.Render(pos, palette))
yield return r;
}
}
示例13: Render
public IEnumerable<IRenderable> Render(WorldRenderer wr)
{
if (world.FogObscures(pos) && !visibleThroughFog)
return SpriteRenderable.None;
var zoom = scaleSizeWithZoom ? 1f / wr.Viewport.Zoom : 1f;
return anim.Render(pos, WVec.Zero, 0, wr.Palette(palette), zoom);
}
示例14: Render
public IEnumerable<IRenderable> Render(WorldRenderer wr)
{
if (building.Destroyed || wr.world.FogObscures(building))
return SpriteRenderable.None;
return anim.Render(building.CenterPosition,
wr.Palette(palettePrefix+player.InternalName));
}
示例15: Render
public IEnumerable<IRenderable> Render(WorldRenderer wr)
{
if (!show || self.Destroyed)
return SpriteRenderable.None;
var palette = wr.Palette(info.IndicatorPalettePrefix + self.Owner.InternalName);
return anim.Render(self.CenterPosition, palette);
}