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.  
  32. public override void OnDestroyUi()
  33. {
  34. }
  35.  
  36. //改变TileSet纹理
  37. private void OnSetTileTexture(object arg)
  38. {
  39. S_LeftBottomBg.Instance.OnChangeTileSetTexture();
  40. S_RightBg.Instance.OnChangeTileSetTexture();
  41. }
  42. //改变TileSet背景颜色
  43. private void OnSetTileSetBgColor(object arg)
  44. {
  45. //背景颜色
  46. if (arg is Color color)
  47. {
  48. S_LeftTopBg.Instance.Color = color;
  49. S_LeftBottomBg.Instance.Color = color;
  50. }
  51. }
  52. }