mirror of
https://github.com/RHeavenStudioPlus/HeavenStudioPlus.git
synced 2024-11-29 21:13:07 +00:00
fc07f80b4f
* Textboxes: setup prefab * Textboxes: basic functionality finished * Textbox: scaling * Textbox: open captions * Textbox: res edits * Textbox: song artist * Textbox: closed captions * Textbox: fix not being able to use multiple text events * I/O: save / load remixes using UTF-8 encoding * Textboxes: stop editor shortcuts while typing
36 lines
No EOL
974 B
C#
36 lines
No EOL
974 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using TMPro;
|
|
|
|
namespace HeavenStudio.TextboxUtilities
|
|
{
|
|
public class TextboxObject : MonoBehaviour
|
|
{
|
|
[Header("Objects")]
|
|
public TMP_Text TextboxLabel;
|
|
public RectTransform TextboxLabelRect;
|
|
public SpriteRenderer UL;
|
|
public SpriteRenderer UR;
|
|
public SpriteRenderer DL;
|
|
public SpriteRenderer DR;
|
|
|
|
static Vector2 textboxSize = new Vector2(3f, 0.75f);
|
|
|
|
public void Resize(float scaleX, float scaleY)
|
|
{
|
|
Vector2 tScale = Vector2.Scale(textboxSize, new Vector2(scaleX, scaleY));
|
|
|
|
UL.size = tScale;
|
|
UR.size = tScale;
|
|
DL.size = tScale;
|
|
DR.size = tScale;
|
|
TextboxLabelRect.sizeDelta = new Vector2(11.2f * scaleX, 2.2f * scaleY);
|
|
}
|
|
|
|
public void SetText(string text)
|
|
{
|
|
TextboxLabel.text = text;
|
|
}
|
|
}
|
|
} |