summaryrefslogtreecommitdiff
path: root/stage/hud_main.gd
diff options
context:
space:
mode:
Diffstat (limited to 'stage/hud_main.gd')
-rw-r--r--stage/hud_main.gd49
1 files changed, 30 insertions, 19 deletions
diff --git a/stage/hud_main.gd b/stage/hud_main.gd
index c736e34..e265e24 100644
--- a/stage/hud_main.gd
+++ b/stage/hud_main.gd
@@ -1,6 +1,9 @@
extends CanvasLayer
+const DICE_SELECTION_SCENE := preload("res://stage/dice_selection/dice_selection.tscn")
+const DICE_THROW_SCENE := preload("res://stage/dice_throw/dice_throw.tscn")
+
@onready var grid_selector: GridSelector = get_tree().get_first_node_in_group("grid_selector")
@@ -27,13 +30,6 @@ func _input(event: InputEvent) -> void:
grid_selector.process_mode = Node.PROCESS_MODE_INHERIT
-func set_current_player() -> void:
- if Network.is_my_turn():
- $PanelContainer3/CurrentTurn.text = "Current Turn: Me"
- else:
- $PanelContainer3/CurrentTurn.text = "Current Turn: " + str(Network.current_player.id)
-
-
func enable():
$PanelContainer2/VBoxContainer/move.text = "Move: " + str(Network.local_player.current_move_points)
$PanelContainer2/VBoxContainer/attack.text = "Atk: " + str(Network.local_player.current_attack_points)
@@ -54,22 +50,37 @@ func enable():
$PanelContainer/VBoxContainer/Button.grab_focus()
+func set_current_player() -> void:
+ if Network.is_my_turn():
+ $PanelContainer3/CurrentTurn.text = "Current Turn: Me"
+ else:
+ $PanelContainer3/CurrentTurn.text = "Current Turn: " + str(Network.current_player.id)
+
+
func _on_button_pressed() -> void:
visible = false
- # TODO: open dice selection screen
- # TODO: => then open throw
-
- var dice_throw_scene = load("res://stage/dice_throw/dice_throw.tscn")
- var dice_throw = dice_throw_scene.instantiate()
- Game.overlay.add_child(dice_throw)
- #dice_throw.position = -dice_throw.size * 0.5
- dice_throw.throw_finished.connect(func():
- dice_throw.queue_free()
- get_tree().current_scene.process_mode = PROCESS_MODE_INHERIT
- grid_selector.process_mode = PROCESS_MODE_INHERIT
- grid_selector.current_state = grid_selector.state_cube_placement
+ var dice_selection := DICE_SELECTION_SCENE.instantiate()
+ Game.overlay.add_child(dice_selection)
+ dice_selection.dice_selected.connect(func(selected_dice: Array[DiceConfiguration]):
+ dice_selection.queue_free()
+
+ if selected_dice.size() > 0:
+ var dice_throw := DICE_THROW_SCENE.instantiate()
+ dice_throw.dice_configurations = selected_dice
+ Game.overlay.add_child(dice_throw)
+ dice_throw.throw_finished.connect(func():
+ dice_throw.queue_free()
+
+ get_tree().current_scene.process_mode = PROCESS_MODE_INHERIT
+ grid_selector.process_mode = PROCESS_MODE_INHERIT
+ grid_selector.current_state = grid_selector.state_cube_placement
+ )
+ else:
+ get_tree().current_scene.process_mode = PROCESS_MODE_INHERIT
+ grid_selector.process_mode = PROCESS_MODE_INHERIT
)
+
get_tree().current_scene.process_mode = PROCESS_MODE_DISABLED