Newer
Older
DungeonShooting / DungeonShooting_Godot / src / game / ui / roomUI / LifeCell.cs
@小李xl 小李xl on 23 Jul 2023 1 KB 完成搜索房间
  1. using Godot;
  2.  
  3. namespace UI.RoomUI;
  4.  
  5. public class LifeCell : UiCell<RoomUI.RoomUI_Life, LifeIconEnum>
  6. {
  7. private int _type = -1;
  8.  
  9. public override void OnSetData(LifeIconEnum data)
  10. {
  11. if (_type == (int)data)
  12. {
  13. return;
  14. }
  15.  
  16. _type = (int)data;
  17. switch (data)
  18. {
  19. case LifeIconEnum.FullHeart:
  20. CellNode.Instance.Texture = ResourceManager.Load<Texture2D>(ResourcePath.resource_sprite_ui_roomUI_Life_full_png);
  21. break;
  22. case LifeIconEnum.HalfHeart:
  23. CellNode.Instance.Texture = ResourceManager.Load<Texture2D>(ResourcePath.resource_sprite_ui_roomUI_Life_half_png);
  24. break;
  25. case LifeIconEnum.EmptyHeart:
  26. CellNode.Instance.Texture = ResourceManager.Load<Texture2D>(ResourcePath.resource_sprite_ui_roomUI_Life_empty_png);
  27. break;
  28. case LifeIconEnum.FullShield:
  29. CellNode.Instance.Texture = ResourceManager.Load<Texture2D>(ResourcePath.resource_sprite_ui_roomUI_Shield_full_png);
  30. break;
  31. case LifeIconEnum.EmptyShield:
  32. CellNode.Instance.Texture = ResourceManager.Load<Texture2D>(ResourcePath.resource_sprite_ui_roomUI_Shield_empty_png);
  33. break;
  34. }
  35. }
  36. }