59 lines
1.5 KiB
C#
59 lines
1.5 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;
|
||
|
||
//50
|
||
//-100
|
||
|
||
private void Awake()
|
||
{
|
||
rectTransform = GetComponent<RectTransform>();
|
||
}
|
||
private void Update()
|
||
{
|
||
if(isUp)
|
||
{
|
||
time += Time.deltaTime * speed;
|
||
Debug.Log(time);
|
||
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 ? "<22><>\n<><6E>\n\n<><6E>\n<><6E>" : "<22><>\n<><6E>";
|
||
fursuit.text = sizeY < 0.5f ? "<22><>\n<><6E>\nƮ\n\n<><6E>\n<><6E>" : "<22><>\n<><6E>\nƮ";
|
||
sizeY = (sizeY < 1.0f ? sizeY : 1.0f);
|
||
rectTransform.sizeDelta = new Vector2(282.5f, 242 - (sizeY * 87));
|
||
topButton.anchoredPosition = new Vector2(-50, -100f + (sizeY * 150f));
|
||
}
|
||
}
|
||
public void TopButton()
|
||
{
|
||
isUp = true;
|
||
pointY = content.anchoredPosition.y;
|
||
time = 0;
|
||
}
|
||
}
|