Newer
Older
DungeonShooting / DungeonShooting_Godot / src / game / ui / mapEditor / TileView / EditorTileMapBar.cs
  1. using Godot;
  2.  
  3. namespace UI.MapEditor;
  4.  
  5. public class EditorTileMapBar
  6. {
  7. private MapEditorPanel _editorPanel;
  8. private MapEditor.TileMap _editorTileMap;
  9. public EditorTileMapBar(MapEditorPanel editorPanel, MapEditor.TileMap editorTileMap)
  10. {
  11. _editorTileMap = editorTileMap;
  12. _editorPanel = editorPanel;
  13. _editorTileMap.Instance.MapEditorPanel = editorPanel;
  14. }
  15.  
  16. public void OnShow()
  17. {
  18. _editorTileMap.L_Brush.Instance.Draw += OnDrawGuides;
  19. _editorPanel.ToolsPanel.S_HandTool.Instance.Pressed += _editorTileMap.Instance.OnSelectHandTool;
  20. _editorPanel.ToolsPanel.S_PenTool.Instance.Pressed += _editorTileMap.Instance.OnSelectPenTool;
  21. _editorPanel.ToolsPanel.S_RectTool.Instance.Pressed += _editorTileMap.Instance.OnSelectRectTool;
  22. _editorPanel.ToolsPanel.S_CenterTool.Instance.Pressed += _editorTileMap.Instance.OnClickCenterTool;
  23. }
  24.  
  25. public void OnHide()
  26. {
  27. _editorTileMap.L_Brush.Instance.Draw -= OnDrawGuides;
  28. _editorPanel.ToolsPanel.S_HandTool.Instance.Pressed -= _editorTileMap.Instance.OnSelectHandTool;
  29. _editorPanel.ToolsPanel.S_PenTool.Instance.Pressed -= _editorTileMap.Instance.OnSelectPenTool;
  30. _editorPanel.ToolsPanel.S_RectTool.Instance.Pressed -= _editorTileMap.Instance.OnSelectRectTool;
  31. _editorPanel.ToolsPanel.S_CenterTool.Instance.Pressed -= _editorTileMap.Instance.OnClickCenterTool;
  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. }