public static CCGradient GetDefaultGradient() { CCGradientColorKey[] colorKeys = new CCGradientColorKey[] { new CCGradientColorKey(Color.white, 0f), new CCGradientColorKey(Color.white, 1f) }; CCGradientAlphaKey[] alphaKeys = new CCGradientAlphaKey[] { new CCGradientAlphaKey(1f, 0f), new CCGradientAlphaKey(1f, 1f) }; return(new CCGradient(colorKeys, alphaKeys)); }
protected void CreateDefaultGradient() { CCGradientColorKey[] colorKeys = new CCGradientColorKey[] { new CCGradientColorKey(Color.white, 0f), new CCGradientColorKey(Color.white, 1f) }; CCGradientAlphaKey[] alphaKeys = new CCGradientAlphaKey[] { new CCGradientAlphaKey(1f, 0f), new CCGradientAlphaKey(1f, 1f) }; #if UNITY_EDITOR if (UnityEditor.EditorApplication.isPlayingOrWillChangePlaymode) { AddGradient(new CCGradient(colorKeys, alphaKeys)); } else { CreateAtlasTexture(0, gradientWidth, gradientHeight); AddGradient(new CCGradient(colorKeys, alphaKeys)); } #else AddGradient(new CCGradient(colorKeys, alphaKeys)); #endif }