41 lines
1.0 KiB
C#
41 lines
1.0 KiB
C#
|
|
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()
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|