示例#1
0
 public static Texture2D GetToolTexture(eToolIcon toolIcon)
 {
     if(s_iconTexture[(int)toolIcon] == null)
     {
         Texture2D iconTexture = new Texture2D(8, 8);
         iconTexture.hideFlags = HideFlags.DontSave;
         iconTexture.wrapMode = TextureWrapMode.Clamp;
         Color[] colors = new Color[s_icons[(int)toolIcon].Length];
         for (int i = 0; i < colors.Length; ++i )
         {
             colors[ (8 - 1 - (i / 8)) * 8 + i % 8 ] = new Color(1f, 1f, 1f, s_icons[(int)toolIcon][i]);
         }
         iconTexture.SetPixels(colors);
         iconTexture.Apply();
         s_iconTexture[(int)toolIcon] = iconTexture;
     }            
     return s_iconTexture[(int)toolIcon];
 }
示例#2
0
 public static Texture2D GetToolTexture(eToolIcon toolIcon)
 {
     return(GetToolTexture(s_iconTexture, s_icons, (int)toolIcon));
 }
示例#3
0
 public static Texture2D GetToolTexture(eToolIcon toolIcon)
 {
     if(s_iconTexture[(int)toolIcon] == null)
     {
         Texture2D iconTexture = new Texture2D(8, 8);
         iconTexture.hideFlags = HideFlags.DontSave;
         iconTexture.wrapMode = TextureWrapMode.Clamp;
         Color[] colors = new Color[s_icons[(int)toolIcon].Length];
         for (int i = 0; i < colors.Length; ++i )
         {
             colors[ (8 - 1 - (i / 8)) * 8 + i % 8 ] = new Color(1f, 1f, 1f, s_icons[(int)toolIcon][i]);
         }
         iconTexture.SetPixels(colors);
         iconTexture.Apply();
         s_iconTexture[(int)toolIcon] = iconTexture;
     }
     return s_iconTexture[(int)toolIcon];
 }