2026-04-17 장보기 목록 버튼 할당 진행중
This commit is contained in:
33
Assets/02_Scripts/UI/ShoppingOrderView.cs
Normal file
33
Assets/02_Scripts/UI/ShoppingOrderView.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
using UnityEngine;
|
||||
using VRShopping.Shopping;
|
||||
|
||||
namespace VRShopping.UI
|
||||
{
|
||||
public class ShoppingOrderView : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private ShoppingOrderList _orderList;
|
||||
[SerializeField] private ShoppingOrderRow _rowPrefab;
|
||||
[SerializeField] private Transform _rowContainer;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
Rebuild();
|
||||
}
|
||||
|
||||
public void Rebuild()
|
||||
{
|
||||
if (_orderList == null || _rowPrefab == null || _rowContainer == null) return;
|
||||
|
||||
for (int i = _rowContainer.childCount - 1; i >= 0; i--)
|
||||
{
|
||||
Destroy(_rowContainer.GetChild(i).gameObject);
|
||||
}
|
||||
|
||||
foreach (var entry in _orderList.Entries)
|
||||
{
|
||||
var row = Instantiate(_rowPrefab, _rowContainer);
|
||||
row.Bind(entry);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user