public static ColorfulTextMaterial GetInstance(Blending blending, int styleIndex) { lock (instanceCache) { var instanceKey = GetInstanceKey(blending, styleIndex); ColorfulTextMaterial instance; if (!instanceCache.TryGetValue(instanceKey, out instance)) { instance = new ColorfulTextMaterial(blending, styleIndex); instanceCache.Add(instanceKey, instance); } return(instance); } }
public IMaterial GetMaterial(int tag) { var styleGradientMapIndex = gradientMapIndices[tag]; if (material == null || gradientMapIndex != styleGradientMapIndex) { gradientMapIndex = styleGradientMapIndex; if (gradientMapIndex < 0) { material = WidgetMaterial.GetInstance(blending, shader, 1); } else { material = ColorfulTextMaterial.GetInstance(blending, gradientMapIndex); } } return(material); }
public void Init(Blending blending, int gradientMapIndex) { material = ColorfulTextMaterial.GetInstance(blending, gradientMapIndex); }