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


C# Color.SetValue方法代码示例

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


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

示例1: Fill

 public void Fill(Color Color)
 {
     Color[] colors = new Color[texture.Width * texture.Height];
     for (int i = 0; i < colors.Length; i++)
     { colors.SetValue(Color, i); }
     texture.SetData<Color>(colors);
 }
开发者ID:Dahrkael,项目名称:CoRe,代码行数:7,代码来源:Sprite.cs

示例2: GetColourArray

    //Get an array of Colours
    public static Color[] GetColourArray( string key )
    {
        Color[] returns = new Color[PlayerPrefs.GetInt("PlayerPrefsArray:Colour:L:"+key)];

           	int i = 0;

        while(i < PlayerPrefs.GetInt("PlayerPrefsArray:Colour:L"+key)){
            returns.SetValue(PlayerPrefsPlus.GetColour("PlayerPrefsArray:Colour:"+key + i.ToString()), i);
            ++i;
        }
        return returns;
    }
开发者ID:kaldrick,项目名称:Roguelike2,代码行数:13,代码来源:PlayerPrefsArray.cs

示例3: objPrefabToAndroid


//.........这里部分代码省略.........
            }
        }

        newPrefab = PrefabUtility.CreatePrefab(newPrePath, test);
        GameObject.DestroyImmediate(test);

        foreach (Texture2D t in texs.Values)
        {
            //Debug.Log("texture:" + t.name);
			
			string cTexPath = androidTexFolder + t.name + "_c.png";
            string aTexPath = androidTexFolder + t.name + "_a.png";
			
			if(!File.Exists(cTexPath) && !File.Exists(aTexPath))
			{
				string texturePath = AssetDatabase.GetAssetPath(t);
	            TextureImporter textureImporter = (TextureImporter)AssetImporter.GetAtPath(texturePath);
	
	            textureImporter.textureType = TextureImporterType.Advanced;
	            textureImporter.isReadable = true;
	            textureImporter.mipmapEnabled = false;
	            AssetDatabase.ImportAsset(texturePath, ImportAssetOptions.ForceUpdate);
	
	            //Debug.Log("propertives updated");
	
	            Color32[] cols = t.GetPixels32();
	            Color[] cCols = new Color[cols.Length];
	            Color[] aCols = new Color[cols.Length];
	            int id = -1;
	            foreach (Color32 c in cols)
	            {
	                id++;
	
	                cCols.SetValue(new Color((float)c.r / 255, (float)c.g / 255, (float)c.b / 255), id);
	                aCols.SetValue(new Color((float)c.a / 255, (float)c.a / 255, (float)c.a / 255), id);
	            }
	
	            Texture2D colorTexture = new Texture2D(t.width, t.height);
	            colorTexture.SetPixels(cCols);
	            colorTexture.Apply();
	
	            Texture2D maskTexture = new Texture2D(t.width, t.height);
	            maskTexture.SetPixels(aCols);
	            maskTexture.Apply();
	
	            // Debug.Log("pixels done");
	
	            byte[] byt = colorTexture.EncodeToPNG();
	            File.WriteAllBytes(cTexPath, byt);
	
	            byt = maskTexture.EncodeToPNG();
	            File.WriteAllBytes(aTexPath, byt);
	
	            textureImporter.isReadable = false;
	            //Debug.Log("-----------------------texture saved");
	            cTexPath = cTexPath.Replace(Application.dataPath, "Assets");
	            aTexPath = aTexPath.Replace(Application.dataPath, "Assets");
	
	            AssetDatabase.ImportAsset(cTexPath);
	            AssetDatabase.ImportAsset(aTexPath);
			}
            
        }

        foreach (Material mat in mats.Values)
        {
开发者ID:FlameskyDexive,项目名称:hugula,代码行数:67,代码来源:AndroidTextureConvertor.cs

示例4: Generate

        public void Generate()
        {
            // Highly experimental
            // Componer paleta
            Color[] tpalette = new Color[paleta_extra.Length];//[256];
            int i = 0;
            for (int x = 0; x < width; x++)
            {
                for (int y = 0; y < height; y++)
                {
                    Color color = bitmap.GetPixel(x, y);
                    if (!tpalette.Contains(color))
                    {
                        tpalette.SetValue(color, i);
                        i++;
                    }
                }
            }
            // Pasar la paleta a 555Color
            palette = new _555Color[tpalette.Length];
            for (int j = 0; j < tpalette.Length; j++)
            {
                //palette.SetValue(new _555Color(tpalette[j]), j);
                palette.SetValue(paleta_extra[j], j);
            }

            // Generar los tiles numericos
            int total = width * height;
            total_tiles = (ushort)(total / 64);
            int current = 0;
            int extra_x = 0;
            int extra_y = 0;
            // array con todos los bytes de los tiles
            tiles = new byte[width * height];
            while (current < total)
            {
                for (int y = 0; y < 8; y++)
                {
                    for (int x = 0; x < 8; x++)
                    {
                        Color color = bitmap.GetPixel(x + extra_x, y + extra_y);
                        _555Color color2 = new _555Color(color);
                        for (int j = 0; j < palette.Length; j++)
                        {
                            if (palette[j].Int16 == color2.Int16)
                            {
                                // Guardar la posicion del color
                                tiles.SetValue((byte)j, current);
                                break;
                            }
                            else { tiles.SetValue((byte)0, current); }
                        }
                        current++;
                    }
                }
                extra_x += 8;
                if (extra_x >= width)
                {
                    extra_x = 0;
                    extra_y += 8;
                }
            }
        }
开发者ID:Dahrkael,项目名称:RMDSCM,代码行数:63,代码来源:CHBGWriter.cs


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