34 lines
878 B
C#
34 lines
878 B
C#
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);
|
|
}
|
|
}
|
|
}
|
|
}
|