FairyGUI.NGraphics.Tint C# (CSharp) Method

Tint() public method

public Tint ( Color value ) : void
value UnityEngine.Color
return void
        public void Tint(Color value)
        {
            if (this.colors == null || vertCount == 0)
                return;

            Color32 value32 = value;
            int count = this.colors.Length;
            for (int i = 0; i < count; i++)
            {
                Color32 col = value32;
                if (col.a != 255)
                {
                    if (_alphaBackup == null)
                        _alphaBackup = new byte[vertCount];
                }
                col.a = (byte)(_alpha * 255);
                this.colors[i] = col;
            }

            if (_alphaBackup != null)
            {
                if (_alphaBackup.Length < vertCount)
                    _alphaBackup = new byte[vertCount];

                for (int i = 0; i < vertCount; i++)
                    _alphaBackup[i] = this.colors[i].a;
            }

            mesh.colors32 = this.colors;
        }

Usage Example

 static public int Tint(IntPtr l)
 {
     try {
         FairyGUI.NGraphics self = (FairyGUI.NGraphics)checkSelf(l);
         UnityEngine.Color  a1;
         checkType(l, 2, out a1);
         self.Tint(a1);
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }