Newer
Older
DungeonShooting / DungeonShooting_Godot / src / game / ui / editorWindow / CustomButtonCell.cs
@小李xl 小李xl on 5 Aug 2023 602 bytes 完善UiCell类
  1. namespace UI.EditorWindow;
  2.  
  3. public class CustomButtonCell : UiCell<EditorWindow.CustomButton, EditorWindowPanel.ButtonData>
  4. {
  5. public override void OnInit()
  6. {
  7. CellNode.L_Button.Instance.Pressed += Click;
  8. }
  9.  
  10. public override void OnSetData(EditorWindowPanel.ButtonData data)
  11. {
  12. CellNode.L_Button.Instance.Text = data.Text;
  13. }
  14.  
  15. public override void OnDestroy()
  16. {
  17. CellNode.L_Button.Instance.Pressed -= OnClick;
  18. }
  19.  
  20. public override void OnClick()
  21. {
  22. if (Data.Callback != null)
  23. {
  24. Data.Callback();
  25. }
  26. }
  27. }