1using System.Collections;
2using System.Collections.Generic;
3using NaughtyAttributes;
13 [ReadOnly] [SerializeField]
private bool toggled =
false;
14 private float maxWidth = -1f;
20 (
displayText.rectTransform.parent as RectTransform).SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, GetMaxWidth());
25 private float GetMaxWidth()
32 maxWidth = (transform.parent as RectTransform).rect.width;
49 (
displayText.rectTransform.parent as RectTransform).SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, GetMaxWidth());
58 (
displayText.rectTransform.parent as RectTransform).SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, GetTextSize(
displayText).y + 10 + 30);
59 GetComponentInParent<ActionObject>().comment = value;
69 internal void RecalculateSize()
71 (
displayText.rectTransform.parent as RectTransform).SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, GetTextSize(
displayText).y + 10 + 30);
74 internal Vector2 GetTextSize(Text t)
76 TextGenerator textGen =
new TextGenerator();
77 TextGenerationSettings generationSettings = t.GetGenerationSettings(t.rectTransform.rect.size);
78 float width = textGen.GetPreferredWidth(t.text, generationSettings);
79 float height = textGen.GetPreferredHeight(t.text, generationSettings);
80 return new Vector2(width, height);
UnityEngine.UI.Button Button