本文整理汇总了C#中Texture2D.SetPixels32方法的典型用法代码示例。如果您正苦于以下问题:C# Texture2D.SetPixels32方法的具体用法?C# Texture2D.SetPixels32怎么用?C# Texture2D.SetPixels32使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Texture2D
的用法示例。
在下文中一共展示了Texture2D.SetPixels32方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: drawRight
public override void drawRight(TextureEditGUI gui)
{
if (BitmapDecalCache.Instance.monoSheets.Count == 0) return;
Color contentColor = GUI.contentColor;
GUI.backgroundColor = Global.BackgroundColor;
_scrollPos = GUILayout.BeginScrollView(_scrollPos, GUI.skin.box, GUILayout.MinWidth(250), GUILayout.ExpandHeight(true));
GUILayout.Label("Decal Sheets");
GUILayout.Space(3);
int oldSelectedSheet = _selectedSheet;
for (int i = 0; i < BitmapDecalCache.Instance.monoSheets.Count; ++i)
{
if (i == _selectedSheet) GUI.contentColor = Global.SelectedColor;
else GUI.contentColor = Global.NotSelectedColor;
if (GUILayout.Button(BitmapDecalCache.Instance.monoSheets[i].displayName, GUILayout.ExpandWidth(true))) _selectedSheet = i;
}
if (_selectedSheet != oldSelectedSheet)
{
if (_textures != null)
{
for (int i = 0; i < _textures.Count; ++i)
{
UnityEngine.Object.Destroy(_textures[i]);
}
_textures = null;
}
if (_selectedDecal >= BitmapDecalCache.Instance.monoSheets[_selectedSheet].decals.Count) _selectedDecal = 0;
}
GUILayout.Space(10);
GUILayout.Label("Decals");
GUILayout.Space(3);
if (_textures == null)
{
_textures = new List<Texture2D>();
for (int i = 0; i < BitmapDecalCache.Instance.monoSheets[_selectedSheet].decals.Count; ++i)
{
Image image = new Image(BitmapDecalCache.Instance.monoSheets[_selectedSheet].decals[i].image);
image.recolor(Global.Black32, Global.White32, false, false);
Texture2D texture = new Texture2D(image.width, image.height, TextureFormat.ARGB32, false);
texture.SetPixels32(image.pixels);
texture.Apply();
_textures.Add(texture);
}
}
int oldSelectedDecal = _selectedDecal;
int x = 0;
GUILayout.BeginHorizontal();
for (int i = 0; i < _textures.Count; ++i)
{
if (i == _selectedDecal)
{
GUI.backgroundColor = Color.yellow;
if (GUILayout.Button(_textures[i], GUILayout.Width(_textures[i].width + 4), GUILayout.Height(_textures[i].height + 4))) _selectedDecal = i;
GUI.backgroundColor = Global.BackgroundColor;
}
else
{
if (GUILayout.Button(_textures[i], GUILayout.Width(_textures[i].width + 4), GUILayout.Height(_textures[i].height + 4))) _selectedDecal = i;
}
x += _textures[i].width + 5;
if (i < (_textures.Count - 1))
{
if (x > 0 && (x + _textures[i+1].width) > 200)
{
GUILayout.EndHorizontal();
GUILayout.BeginHorizontal();
x = 0;
}
}
}
GUILayout.EndHorizontal();
GUILayout.EndScrollView();
GUI.contentColor = contentColor;
if (oldSelectedSheet != _selectedSheet || oldSelectedDecal != _selectedDecal)
{
_imBitmapMonoDecal._url = BitmapDecalCache.Instance.monoSheets[_selectedSheet].decals[_selectedDecal].url;
gui.setRemakePreview();
}
}