Beispiel #1
0
 public void ShowText(string text, TextAreaSize size)
 {
     this.text.resizeTextForBestFit = (size == TextAreaSize.Big);
     textOutput.SetActive(false);
     this.text.text = null;
     Resize(size);
     this.text.text = text;
     textOutput.SetActive(true);
 }
Beispiel #2
0
    private void Resize(TextAreaSize size)
    {
        float coef   = (size == TextAreaSize.Big) ? 1.5f : 2.0f;
        float width  = Screen.width / coef;
        float height = Screen.height / coef;

        background.gameObject.GetComponent <RectTransform>().sizeDelta = new Vector2(width + 40, height + 40);

        RectTransform textRect = text.gameObject.GetComponent <RectTransform>();

        textRect.sizeDelta     = new Vector2(width, height - 50);
        textRect.localPosition = new Vector3(0, 20, 0);

        RectTransform tipRect = tip.gameObject.GetComponent <RectTransform>();

        tipRect.sizeDelta     = new Vector2(width, 50);
        tipRect.localPosition = new Vector3(0, -height / 2 + 10, 0);
    }