Files
UmaViewer/Assets/Scripts/LiveToolBox/LiveViewerUI.cs
T
2023-07-23 17:48:49 +08:00

49 lines
1.1 KiB
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UIElements;
using UnityEngine.UI;
public class LiveViewerUI : MonoBehaviour
{
public static LiveViewerUI Instance;
public UnityEngine.UI.Slider ProgressBar;
public RectTransform BottonUITransform;
float targetHeight = 0;
float height;
private void Awake()
{
height = BottonUITransform.rect.height;
targetHeight = 0;
Invoke(nameof(HideSlider), 1.5f);
Instance = this;
//TrueProgressBar = (UnityEngine.UIElements.Slider)ProgressBar;
}
public void OnMouse(bool isEnter)
{
if (isEnter)
{
targetHeight = 0;
CancelInvoke();
}
else
{
Invoke(nameof(HideSlider), 2.5f);
}
}
private void FixedUpdate()
{
BottonUITransform.anchoredPosition = Vector2.Lerp(BottonUITransform.anchoredPosition, new Vector2(0, targetHeight), Time.fixedDeltaTime * 5);
}
private void HideSlider()
{
targetHeight = -height;
}
}