Newer
Older
DungeonShooting / DungeonShooting_Godot / src / game / ui / mapEditor / TileView / EditorTileMapBar.cs
@小李xl 小李xl on 6 Aug 2023 1 KB 更新Ui生成器
  1. using Godot;
  2.  
  3. namespace UI.MapEditor;
  4.  
  5. public class EditorTileMapBar
  6. {
  7. private MapEditor.TileMap _editorTileMap;
  8. private EventFactory _eventFactory;
  9. public EditorTileMapBar(MapEditorPanel editorPanel, MapEditor.TileMap editorTileMap)
  10. {
  11. _editorTileMap = editorTileMap;
  12. _editorTileMap.Instance.MapEditorPanel = editorPanel;
  13. _editorTileMap.Instance.MapEditorToolsPanel = editorPanel.S_MapEditorTools.Instance;
  14. _editorTileMap.Instance.MapEditorToolsPanel.EditorMap = _editorTileMap;
  15.  
  16. _editorTileMap.L_Brush.Instance.Draw += OnDrawGuides;
  17. _eventFactory = EventManager.CreateEventFactory();
  18. _eventFactory.AddEventListener(EventEnum.OnSelectDragTool, _editorTileMap.Instance.OnSelectHandTool);
  19. _eventFactory.AddEventListener(EventEnum.OnSelectPenTool, _editorTileMap.Instance.OnSelectPenTool);
  20. _eventFactory.AddEventListener(EventEnum.OnSelectRectTool, _editorTileMap.Instance.OnSelectRectTool);
  21. _eventFactory.AddEventListener(EventEnum.OnSelectDoorTool, _editorTileMap.Instance.OnSelectDoorTool);
  22. _eventFactory.AddEventListener(EventEnum.OnClickCenterTool, _editorTileMap.Instance.OnClickCenterTool);
  23. }
  24.  
  25. public void OnShow()
  26. {
  27.  
  28. }
  29.  
  30. public void OnHide()
  31. {
  32. }
  33.  
  34. public void Process(float delta)
  35. {
  36. _editorTileMap.L_Brush.Instance.QueueRedraw();
  37. }
  38.  
  39. private void OnDrawGuides()
  40. {
  41. _editorTileMap.Instance.DrawGuides(_editorTileMap.L_Brush.Instance);
  42. }
  43.  
  44. public void OnDestroy()
  45. {
  46. _editorTileMap.L_Brush.Instance.Draw -= OnDrawGuides;
  47. _eventFactory.RemoveAllEventListener();
  48. }
  49. }