Files
pgs/Assets/Scripts/UI/ShopMenuController.cs

41 lines
1.0 KiB
C#
Raw Permalink Normal View History

2026-02-21 16:58:22 -08:00
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ShopMenuController : MonoBehaviour {
[SerializeField] public GameObject menuItemObject;
private List<GameObject> menuItems;
public void SetupBuyMenu(Npc npc) {
foreach (Transform child in transform) {
Destroy(child.gameObject);
}
menuItems = new List<GameObject>();
foreach (Item item in npc.shop.items.Keys) {
GameObject menuItem = Instantiate(menuItemObject);
menuItem.GetComponent<ShopMenuItemController>().Setup(item, (int)(npc.shop.items[item]));
menuItem.transform.SetParent(this.transform);
menuItem.transform.localScale = Vector3.one;
menuItems.Add(menuItem);
}
}
public void SetupSellMenu() {
// TODO: Implement
}
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
}