Newer
Older
DungeonShooting / DungeonShooting_Godot / src / game / ui / encyclopedia / ItemCell.cs
@小李xl 小李xl on 13 Mar 2024 992 bytes 图鉴基本功能制作完成
  1. using System.Collections;
  2. using Config;
  3.  
  4. namespace UI.Encyclopedia;
  5.  
  6. public class ItemCell : UiCell<Encyclopedia.ObjectButton, ExcelConfig.ActivityBase>
  7. {
  8. public override void OnInit()
  9. {
  10. CellNode.L_Select.Instance.Visible = false;
  11. }
  12.  
  13. public override void OnSetData(ExcelConfig.ActivityBase data)
  14. {
  15. CellNode.L_PreviewImage.Instance.Texture = ResourceManager.LoadTexture2D(data.Icon);
  16. }
  17.  
  18. public override IEnumerator OnSetDataCoroutine(ExcelConfig.ActivityBase data)
  19. {
  20. CellNode.L_PreviewImage.Instance.Texture = ResourceManager.LoadTexture2D(data.Icon);
  21. yield break;
  22. }
  23.  
  24. public override void OnDisable()
  25. {
  26. CellNode.L_PreviewImage.Instance.Texture = null;
  27. }
  28.  
  29. public override void OnSelect()
  30. {
  31. CellNode.L_Select.Instance.Visible = true;
  32. CellNode.UiPanel.SelectItem(Data);
  33. }
  34. public override void OnUnSelect()
  35. {
  36. CellNode.L_Select.Instance.Visible = false;
  37. }
  38. }