NGUI UITexture Resource加载图片代码
public class BrawlerPlayerBarTemp : MonoBehavior{
// Define all Canvases and GUIX controls here
Texture2D playerHealthMaskTexture;
Color[] playerHealthColors;
Texture2D playerHealthTexture;
public BrawlerPlayerBarTemp()
{
// Set up the texture that will be used for the power bar (need to custom mask it).
playerHealthMaskTexture = (Texture2D)Resources.Load("UI/Brawler/PlayerBarHealthMask");
playerHealthTexture = new Texture2D(playerHealthMaskTexture.width, playerHealthMaskTexture.height, TextureFormat.ARGB32, true);
int width = playerHealthMaskTexture.width;
int height = playerHealthMaskTexture.height;
for (int i = 0; i < width; i++)
{
for (int j = 0; j < height; j++)
{
int bitIdx = i + j * width;
if ((playerHealthColors).a > 0)
{
playerHealthColors = new Color(1f, 0f, 0f, 1f);
}
else
{
playerHealthColors = new Color(0f, 0f, 0f, 0f);
}
}
}
}
public void OnGUI {
playerHealthTexture.SetPixels(playerHealthColors);
playerHealthTexture.Apply();
GUI.DrawTexture(new Rect(0, 0, 300, 120), playerHealthTexture);
} 怎么看全部的代码啊?? 好帖就是要顶 顶顶多好 说的非常好 很好哦 LZ真是人才 很不错 顶顶多好 说的非常好
页:
[1]