blob: 27da8bf89b90960c4e45524724b7c826d2bcc49c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
extends Control
func _ready() -> void:
Network.connected.connect(_on_connected)
show_menu(%MultiPlayer)
%HostButton.grab_focus()
func _input(event: InputEvent) -> void:
if event.is_action_pressed("right_click"):
var current_menu: Control
for node in get_children():
if node is Control and node.visible:
current_menu = node
var back_button = current_menu.find_children("*BackButton", "Button")
if back_button.size() > 0:
back_button[0].pressed.emit()
func show_menu(menu_node: Control) -> void:
for node in get_children():
if node is Control:
node.visible = false
menu_node.visible = true
var button = menu_node.find_children("*", "Button")
if button.size() > 0:
button[0].grab_focus()
func _on_connected() -> void:
get_tree().change_scene_to_file("res://stage/stage.tscn")
func _on_single_player_button_pressed() -> void:
show_menu(%SinglePlayer)
func _on_multi_player_button_pressed() -> void:
show_menu(%MultiPlayer)
func _on_deck_manager_button_pressed() -> void:
#get_tree().change_scene_to_file("res://ui/deck_manager/deck_manager.tscn")
get_tree().change_scene_to_file("res://ui/dice_configurator.tscn")
# Dice Manager?
# add dice to decks
# but from a pool of dice
# and configure dice seperately
# can configure dice when adding to deck as well?
func _on_single_player_back_button_pressed() -> void:
show_menu(%Main)
func _on_host_button_pressed() -> void:
Network.host()
get_tree().change_scene_to_file("res://stage/stage.tscn")
func _on_join_button_pressed() -> void:
Network.join()
func _on_multi_player_back_button_pressed() -> void:
show_menu(%Main)
|