GigsPanel.cs 826 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using DataTools;
  5. public class GigsPanel : MonoBehaviour
  6. {
  7. [SerializeField]
  8. private DataUser data;
  9. [SerializeField]
  10. private GigUIData gigUIElement;
  11. [SerializeField]
  12. private Transform content;
  13. private void CleanContent()
  14. {
  15. foreach (Transform child in content.transform)
  16. {
  17. GameObject.Destroy(child.gameObject);
  18. }
  19. }
  20. private void SetupContent()
  21. {
  22. foreach (DataTools.Gig gig in data.UserData.ProgressData.GigsPlayed)
  23. {
  24. GigUIData GgigUINewElement = Instantiate(gigUIElement, content);
  25. GgigUINewElement.SetupGigUI(gig);
  26. }
  27. }
  28. private void OnEnable()
  29. {
  30. CleanContent();
  31. SetupContent();
  32. }
  33. }