PoetryItem.cs 876 B

123456789101112131415161718192021222324252627282930313233343536
  1. using Excel2Json;
  2. using UnityEngine;
  3. using UnityEngine.UI;
  4. namespace Mono
  5. {
  6. [UIBinding(prefab = "PoetryItem")]
  7. public class PoetryItem : UICom
  8. {
  9. public Button Btn_PoetryItem;
  10. public Text Text_PoetryName;
  11. public RectTransform PoetryItemRoot;
  12. public override void GetUIData()
  13. {
  14. Btn_PoetryItem = UIData.Get<Button>("Btn_PoetryItem");
  15. Text_PoetryName = UIData.Get<Text>("Text_PoetryName");
  16. }
  17. public override void AddButtonEvent()
  18. {
  19. Btn_PoetryItem.onClick.AddListener(() => { Debug.Log("点击了古诗" + Text_PoetryName); });
  20. }
  21. public PoetConfig PoetConfig;
  22. public void CustomInit(PoetConfig poetConfig)
  23. {
  24. PoetConfig = poetConfig;
  25. Text_PoetryName.text = "《"+PoetConfig.name+"》";
  26. }
  27. }
  28. }