2026-04-20 카트 잡기
This commit is contained in:
34
Assets/02_Scripts/UI/GameTimerHud.cs
Normal file
34
Assets/02_Scripts/UI/GameTimerHud.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
|
||||
namespace VRShopping.UI
|
||||
{
|
||||
public class GameTimerHud : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private GameTimer _timer;
|
||||
[SerializeField] private TMP_Text _text;
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
if (_timer == null) return;
|
||||
_timer.OnTick += HandleTick;
|
||||
HandleTick(_timer.Remaining);
|
||||
}
|
||||
|
||||
private void OnDisable()
|
||||
{
|
||||
if (_timer == null) return;
|
||||
_timer.OnTick -= HandleTick;
|
||||
}
|
||||
|
||||
private void HandleTick(float remaining)
|
||||
{
|
||||
if (_text == null) return;
|
||||
|
||||
int total = Mathf.CeilToInt(remaining);
|
||||
int minutes = total / 60;
|
||||
int seconds = total % 60;
|
||||
_text.text = $"{minutes:00}:{seconds:00}";
|
||||
}
|
||||
}
|
||||
}
|
||||
2
Assets/02_Scripts/UI/GameTimerHud.cs.meta
Normal file
2
Assets/02_Scripts/UI/GameTimerHud.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7e4f8e4f5f50a734d96dd84839da9183
|
||||
@@ -8,6 +8,10 @@ public class ShoppingOrderView : MonoBehaviour
|
||||
[SerializeField] private ShoppingOrderList _orderList;
|
||||
[SerializeField] private ShoppingOrderRow _rowPrefab;
|
||||
[SerializeField] private Transform _rowContainer;
|
||||
[SerializeField] private Animator _anim;
|
||||
[SerializeField] private GameObject _paper;
|
||||
|
||||
private bool _visibleShoppingOrderList = false;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
@@ -29,5 +33,27 @@ public void Rebuild()
|
||||
row.Bind(entry);
|
||||
}
|
||||
}
|
||||
|
||||
public async Awaitable ToggleShoppingOrderList()
|
||||
{
|
||||
_visibleShoppingOrderList = !_visibleShoppingOrderList;
|
||||
await OnOffShoppingOrderList(_visibleShoppingOrderList);
|
||||
}
|
||||
|
||||
private async Awaitable OnOffShoppingOrderList(bool isOn)
|
||||
{
|
||||
if(isOn)
|
||||
{
|
||||
_paper.SetActive(true);
|
||||
_anim.SetTrigger("OnVisibleShoppingOrderListTrigger");
|
||||
}
|
||||
else
|
||||
{
|
||||
_anim.SetTrigger("OffVisibleShoppingOrderListTrigger");
|
||||
await Util.RunDelayed(1f,()=>{
|
||||
_paper.SetActive(false);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user