Newer
Older
DungeonShooting / DungeonShooting_Godot / src / game / ui / mapEditorSelectObject / ObjectButtonCell.cs
@小李xl 小李xl on 29 Oct 2023 1 KB 更改配置表名
  1. using Config;
  2. using Godot;
  3.  
  4. namespace UI.MapEditorSelectObject;
  5.  
  6. public class ObjectButtonCell : UiCell<MapEditorSelectObject.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_ObjectName.Instance.Text = data.Name;
  16. if (!string.IsNullOrEmpty(data.Icon))
  17. {
  18. CellNode.L_PreviewImage.Instance.Visible = true;
  19. CellNode.L_PreviewImage.Instance.Texture = ResourceManager.LoadTexture2D(data.Icon);
  20. }
  21. else
  22. {
  23. CellNode.L_PreviewImage.Instance.Visible = false;
  24. }
  25. }
  26. public override void OnDoubleClick()
  27. {
  28. //双击选择该对象
  29. CellNode.UiPanel.SelectCell(Data);
  30. }
  31.  
  32. public override void OnSelect()
  33. {
  34. CellNode.L_Select.Instance.Visible = true;
  35. }
  36.  
  37. public override void OnUnSelect()
  38. {
  39. CellNode.L_Select.Instance.Visible = false;
  40. }
  41. }