Newer
Older
DungeonShooting / DungeonShooting_Godot / src / game / ui / tileSetEditorCombination / TileSetEditorCombinationPanel.cs
  1. using Godot;
  2. using UI.TileSetEditor;
  3.  
  4. namespace UI.TileSetEditorCombination;
  5.  
  6. public partial class TileSetEditorCombinationPanel : TileSetEditorCombination
  7. {
  8. /// <summary>
  9. /// 父Ui
  10. /// </summary>
  11. public TileSetEditorPanel EditorPanel;
  12. public override void OnCreateUi()
  13. {
  14. EditorPanel = (TileSetEditorPanel)ParentUi;
  15. //改变纹理事件
  16. AddEventListener(EventEnum.OnSetTileTexture, OnSetTileTexture);
  17. //改变背景颜色事件
  18. AddEventListener(EventEnum.OnSetTileSetBgColor, OnSetTileSetBgColor);
  19. }
  20.  
  21. public override void OnShowUi()
  22. {
  23. if (EditorPanel.Texture == null)
  24. {
  25. EditorWindowManager.ShowTips("警告", "请先导入纹理!", () =>
  26. {
  27. EditorPanel.TabGrid.SelectIndex = 0;
  28. });
  29. }
  30.  
  31. S_LeftTopBg.Instance.OnShow();
  32. S_LeftBottomBg.Instance.OnShow();
  33. }
  34.  
  35. public override void OnDestroyUi()
  36. {
  37. }
  38.  
  39. //改变TileSet纹理
  40. private void OnSetTileTexture(object arg)
  41. {
  42. S_LeftBottomBg.Instance.OnChangeTileSetTexture();
  43. S_RightBg.Instance.OnChangeTileSetTexture();
  44. }
  45. //改变TileSet背景颜色
  46. private void OnSetTileSetBgColor(object arg)
  47. {
  48. //背景颜色
  49. if (arg is Color color)
  50. {
  51. S_LeftTopBg.Instance.Color = color;
  52. S_LeftBottomBg.Instance.Color = color;
  53. }
  54. }
  55. }