当前位置: 首页>>代码示例>>C#>>正文


C# WorldRenderer.Palette方法代码示例

本文整理汇总了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);
        }
开发者ID:nevelis,项目名称:OpenRA,代码行数:26,代码来源:ShroudRenderer.cs

示例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);
        }
开发者ID:CH4Code,项目名称:OpenRA,代码行数:13,代码来源:RepairIndicator.cs

示例3: WorldLoaded

		public void WorldLoaded(World w, WorldRenderer wr)
		{
			if (w.Type != WorldType.Editor)
				return;

			palette = wr.Palette(info.Palette);
		}
开发者ID:Roger-luo,项目名称:OpenRA,代码行数:7,代码来源:EditorSelectionLayer.cs

示例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);
 }
开发者ID:nevelis,项目名称:OpenRA,代码行数:7,代码来源:PlayerColorPalette.cs

示例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));
        }
开发者ID:ushardul,项目名称:OpenRA,代码行数:7,代码来源:CrateEffect.cs

示例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);
 }
开发者ID:nevelis,项目名称:OpenRA,代码行数:7,代码来源:CrateEffect.cs

示例7: Render

        public IEnumerable<IRenderable> Render(WorldRenderer wr)
        {
            if (world.FogObscures(pos))
                return SpriteRenderable.None;

            return anim.Render(pos, wr.Palette(palette));
        }
开发者ID:CH4Code,项目名称:OpenRA,代码行数:7,代码来源:Explosion.cs

示例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"));
        }
开发者ID:RobotCaleb,项目名称:OpenRA,代码行数:7,代码来源:PowerdownIndicator.cs

示例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;
        }
开发者ID:RobotCaleb,项目名称:OpenRA,代码行数:27,代码来源:Parachute.cs

示例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 );
        }
开发者ID:nevelis,项目名称:OpenRA,代码行数:32,代码来源:TerrainRenderer.cs

示例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));
        }
开发者ID:ushardul,项目名称:OpenRA,代码行数:7,代码来源:PowerdownIndicator.cs

示例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;
            }
        }
开发者ID:zombie-einstein,项目名称:OpenRA,代码行数:16,代码来源:GravityBomb.cs

示例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);
        }
开发者ID:CH4Code,项目名称:OpenRA,代码行数:8,代码来源:SpriteEffect.cs

示例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));
        }
开发者ID:Generalcamo,项目名称:OpenRA,代码行数:8,代码来源:RepairIndicator.cs

示例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);
        }
开发者ID:TiriliPiitPiit,项目名称:OpenRA,代码行数:8,代码来源:GpsDot.cs


注:本文中的OpenRA.Graphics.WorldRenderer.Palette方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。