Add Delivery Manager UI and UI logic
This commit is contained in:
parent
8c5f4f2acf
commit
3ec46256e8
89 changed files with 14001 additions and 12 deletions
39
Assets/Scripts/UI/DeliveryManagerSingleUI.cs
Normal file
39
Assets/Scripts/UI/DeliveryManagerSingleUI.cs
Normal file
|
@ -0,0 +1,39 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class DeliveryManagerSingleUI : MonoBehaviour
|
||||
{
|
||||
|
||||
[SerializeField] private TextMeshProUGUI recipeNameText;
|
||||
[SerializeField] private Transform iconContainer;
|
||||
[SerializeField] private Transform iconTemplate;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
iconTemplate.gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
public void SetRecipeSO(RecipeSO recipeSO)
|
||||
{
|
||||
recipeNameText.text = recipeSO.recipeName;
|
||||
|
||||
foreach (Transform child in iconContainer)
|
||||
{
|
||||
if (child == iconTemplate) continue;
|
||||
Destroy(child.gameObject);
|
||||
}
|
||||
|
||||
foreach (KitchenObjectSO kitchenObjectSO in recipeSO.kitchenObjectSoList)
|
||||
{
|
||||
Transform iconTransform = Instantiate(iconTemplate, iconContainer);
|
||||
|
||||
iconTransform.GetComponent<Image>().sprite = kitchenObjectSO.sprite;
|
||||
|
||||
iconTransform.gameObject.SetActive(true);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Reference in a new issue