53 lines
1.4 KiB
C#
53 lines
1.4 KiB
C#
using TMPro;
|
|
using UnityEngine;
|
|
|
|
public class TopMenuCtrl : MonoBehaviour
|
|
{
|
|
[SerializeField] RectTransform content;
|
|
[SerializeField] RectTransform topButton;
|
|
RectTransform rectTransform;
|
|
|
|
[SerializeField] TMP_Text search;
|
|
[SerializeField] TMP_Text fursuit;
|
|
|
|
bool isUp = false;
|
|
|
|
float pointY;
|
|
float time;
|
|
float speed = 10;
|
|
|
|
private void Awake()
|
|
{
|
|
rectTransform = GetComponent<RectTransform>();
|
|
}
|
|
private void Update()
|
|
{
|
|
if(isUp)
|
|
{
|
|
time += Time.deltaTime * speed;
|
|
if(time < 1.0f)
|
|
content.anchoredPosition = new Vector2(0, pointY - (pointY * time));
|
|
else
|
|
{
|
|
content.anchoredPosition = new Vector2(0, 0);
|
|
isUp = false;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
float sizeY = (content.anchoredPosition.y / (((float)Screen.height) / 100) / 100);
|
|
search.text = sizeY < 0.5f ? "행\n사\n\n검\n색" : "행\n사";
|
|
fursuit.text = sizeY < 0.5f ? "퍼\n슈\n트\n\n등\n록" : "퍼\n슈\n트";
|
|
sizeY = (sizeY < 1.0f ? sizeY : 1.0f);
|
|
rectTransform.sizeDelta = new Vector2(282.5f, 242 - (sizeY * 87));
|
|
topButton.anchoredPosition = new Vector2(-28, -100f + (sizeY * 129f));
|
|
}
|
|
}
|
|
public void TopButton()
|
|
{
|
|
isUp = true;
|
|
pointY = content.anchoredPosition.y;
|
|
time = 0;
|
|
}
|
|
}
|