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


C# WorldRenderer.AddPalette方法代码示例

本文整理汇总了C#中OpenRA.Graphics.WorldRenderer.AddPalette方法的典型用法代码示例。如果您正苦于以下问题:C# WorldRenderer.AddPalette方法的具体用法?C# WorldRenderer.AddPalette怎么用?C# WorldRenderer.AddPalette使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在OpenRA.Graphics.WorldRenderer的用法示例。


在下文中一共展示了WorldRenderer.AddPalette方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: InitPalette

 public void InitPalette( WorldRenderer wr )
 {
     var info = Rules.Info["player"].Traits.WithInterface<PlayerColorPaletteInfo>()
         .First(p => p.BaseName == Info.PlayerPalette);
     format = info.PaletteFormat;
     wr.AddPalette("colorpicker", wr.GetPalette(info.BasePalette));
 }
开发者ID:sonygod,项目名称:OpenRA-Dedicated-20120504,代码行数:7,代码来源:ColorPickerPaletteModifier.cs

示例2: 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

示例3: InitPalette

        public void InitPalette(WorldRenderer wr)
        {
            var c = info.Type == ShroudPaletteType.Shroud ? Shroud :
                    info.Type == ShroudPaletteType.Fog ? Fog : Combined;

            wr.AddPalette(info.Name, new Palette(Exts.MakeArray(256, i => (uint)c[i % 8].ToArgb())), false);
        }
开发者ID:TiriliPiitPiit,项目名称:OpenRA,代码行数:7,代码来源:ShroudPalette.cs

示例4: InitPalette

 public void InitPalette( WorldRenderer wr )
 {
     var paletteName = "{0}{1}".F( info.BaseName, owner.InternalName );
     var newpal = new Palette(wr.GetPalette(info.BasePalette),
                      new PlayerColorRemap(info.PaletteFormat, owner.ColorRamp));
     wr.AddPalette(paletteName, newpal);
 }
开发者ID:sonygod,项目名称:OpenRA-Dedicated-20120504,代码行数:7,代码来源:PlayerColorPalette.cs

示例5: LoadPalettes

        public void LoadPalettes(WorldRenderer wr)
        {
            // Enable palette only for a specific tileset
            if (info.Tileset != null && info.Tileset.ToLowerInvariant() != world.Map.Tileset.ToLowerInvariant())
                return;

            var c = (uint)((info.A << 24) | (info.R << 16) | (info.G << 8) | info.B);
            wr.AddPalette(info.Name, new ImmutablePalette(Enumerable.Range(0, Palette.Size).Select(i => (i == 0) ? 0 : c)), info.AllowModifiers);
        }
开发者ID:RobotCaleb,项目名称:OpenRA,代码行数:9,代码来源:PaletteFromRGBA.cs

示例6: InitPalette

        public void InitPalette(WorldRenderer wr)
        {
            // Enable palette only for a specific tileset
            if (info.Tileset != null && info.Tileset.ToLowerInvariant() != world.Map.Tileset.ToLowerInvariant())
                return;

            var c = (uint)((info.A << 24) | (info.R << 16) | (info.G << 8) | info.B);
            wr.AddPalette(info.Name, new Palette(Exts.MakeArray(256, i => (i == 0) ? 0 : c)), info.AllowModifiers);
        }
开发者ID:nevelis,项目名称:OpenRA,代码行数:9,代码来源:PaletteFromRGBA.cs

示例7: InitPalette

 public void InitPalette( WorldRenderer wr )
 {
     if (info.Theatre == null || info.Theatre.ToLowerInvariant() == world.Map.Theater.ToLowerInvariant())
     {
         // TODO: This shouldn't rely on a base palette
         var pal = wr.GetPalette("terrain");
         wr.AddPalette(info.Name, new Palette(pal, new SingleColorRemap(Color.FromArgb(info.A, info.R, info.G, info.B))));
     }
 }
开发者ID:geckosoft,项目名称:OpenRA,代码行数:9,代码来源:PaletteFromRGBA.cs

示例8: LoadPalettes

		public void LoadPalettes(WorldRenderer wr)
		{
			Func<int, uint> makeColor = i =>
			{
				if (i < 128)
					return (uint)(int2.Lerp(255, 0, i, 127) << 24);
				return 0;
			};

			wr.AddPalette(info.Name, new ImmutablePalette(Enumerable.Range(0, Palette.Size).Select(i => makeColor(i))));
		}
开发者ID:Roger-luo,项目名称:OpenRA,代码行数:11,代码来源:TSShroudPalette.cs

示例9: InitPalette

        public void InitPalette(WorldRenderer wr)
        {
            var c = new[] {
                Color.Transparent, Color.Green,
                Color.Blue, Color.Yellow,
                Color.Black,
                Color.FromArgb(128,0,0,0),
                Color.Transparent,
                Color.Transparent
            };

            wr.AddPalette(info.Name, new Palette(Exts.MakeArray(256, i => (uint)c[i % 8].ToArgb())), false);
        }
