aboutsummaryrefslogtreecommitdiff
path: root/game/src/GameSession/MapView.gd
diff options
context:
space:
mode:
author Hop311 <Hop3114@gmail.com>2023-05-12 02:21:09 +0200
committer GitHub <noreply@github.com>2023-05-12 02:21:09 +0200
commit398ba6f05ae1bb13e59790436bf0da299e5a399d (patch)
tree68cfc1f01f6a13067417e53d1ed8547cffbb969c /game/src/GameSession/MapView.gd
parentc784a95478ec369fe9255622d40ac498b7a23079 (diff)
parent9ed9ee209ef9accebb9ec0d81ec58b569d680b6a (diff)
Merge pull request #111 from OpenVic2Project/goods
Added Goods loading + mapmode
Diffstat (limited to 'game/src/GameSession/MapView.gd')
-rw-r--r--game/src/GameSession/MapView.gd11
1 files changed, 4 insertions, 7 deletions
diff --git a/game/src/GameSession/MapView.gd b/game/src/GameSession/MapView.gd
index c3b5cbb..22a7e6b 100644
--- a/game/src/GameSession/MapView.gd
+++ b/game/src/GameSession/MapView.gd
@@ -1,6 +1,5 @@
extends Node3D
-signal province_selected(index : int)
signal map_view_camera_changed(near_left : Vector2, far_left : Vector2, far_right : Vector2, near_right : Vector2)
const _action_north : StringName = &"map_north"
@@ -83,6 +82,8 @@ func _ready():
map_mesh_aabb.position.z - map_mesh_aabb.end.z
))
+ GameSingleton.province_selected.connect(_on_province_selected)
+
func _notification(what : int):
match what:
NOTIFICATION_WM_MOUSE_ENTER: # Mouse inside window
@@ -112,12 +113,8 @@ func zoom_in() -> void:
func zoom_out() -> void:
_zoom_target += _zoom_target_step
-func _select_province(index : int) -> void:
+func _on_province_selected(index : int) -> void:
_map_shader_material.set_shader_parameter(Events.ShaderManager.param_selected_index, index)
- province_selected.emit(index)
-
-func _deselect_province() -> void:
- _select_province(0)
# REQUIREMENTS
# * SS-31
@@ -125,7 +122,7 @@ func _unhandled_input(event : InputEvent):
if _mouse_over_viewport and event.is_action_pressed(_action_click):
# Check if the mouse is outside of bounds
if _map_mesh.is_valid_uv_coord(_mouse_pos_map):
- _select_province(GameSingleton.get_province_index_from_uv_coords(_mouse_pos_map))
+ GameSingleton.set_selected_province(GameSingleton.get_province_index_from_uv_coords(_mouse_pos_map))
else:
print("Clicked outside the map!")
elif event.is_action_pressed(_action_drag):