ExampleListItem.cs 765 B

1234567891011121314151617181920212223242526272829303132
  1. using System;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.UI;
  5. namespace BestHTTP.Examples.Helpers.SelectorUI
  6. {
  7. public sealed class ExampleListItem : MonoBehaviour
  8. {
  9. #pragma warning disable 0649
  10. [SerializeField]
  11. private Text _text;
  12. #pragma warning restore
  13. public SampleSelectorUI ParentUI { get; private set; }
  14. public SampleBase ExamplePrefab { get; private set; }
  15. public void Setup(SampleSelectorUI parentUI, SampleBase prefab)
  16. {
  17. this.ParentUI = parentUI;
  18. this.ExamplePrefab = prefab;
  19. this._text.text = prefab.DisplayName;
  20. }
  21. public void OnButton()
  22. {
  23. this.ParentUI.SelectSample(this);
  24. }
  25. }
  26. }