// Revert a designated style setting to the base style value: private static void endStyleString(StyleType type, ref UtmlElementStyle style, UtmlElementStyle baseStyle) { switch (type) { case StyleType.LabelColor: style.labelColor = baseStyle.labelColor; break; case StyleType.LabelSize: style.labelFontSize = baseStyle.labelFontSize; break; case StyleType.TextColor: style.textColor = baseStyle.textColor; break; case StyleType.TextSize: style.textFontSize = baseStyle.textFontSize; break; case StyleType.BgColor: style.backgroundColor = baseStyle.backgroundColor; break; case StyleType.BgImage: style.backgroundOverride = baseStyle.backgroundOverride; break; case StyleType.ImgColor: style.imageColor = baseStyle.imageColor; break; case StyleType.ImgImage: style.imageOverride = baseStyle.imageOverride; break; case StyleType.ImgStyle: style.imageStyle = baseStyle.imageStyle; break; case StyleType.ImgFillAmount: style.imageFillAmount = baseStyle.imageFillAmount; break; case StyleType.ImgFill: style.imageFill = baseStyle.imageFill; break; default: break; } }
public override void setStyle(UtmlElementStyle style) { // Update style for base UI members: base.setStyle(style); // Set text and placeholder color and font size according to the style: if (uiInput != null) { if (uiInput.placeholder != null) { Text uiPHTxt = uiInput.placeholder.GetComponent <Text>(); uiPHTxt.color = style.textColor; uiPHTxt.fontSize = style.textFontSize; } uiInput.textComponent.color = style.textColor; uiInput.textComponent.fontSize = style.textFontSize; } }
public virtual void setStyle(UtmlElementStyle style) { if (uiLabel != null) { uiLabel.color = style.labelColor; uiLabel.fontSize = style.labelFontSize; // Automatically resize the UI element based on label content for multi-line text: if (uiLabel.text.Contains("\n")) { setElementSize(RectTransform.Axis.Vertical, uiLabel.preferredHeight); } } if (uiBackground != null) { uiBackground.color = style.imageColor; } }
public override void setStyle(UtmlElementStyle style) { // Update style for base UI members: base.setStyle(style); // Set image contents, display style and coloring: if (uiImage != null) { uiImage.color = style.imageColor; uiImage.overrideSprite = style.imageOverride; uiImage.type = style.imageStyle; if (style.imageStyle == Image.Type.Filled) { uiImage.fillMethod = style.imageFill; uiImage.fillAmount = style.imageFillAmount; } } // TODO: Adjust element size to match image size and aspect ratio. }
// Read and parse style parameters, then apply values to current style: private static void applyStyleString(string txt, ref int index, StyleType type, ref UtmlElementStyle style) { // TODO: Read and parse style parameters, then apply values to current style. }