public void DrawText(string text, TextStyleSetting style, Color color, bool override_color = true) { if (skin.drawWidgets) { BeginSample("DrawText"); Pool <LocText> .Entry entry = textWidgets.Draw(currentPos); LocText widget = entry.widget; Color color2 = Color.white; if ((UnityEngine.Object)widget.textStyleSetting != (UnityEngine.Object)style) { widget.textStyleSetting = style; widget.ApplySettings(); } if ((UnityEngine.Object)style != (UnityEngine.Object)null) { color2 = style.textColor; } if (override_color) { color2 = color; } widget.color = color2; if (widget.text != text) { widget.text = text; widget.KForceUpdateDirty(); } currentPos.x += widget.renderedWidth; maxShadowX = Mathf.Max(currentPos.x, maxShadowX); minLineHeight = (int)Mathf.Max((float)minLineHeight, widget.renderedHeight); EndSample(); } }
public void ConfigureLabel(LocText label, Dictionary <CodexTextStyle, TextStyleSetting> textStyles) { label.gameObject.SetActive(true); label.AllowLinks = (style == CodexTextStyle.Body); label.textStyleSetting = textStyles[style]; label.text = text; label.ApplySettings(); }
private void SetState(State state, HoverState hover_state) { if (state == State.Normal) { switch (hover_state) { case HoverState.Normal: target.textStyleSetting = normalNormal; break; case HoverState.Hovered: target.textStyleSetting = normalHovered; break; } } target.ApplySettings(); }