diff options
author | Hop311 <Hop3114@gmail.com> | 2023-05-12 02:21:09 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-12 02:21:09 +0200 |
commit | 398ba6f05ae1bb13e59790436bf0da299e5a399d (patch) | |
tree | 68cfc1f01f6a13067417e53d1ed8547cffbb969c /game/src/GameSession/MapControlPanel/MapControlPanel.gd | |
parent | c784a95478ec369fe9255622d40ac498b7a23079 (diff) | |
parent | 9ed9ee209ef9accebb9ec0d81ec58b569d680b6a (diff) |
Merge pull request #111 from OpenVic2Project/goods
Added Goods loading + mapmode
Diffstat (limited to 'game/src/GameSession/MapControlPanel/MapControlPanel.gd')
-rw-r--r-- | game/src/GameSession/MapControlPanel/MapControlPanel.gd | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/game/src/GameSession/MapControlPanel/MapControlPanel.gd b/game/src/GameSession/MapControlPanel/MapControlPanel.gd new file mode 100644 index 0000000..0cef057 --- /dev/null +++ b/game/src/GameSession/MapControlPanel/MapControlPanel.gd @@ -0,0 +1,57 @@ +extends PanelContainer + +signal game_session_menu_button_pressed +signal map_view_camera_changed(near_left : Vector2, far_left : Vector2, far_right : Vector2, near_right : Vector2) +signal minimap_clicked(pos_clicked : Vector2) +signal zoom_in_button_pressed +signal zoom_out_button_pressed + +@export var _mapmodes_grid : GridContainer + +var _mapmode_button_group : ButtonGroup + +# REQUIREMENTS: +# * UI-550, UI-552, UI-554, UI-561 +func _add_mapmode_button(identifier : String) -> void: + var button := Button.new() + button.text = identifier + button.tooltip_text = identifier + button.toggle_mode = true + button.button_group = _mapmode_button_group + button.mouse_filter = MOUSE_FILTER_PASS + _mapmodes_grid.add_child(button) + if _mapmode_button_group.get_pressed_button() == null: + button.button_pressed = true + +func _ready(): + _mapmode_button_group = ButtonGroup.new() + _mapmode_button_group.pressed.connect(_mapmode_pressed) + for index in GameSingleton.get_mapmode_count(): + _add_mapmode_button(GameSingleton.get_mapmode_identifier(index)) + +# REQUIREMENTS: +# * UIFUN-10 +func _on_game_session_menu_button_pressed() -> void: + game_session_menu_button_pressed.emit() + +# REQUIREMENTS: +# * SS-76 +# * UIFUN-129, UIFUN-131, UIFUN-133 +func _mapmode_pressed(button : BaseButton) -> void: + GameSingleton.set_mapmode(button.tooltip_text) + +func _on_map_view_camera_changed(near_left : Vector2, far_left : Vector2, far_right : Vector2, near_right : Vector2) -> void: + map_view_camera_changed.emit(near_left, far_left, far_right, near_right) + +func _on_minimap_clicked(pos_clicked : Vector2) -> void: + minimap_clicked.emit(pos_clicked) + +# REQUIREMENTS: +# * UIFUN-269 +func _on_zoom_in_button_pressed() -> void: + zoom_in_button_pressed.emit() + +# REQUIREMENTS: +# * UIFUN-270 +func _on_zoom_out_button_pressed() -> void: + zoom_out_button_pressed.emit() |