开发者ID:nevelis,项目名称:OpenRA,代码行数:13,代码来源:ShroudPalette.cs

示例10: LoadPalettes

		public void LoadPalettes(WorldRenderer wr)
		{
			// Enable palette only for a specific tileset
			if (info.Tileset != null && info.Tileset.ToLowerInvariant() != world.Map.Tileset.ToLowerInvariant())
				return;

			var a = info.A / 255f;
			var r = (int)(a * info.R + 0.5f).Clamp(0, 255);
			var g = (int)(a * info.G + 0.5f).Clamp(0, 255);
			var b = (int)(a * info.B + 0.5f).Clamp(0, 255);
			var c = (uint)Color.FromArgb(info.A, r, g, b).ToArgb();
			wr.AddPalette(info.Name, new ImmutablePalette(Enumerable.Range(0, Palette.Size).Select(i => (i == 0) ? 0 : c)), info.AllowModifiers);
		}
开发者ID:Roger-luo,项目名称:OpenRA,代码行数:13,代码来源:PaletteFromRGBA.cs

示例11: LoadPalettes

        public void LoadPalettes(WorldRenderer wr)
        {
            var colors = new uint[Palette.Size];
            using (var s = GlobalFileSystem.Open(info.Filename))
            {
                s.Seek(info.Offset, SeekOrigin.Begin);

                for (var i = 0; i < Palette.Size; i++)
                {
                    var packed = s.ReadUInt16();
                    colors[i] = (uint)((255 << 24) | ((packed & 0xF800) << 8) | ((packed & 0x7E0) << 5) | ((packed & 0x1f) << 3));

                    if (info.InvertColor)
                        colors[i] ^= 0x00FFFFFF;
                }
            }

            wr.AddPalette(info.Name, new ImmutablePalette(colors), info.AllowModifiers);
        }
开发者ID:rhamilton1415,项目名称:OpenRA,代码行数:19,代码来源:PaletteFromR8.cs

示例12: InitPalette

        public void InitPalette(WorldRenderer wr)
        {
            var colors = new uint[256];
            using (var s = FileSystem.Open(info.Filename))
            {
                s.Seek(info.Offset, SeekOrigin.Begin);

                for (var i = 0; i < 256; i++)
                {
                    var packed = s.ReadUInt16();

                    // Fog is rendered with half opacity
                    colors[i] = (uint)((255 << 24) | ((packed & 0xF800) << 7) | ((packed & 0x7E0) << 4) | ((packed & 0x1f) << 2));

                    if (info.InvertColor)
                        colors[i] ^= 0x00FFFFFF;
                }
            }

            wr.AddPalette(info.Name, new Palette(colors), info.AllowModifiers);
        }
开发者ID:Generalcamo,项目名称:OpenRA,代码行数:21,代码来源:FogPaletteFromR8.cs

示例13: LoadPalettes

		public void LoadPalettes(WorldRenderer wr)
		{
			// Rotate vectors to expected orientation
			// Voxel coordinates are x=forward, y=right, z=up
			var channel = new int[] {2,1,0};
			var n = info.Type == NormalType.RedAlert2 ? RA2Normals : TSNormals;

			// Map normals into color range
			// Introduces a maximum error of ~0.5%
			var data = new uint[Palette.Size];
			for (var i = 0; i < n.Length / 3; i++)
			{
				data[i] = 0xFF000000;
				for (var j = 0; j < 3; j++)
				{
					var t = (n[3*i + j] + 1) / 2;
					data[i] |= (uint)((byte)(t*0xFF + 0.5) << (8*channel[j]));
				}
			}

			wr.AddPalette(info.Name, new ImmutablePalette(data));
		}
开发者ID:Berzeger,项目名称:OpenRA,代码行数:22,代码来源:VoxelNormalsPalette.cs

示例14: InitPalette

 public void InitPalette(WorldRenderer wr)
 {
     var filename = world.TileSet.PlayerPalette ?? world.TileSet.Palette;
     wr.AddPalette(info.Name, new Palette(FileSystem.Open(filename), info.ShadowIndex), info.AllowModifiers);
 }
开发者ID:Generalcamo,项目名称:OpenRA,代码行数:5,代码来源:PlayerPaletteFromCurrentTileset.cs

示例15: LoadPalettes

 public void LoadPalettes(WorldRenderer wr)
 {
     var c = info.Fog ? Fog : Shroud;
     wr.AddPalette(info.Name, new ImmutablePalette(Enumerable.Range(0, Palette.Size).Select(i => (uint)c[i % 8].ToArgb())));
 }
开发者ID:RobotCaleb,项目名称:OpenRA,代码行数:5,代码来源:ShroudPalette.cs


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