Newer
Older
DungeonShooting / DungeonShooting_Godot / src / game / ui / editorTileImage / ImageBg.cs
@小李xl 小李xl on 24 Jan 2024 857 bytes 代码调整
  1. using Godot;
  2.  
  3. namespace UI.EditorTileImage;
  4.  
  5. public partial class ImageBg : EditorGridBg
  6. {
  7. public new EditorTileImage.Bg UiNode => (EditorTileImage.Bg)base.UiNode;
  8. public override void SetUiNode(IUiNode uiNode)
  9. {
  10. base.SetUiNode(uiNode);
  11. InitNode(UiNode.L_TextureRoot.Instance);
  12. var arr = UiManager.Get_TileSetEditor_Instance();
  13. if (arr.Length > 0)
  14. {
  15. UiNode.Instance.Color = arr[0].BgColor;
  16. }
  17. //聚焦按钮点击
  18. UiNode.L_FocusBtn.Instance.Pressed += DoFocus;
  19. }
  20. /// <summary>
  21. /// 聚焦
  22. /// </summary>
  23. public void DoFocus()
  24. {
  25. var texture = UiNode.L_TextureRoot.L_TileSprite.Instance.Texture;
  26. Utils.DoFocusNode(ContainerRoot, Size, texture != null ? texture.GetSize() : Vector2.Zero);
  27. RefreshGridTrans();
  28. }
  29. }