Refactoring UI and Tile logic (to allow for Hotseat/LAN/Online multiplayer)

This commit is contained in:
Sch1nken 2024-03-19 23:16:29 +01:00
parent 1ed0ec226d
commit d688eaf9c6
17 changed files with 591 additions and 17 deletions

View file

@ -282,4 +282,6 @@ horizontal_alignment = 1
layout_mode = 2 layout_mode = 2
text = "Back to menu" text = "Back to menu"
[node name="PauseMenu" type="CanvasLayer" parent="."]
[connection signal="pressed" from="GameOverMenu/Control/PanelContainer/VBoxContainer/Button" to="GameOverMenu" method="_on_button_pressed"] [connection signal="pressed" from="GameOverMenu/Control/PanelContainer/VBoxContainer/Button" to="GameOverMenu" method="_on_button_pressed"]

View file

@ -2,16 +2,21 @@ extends Node
const WEBSOCKET_ENDPOINT: String = "wss://dev.bytesandpieces.xyz:9088" const WEBSOCKET_ENDPOINT: String = "wss://dev.bytesandpieces.xyz:9088"
var is_player_black: bool = true var is_hot_seat: bool = false
var is_player_black: bool = false
var debug: bool = false var debug: bool = false
var allow_selecting_in_stack: bool = false var allow_selecting_in_stack: bool = false
var lobby_code: String = "" var lobby_code: String = ""
var has_bee_been_placed: bool = false var has_bee_been_placed: bool = false
var bees_placed: Dictionary = {}
var disconnect_reason: String = "" var disconnect_reason: String = ""
func reset() -> void: func reset() -> void:
is_hot_seat = false
has_bee_been_placed = false has_bee_been_placed = false
disconnect_reason = "" disconnect_reason = ""
bees_placed = {}

View file

@ -20,3 +20,6 @@ signal turn_ended(turn_num, map)
signal game_started signal game_started
signal game_over(black_lost, white_lost) signal game_over(black_lost, white_lost)
# Menu
signal switch_to_menu(from, to)

View file

@ -24,8 +24,8 @@ var is_blacks_turn: bool = false
var should_disable: bool = false var should_disable: bool = false
func is_players_turn() -> bool: func is_players_turn() -> bool:
return is_blacks_turn == GameData.is_player_black or GameData.debug return is_blacks_turn == is_black or GameData.debug
func update_color(_is_black: bool) -> void: func update_color(_is_black: bool) -> void:
is_black = _is_black is_black = _is_black
@ -37,7 +37,10 @@ func update_color(_is_black: bool) -> void:
update_tile_count_display() update_tile_count_display()
insect_icon.texture = insect_resource.ui_texture insect_icon.texture = insect_resource.ui_texture
if is_black != GameData.is_player_black and not GameData.debug: if GameData.is_hot_seat:
return
if is_black != is_blacks_turn and not GameData.debug:
disabled = true disabled = true
return return
@ -110,8 +113,8 @@ func _ready() -> void:
func _on_turn_started(turn_num: int, map: HexGrid, _is_blacks_turn: bool) -> void: func _on_turn_started(turn_num: int, map: HexGrid, _is_blacks_turn: bool) -> void:
is_blacks_turn = _is_blacks_turn is_blacks_turn = _is_blacks_turn
should_disable = false should_disable = false
if turn_num >= 7 and not GameData.has_bee_been_placed: if turn_num >= 7 and not GameData.bees_placed.has(is_black): #has_bee_been_placed:
if GameData.is_player_black == is_blacks_turn: if is_black == is_blacks_turn:
# if not bee has been placed for this player # if not bee has been placed for this player
# lock all buttons except the bee # lock all buttons except the bee
if is_same(BEE, insect_resource): if is_same(BEE, insect_resource):
@ -120,8 +123,7 @@ func _on_turn_started(turn_num: int, map: HexGrid, _is_blacks_turn: bool) -> voi
else: else:
#lock #lock
should_disable = true should_disable = true
refresh_state() refresh_state()
func _on_insect_tile_deselected(tile: InsectTile) -> void: func _on_insect_tile_deselected(tile: InsectTile) -> void:
@ -138,15 +140,16 @@ func _on_insect_selected(button: InsectButton, _is_black: bool) -> void:
disable() disable()
func hover() -> void: func hover() -> void:
if GameData.is_player_black != is_black and not GameData.debug:
return #if is_blacks_turn != is_black and not GameData.debug:
# return
var tween = get_tree().create_tween() var tween = get_tree().create_tween()
tween.tween_property(hex, "position", Vector2(0, -16), 0.1).set_ease(Tween.EASE_OUT).set_trans(Tween.TRANS_SPRING) tween.tween_property(hex, "position", Vector2(0, -16), 0.1).set_ease(Tween.EASE_OUT).set_trans(Tween.TRANS_SPRING)
func unhover() -> void: func unhover() -> void:
if GameData.is_player_black != is_black and not GameData.debug: #if is_blacks_turn != is_black and not GameData.debug:
return # return
var tween = get_tree().create_tween() var tween = get_tree().create_tween()
tween.tween_property(hex, "position", Vector2(0, 0), 0.25).set_ease(Tween.EASE_OUT).set_trans(Tween.TRANS_SPRING) tween.tween_property(hex, "position", Vector2(0, 0), 0.25).set_ease(Tween.EASE_OUT).set_trans(Tween.TRANS_SPRING)
@ -164,10 +167,17 @@ func _on_mouse_exited():
unhover() unhover()
func _on_pressed(): func _on_pressed():
# We can only press under these conditions
# Check if its the currents player turn (is black)
# If hotseat: we're done
# If multiplayer: Check if GameData.is_player_black is correct, this prevents
# the other player from using this button on their game instance
#GameData.is_hot_seat
if is_empty(): if is_empty():
return return
if GameData.is_player_black != is_black and not GameData.debug: if not is_blacks_turn == is_black and not GameData.debug:
return return
if not is_players_turn(): if not is_players_turn():

View file

@ -1,4 +1,4 @@
[gd_scene load_steps=7 format=3 uid="uid://c806afvtbie0n"] [gd_scene load_steps=7 format=3 uid="uid://dxwngv0xmk3vy"]
[ext_resource type="Script" path="res://Tile/Tile.gd" id="1_b68ym"] [ext_resource type="Script" path="res://Tile/Tile.gd" id="1_b68ym"]
[ext_resource type="ArrayMesh" uid="uid://dsbshu53k588h" path="res://hexagon_small.res" id="2_vm00h"] [ext_resource type="ArrayMesh" uid="uid://dsbshu53k588h" path="res://hexagon_small.res" id="2_vm00h"]

67
LANConnectMenu.gd Normal file
View file

@ -0,0 +1,67 @@
extends Control
@onready var host_button: Button = $PanelContainer/MarginContainer/VBoxContainer/HBoxContainer2/HostButton
@onready var connect_button = $PanelContainer/MarginContainer/VBoxContainer/ConnectButton
@onready var stop_hosting_button = $PanelContainer/MarginContainer/VBoxContainer/HBoxContainer2/StopHostingButton
@onready var ip_input = $PanelContainer/MarginContainer/VBoxContainer/HBoxContainer/IPInput
@onready var port_input = $PanelContainer/MarginContainer/VBoxContainer/HBoxContainer/PortInput
@onready var name_input = $PanelContainer/MarginContainer/VBoxContainer/HBoxContainer2/NameInput
@onready var game_list = $PanelContainer/MarginContainer/VBoxContainer/ScrollContainer/PanelContainer/GameList
@onready var broadcast_timer = $BroadcastTimer
var hosting: bool = false
var send_socket: PacketPeerUDP = PacketPeerUDP.new()
var server_socket: UDPServer = UDPServer.new()
# Called when the node enters the scene tree for the first time.
func _ready():
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
pass
func update_buttons() -> void:
host_button.disabled = hosting or name_input.text.is_empty()
connect_button.disabled = hosting or name_input.text.is_empty() or ip_input.text.is_empty() or port_input.text.is_empty()
func _on_line_edit_text_changed(new_text: String):
update_buttons()
func _on_ip_input_text_changed(new_text):
update_buttons()
func _on_port_input_text_changed(new_text):
update_buttons()
func _on_host_button_pressed():
hosting = true
host_button.visible = false
stop_hosting_button.visible = true
broadcast_timer.start()
update_buttons()
func _on_stop_hosting_button_pressed():
hosting = false
stop_hosting_button.visible = false
host_button.visible = true
broadcast_timer.stop()
update_buttons()
func _on_broadcast_timer_timeout():
var send_socket = PacketPeerUDP.new()
send_socket.set_broadcast_enabled(true)
send_socket.set_dest_address("255.255.255.255", 27474)
var dat = name_input.text.to_utf8_buffer()
send_socket.put_packet(dat)

119
LANConnectMenu.tscn Normal file
View file

@ -0,0 +1,119 @@
[gd_scene load_steps=2 format=3 uid="uid://swe8j0gmisq5"]
[ext_resource type="Script" path="res://LANConnectMenu.gd" id="1_bcuur"]
[node name="Control" type="Control"]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("1_bcuur")
[node name="PanelContainer" type="PanelContainer" parent="."]
layout_mode = 1
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -316.5
offset_top = -84.0
offset_right = 316.5
offset_bottom = 84.0
grow_horizontal = 2
grow_vertical = 2
[node name="MarginContainer" type="MarginContainer" parent="PanelContainer"]
layout_mode = 2
size_flags_horizontal = 4
size_flags_vertical = 4
theme_override_constants/margin_left = 15
theme_override_constants/margin_top = 15
theme_override_constants/margin_right = 15
theme_override_constants/margin_bottom = 15
[node name="VBoxContainer" type="VBoxContainer" parent="PanelContainer/MarginContainer"]
layout_mode = 2
theme_override_constants/separation = 15
[node name="HBoxContainer2" type="HBoxContainer" parent="PanelContainer/MarginContainer/VBoxContainer"]
layout_mode = 2
[node name="Label" type="Label" parent="PanelContainer/MarginContainer/VBoxContainer/HBoxContainer2"]
layout_mode = 2
text = "Playername:"
[node name="NameInput" type="LineEdit" parent="PanelContainer/MarginContainer/VBoxContainer/HBoxContainer2"]
layout_mode = 2
theme_override_constants/minimum_character_width = 16
placeholder_text = "Name"
max_length = 16
[node name="HostButton" type="Button" parent="PanelContainer/MarginContainer/VBoxContainer/HBoxContainer2"]
layout_mode = 2
disabled = true
text = "Host Game"
[node name="StopHostingButton" type="Button" parent="PanelContainer/MarginContainer/VBoxContainer/HBoxContainer2"]
visible = false
layout_mode = 2
text = "Stop Hosting"
[node name="ScrollContainer" type="ScrollContainer" parent="PanelContainer/MarginContainer/VBoxContainer"]
custom_minimum_size = Vector2(0, 200)
layout_mode = 2
size_flags_vertical = 3
horizontal_scroll_mode = 0
vertical_scroll_mode = 2
[node name="PanelContainer" type="PanelContainer" parent="PanelContainer/MarginContainer/VBoxContainer/ScrollContainer"]
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 3
[node name="GameList" type="VBoxContainer" parent="PanelContainer/MarginContainer/VBoxContainer/ScrollContainer/PanelContainer"]
layout_mode = 2
size_flags_horizontal = 3
[node name="HBoxContainer" type="HBoxContainer" parent="PanelContainer/MarginContainer/VBoxContainer"]
layout_mode = 2
[node name="LobbyCodeLabel" type="Label" parent="PanelContainer/MarginContainer/VBoxContainer/HBoxContainer"]
layout_mode = 2
text = "IP-Address: "
[node name="IPInput" type="LineEdit" parent="PanelContainer/MarginContainer/VBoxContainer/HBoxContainer"]
layout_mode = 2
theme_override_constants/minimum_character_width = 15
max_length = 32
shortcut_keys_enabled = false
[node name="LobbyCodePort" type="Label" parent="PanelContainer/MarginContainer/VBoxContainer/HBoxContainer"]
layout_mode = 2
text = "Port: "
[node name="PortInput" type="LineEdit" parent="PanelContainer/MarginContainer/VBoxContainer/HBoxContainer"]
layout_mode = 2
theme_override_constants/minimum_character_width = 15
max_length = 32
shortcut_keys_enabled = false
[node name="ConnectButton" type="Button" parent="PanelContainer/MarginContainer/VBoxContainer"]
layout_mode = 2
disabled = true
text = "Join Game"
[node name="BackButton" type="Button" parent="PanelContainer/MarginContainer/VBoxContainer"]
layout_mode = 2
text = "Back to menu"
[node name="BroadcastTimer" type="Timer" parent="."]
[connection signal="text_changed" from="PanelContainer/MarginContainer/VBoxContainer/HBoxContainer2/NameInput" to="." method="_on_line_edit_text_changed"]
[connection signal="pressed" from="PanelContainer/MarginContainer/VBoxContainer/HBoxContainer2/HostButton" to="." method="_on_host_button_pressed"]
[connection signal="pressed" from="PanelContainer/MarginContainer/VBoxContainer/HBoxContainer2/StopHostingButton" to="." method="_on_stop_hosting_button_pressed"]
[connection signal="text_changed" from="PanelContainer/MarginContainer/VBoxContainer/HBoxContainer/IPInput" to="." method="_on_ip_input_text_changed"]
[connection signal="text_changed" from="PanelContainer/MarginContainer/VBoxContainer/HBoxContainer/PortInput" to="." method="_on_port_input_text_changed"]
[connection signal="timeout" from="BroadcastTimer" to="." method="_on_broadcast_timer_timeout"]

View file

@ -41,7 +41,5 @@ text = "Start Game"
layout_mode = 2 layout_mode = 2
text = "Back to menu" text = "Back to menu"
[node name="PauseMenu" type="CanvasLayer" parent="."]
[connection signal="pressed" from="LobbyInfo/PanelContainer/VBoxContainer/StartGameButton" to="." method="_on_start_game_button_pressed"] [connection signal="pressed" from="LobbyInfo/PanelContainer/VBoxContainer/StartGameButton" to="." method="_on_start_game_button_pressed"]
[connection signal="pressed" from="LobbyInfo/PanelContainer/VBoxContainer/Button" to="LobbyInfo" method="_on_button_pressed"] [connection signal="pressed" from="LobbyInfo/PanelContainer/VBoxContainer/Button" to="LobbyInfo" method="_on_button_pressed"]

31
TestRot.gd Normal file
View file

@ -0,0 +1,31 @@
extends Control
@onready var current_menu: Control = $Level0Main/MainMenu
@onready var level_2 = $Level2
# Called when the node enters the scene tree for the first time.
func _ready():
GameEvents.switch_to_menu.connect(_on_switch_to_menu)
func _on_switch_to_menu(from: Control, to: Control) -> void:
var level: int = to.get_parent().get_meta("level")
var tween = get_tree().create_tween()
tween.set_parallel()
tween.tween_property(from, "modulate", Color(1.0, 1.0, 1.0, 0.0), 0.35).set_trans(Tween.TRANS_EXPO).set_ease(Tween.EASE_IN_OUT)
tween.tween_property(to, "modulate", Color(1.0, 1.0, 1.0, 1.0), 0.35).set_trans(Tween.TRANS_EXPO).set_ease(Tween.EASE_IN_OUT)
tween.tween_property(self, "rotation", - level * deg_to_rad(60.0), 0.75).set_trans(Tween.TRANS_BACK).set_ease(Tween.EASE_OUT)
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
if Input.is_action_just_pressed("place_tile"):
GameEvents.switch_to_menu.emit(current_menu, $Level1/MultiplayerJoin)
if Input.is_action_just_pressed("deselect_tile"):
GameEvents.switch_to_menu.emit($Level1/MultiplayerJoin, current_menu)
#tween.tween_property(self, "rotation", rots[(rots.size()-1) - current_rot_index], 0.5).set_ease(Tween.EASE_IN_OUT).set_trans(Tween.TRANS_EXPO)
#current_rot_index = (rots.size()-1) - current_rot_index
#rotation += 2.0*PI / 6.0
pass

27
TestUI.gd Normal file
View file

@ -0,0 +1,27 @@
extends TextureButton
# Called when the node enters the scene tree for the first time.
func _ready():
#position.x = 500
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
pass
func _on_mouse_entered():
var tween = get_tree().create_tween()
tween.tween_property(self, "position:x", 64, 0.5)
func _on_mouse_exited():
var tween = get_tree().create_tween()
tween.tween_property(self, "position:x", 0, 0.5)

16
UI/Table/Table.gd Normal file
View file

@ -0,0 +1,16 @@
extends Control
func add_row(data: ) -> void:
pass
func clear() -> void:
pass
# Called when the node enters the scene tree for the first time.
func _ready():
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
pass

33
UI/Table/Table.tscn Normal file
View file

@ -0,0 +1,33 @@
[gd_scene load_steps=3 format=3 uid="uid://sj0wiqp14xy3"]
[ext_resource type="PackedScene" uid="uid://bxettgjh1rv56" path="res://UI/Table/TableRow.tscn" id="1_dfhso"]
[ext_resource type="Script" path="res://UI/Table/Table.gd" id="1_xdpje"]
[node name="Table" type="Control"]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("1_xdpje")
[node name="Rows" type="VBoxContainer" parent="."]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
[node name="TableRow" parent="Rows" instance=ExtResource("1_dfhso")]
layout_mode = 2
[node name="TableRow2" parent="Rows" instance=ExtResource("1_dfhso")]
layout_mode = 2
[node name="TableRow3" parent="Rows" instance=ExtResource("1_dfhso")]
layout_mode = 2
[node name="TableRow4" parent="Rows" instance=ExtResource("1_dfhso")]
layout_mode = 2

10
UI/Table/TableCell.tscn Normal file
View file

@ -0,0 +1,10 @@
[gd_scene format=3 uid="uid://q8sqr5lw2w1i"]
[node name="TableCell" type="Label"]
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
size_flags_horizontal = 3
size_flags_vertical = 3

24
UI/Table/TableRow.tscn Normal file
View file

@ -0,0 +1,24 @@
[gd_scene load_steps=2 format=3 uid="uid://bxettgjh1rv56"]
[ext_resource type="PackedScene" uid="uid://q8sqr5lw2w1i" path="res://UI/Table/TableCell.tscn" id="1_e1426"]
[node name="TableRow" type="HBoxContainer"]
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
size_flags_horizontal = 3
size_flags_vertical = 3
[node name="TableCell" parent="." instance=ExtResource("1_e1426")]
layout_mode = 2
text = "Playername"
[node name="TableCell2" parent="." instance=ExtResource("1_e1426")]
layout_mode = 2
text = "255.255.255.255"
[node name="TableCell3" parent="." instance=ExtResource("1_e1426")]
layout_mode = 2
text = "65535"

View file

@ -1,7 +1,12 @@
extends Control extends Control
@onready var exit_button = $PanelContainer/MarginContainer/VBoxContainer/ExitButton
# Called when the node enters the scene tree for the first time. # Called when the node enters the scene tree for the first time.
func _ready() -> void: func _ready() -> void:
if OS.has_feature("web"):
exit_button.visible = false
WSClient.lobby_joined.connect(_on_lobby_joined) WSClient.lobby_joined.connect(_on_lobby_joined)
GameData.reset() GameData.reset()

View file

@ -40,23 +40,66 @@ theme_override_constants/margin_bottom = 15
layout_mode = 2 layout_mode = 2
theme_override_constants/separation = 15 theme_override_constants/separation = 15
[node name="Label2" type="Label" parent="PanelContainer/MarginContainer/VBoxContainer"]
layout_mode = 2
text = "Singleplayer"
[node name="HostButton" type="Button" parent="PanelContainer/MarginContainer/VBoxContainer"] [node name="HostButton" type="Button" parent="PanelContainer/MarginContainer/VBoxContainer"]
visible = false
layout_mode = 2 layout_mode = 2
text = "Host Game" text = "Host Game"
[node name="JoinButton" type="Button" parent="PanelContainer/MarginContainer/VBoxContainer"] [node name="JoinButton" type="Button" parent="PanelContainer/MarginContainer/VBoxContainer"]
visible = false
layout_mode = 2 layout_mode = 2
text = "Join Game" text = "Join Game"
[node name="SingleplayerButton" type="Button" parent="PanelContainer/MarginContainer/VBoxContainer"]
layout_mode = 2
disabled = true
text = "Singleplayer"
[node name="HSeparator2" type="HSeparator" parent="PanelContainer/MarginContainer/VBoxContainer"]
layout_mode = 2
[node name="Label" type="Label" parent="PanelContainer/MarginContainer/VBoxContainer"]
layout_mode = 2
text = "Multiplayer"
[node name="LocalButton" type="Button" parent="PanelContainer/MarginContainer/VBoxContainer"]
layout_mode = 2
text = "Local (Hotseat)"
[node name="OnlineButton" type="Button" parent="PanelContainer/MarginContainer/VBoxContainer"]
layout_mode = 2
text = "Online"
[node name="LANButton" type="Button" parent="PanelContainer/MarginContainer/VBoxContainer"]
layout_mode = 2
disabled = true
text = "LAN"
[node name="HSeparator" type="HSeparator" parent="PanelContainer/MarginContainer/VBoxContainer"]
layout_mode = 2
[node name="SettingsButton" type="Button" parent="PanelContainer/MarginContainer/VBoxContainer"]
layout_mode = 2
disabled = true
text = "Settings"
[node name="HSeparator3" type="HSeparator" parent="PanelContainer/MarginContainer/VBoxContainer"]
layout_mode = 2
[node name="RulesButton" type="Button" parent="PanelContainer/MarginContainer/VBoxContainer"] [node name="RulesButton" type="Button" parent="PanelContainer/MarginContainer/VBoxContainer"]
layout_mode = 2 layout_mode = 2
text = "Rules (Opens Web Browser)" text = "Rules"
[node name="ExitButton" type="Button" parent="PanelContainer/MarginContainer/VBoxContainer"] [node name="ExitButton" type="Button" parent="PanelContainer/MarginContainer/VBoxContainer"]
layout_mode = 2 layout_mode = 2
text = "Exit" text = "Exit"
[node name="DisconnectInfo" type="Control" parent="."] [node name="DisconnectInfo" type="Control" parent="."]
visible = false
layout_mode = 1 layout_mode = 1
anchors_preset = 15 anchors_preset = 15
anchor_right = 1.0 anchor_right = 1.0
@ -96,6 +139,11 @@ text = "Ok"
[connection signal="pressed" from="PanelContainer/MarginContainer/VBoxContainer/HostButton" to="." method="_on_host_button_pressed"] [connection signal="pressed" from="PanelContainer/MarginContainer/VBoxContainer/HostButton" to="." method="_on_host_button_pressed"]
[connection signal="pressed" from="PanelContainer/MarginContainer/VBoxContainer/JoinButton" to="." method="_on_join_button_pressed"] [connection signal="pressed" from="PanelContainer/MarginContainer/VBoxContainer/JoinButton" to="." method="_on_join_button_pressed"]
[connection signal="pressed" from="PanelContainer/MarginContainer/VBoxContainer/SingleplayerButton" to="." method="_on_rules_button_pressed"]
[connection signal="pressed" from="PanelContainer/MarginContainer/VBoxContainer/LocalButton" to="." method="_on_rules_button_pressed"]
[connection signal="pressed" from="PanelContainer/MarginContainer/VBoxContainer/OnlineButton" to="." method="_on_rules_button_pressed"]
[connection signal="pressed" from="PanelContainer/MarginContainer/VBoxContainer/LANButton" to="." method="_on_rules_button_pressed"]
[connection signal="pressed" from="PanelContainer/MarginContainer/VBoxContainer/SettingsButton" to="." method="_on_rules_button_pressed"]
[connection signal="pressed" from="PanelContainer/MarginContainer/VBoxContainer/RulesButton" to="." method="_on_rules_button_pressed"] [connection signal="pressed" from="PanelContainer/MarginContainer/VBoxContainer/RulesButton" to="." method="_on_rules_button_pressed"]
[connection signal="pressed" from="PanelContainer/MarginContainer/VBoxContainer/ExitButton" to="." method="_on_exit_button_pressed"] [connection signal="pressed" from="PanelContainer/MarginContainer/VBoxContainer/ExitButton" to="." method="_on_exit_button_pressed"]
[connection signal="pressed" from="DisconnectInfo/PanelContainer/MarginContainer/VBoxContainer/Button" to="DisconnectInfo" method="_on_button_pressed"] [connection signal="pressed" from="DisconnectInfo/PanelContainer/MarginContainer/VBoxContainer/Button" to="DisconnectInfo" method="_on_button_pressed"]

176
testmenu.tscn Normal file
View file

@ -0,0 +1,176 @@
[gd_scene load_steps=3 format=3 uid="uid://c17svupm3ctqe"]
[ext_resource type="Script" path="res://TestRot.gd" id="1_86fiq"]
[ext_resource type="Texture2D" uid="uid://d2i5vboeyq8qx" path="res://UI/hex_white.svg" id="1_hmexp"]
[node name="Control" type="Control"]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
[node name="Control" type="Control" parent="."]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
pivot_offset = Vector2(25.6, 25.6)
script = ExtResource("1_86fiq")
[node name="CornerRect" type="Control" parent="Control"]
layout_mode = 1
anchors_preset = 0
offset_right = 64.0
offset_bottom = 64.0
scale = Vector2(0.1, 0.1)
[node name="TextureRect" type="TextureRect" parent="Control/CornerRect"]
layout_mode = 0
offset_right = 40.0
offset_bottom = 40.0
texture = ExtResource("1_hmexp")
[node name="Level0Main" type="Control" parent="Control"]
layout_mode = 1
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -20.0
offset_top = -20.0
offset_right = 20.0
offset_bottom = 20.0
grow_horizontal = 2
grow_vertical = 2
metadata/level = 0
[node name="MainMenu" type="Control" parent="Control/Level0Main"]
layout_mode = 1
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
grow_horizontal = 2
grow_vertical = 2
[node name="Center" type="Control" parent="Control/Level0Main/MainMenu"]
layout_mode = 1
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
grow_horizontal = 2
grow_vertical = 2
[node name="PanelContainer" type="PanelContainer" parent="Control/Level0Main/MainMenu/Center"]
layout_mode = 1
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -125.5
offset_top = -99.5
offset_right = 125.5
offset_bottom = 99.5
grow_horizontal = 2
grow_vertical = 2
[node name="MarginContainer" type="MarginContainer" parent="Control/Level0Main/MainMenu/Center/PanelContainer"]
layout_mode = 2
theme_override_constants/margin_left = 15
theme_override_constants/margin_top = 15
theme_override_constants/margin_right = 15
theme_override_constants/margin_bottom = 15
[node name="VBoxContainer" type="VBoxContainer" parent="Control/Level0Main/MainMenu/Center/PanelContainer/MarginContainer"]
layout_mode = 2
theme_override_constants/separation = 15
[node name="HostButton" type="Button" parent="Control/Level0Main/MainMenu/Center/PanelContainer/MarginContainer/VBoxContainer"]
layout_mode = 2
text = "Host Game"
[node name="JoinButton" type="Button" parent="Control/Level0Main/MainMenu/Center/PanelContainer/MarginContainer/VBoxContainer"]
layout_mode = 2
text = "Join Game"
[node name="RulesButton" type="Button" parent="Control/Level0Main/MainMenu/Center/PanelContainer/MarginContainer/VBoxContainer"]
layout_mode = 2
text = "Rules (Opens Web Browser)"
[node name="ExitButton" type="Button" parent="Control/Level0Main/MainMenu/Center/PanelContainer/MarginContainer/VBoxContainer"]
layout_mode = 2
text = "Exit"
[node name="Level1" type="Control" parent="Control"]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
rotation = 1.0472
metadata/level = 1
[node name="MultiplayerJoin" type="Control" parent="Control/Level1"]
modulate = Color(1, 1, 1, 0)
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
[node name="PanelContainer" type="PanelContainer" parent="Control/Level1/MultiplayerJoin"]
layout_mode = 1
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -115.0
offset_top = -76.5
offset_right = 115.0
offset_bottom = 76.5
grow_horizontal = 2
grow_vertical = 2
[node name="MarginContainer" type="MarginContainer" parent="Control/Level1/MultiplayerJoin/PanelContainer"]
layout_mode = 2
theme_override_constants/margin_left = 15
theme_override_constants/margin_top = 15
theme_override_constants/margin_right = 15
theme_override_constants/margin_bottom = 15
[node name="VBoxContainer" type="VBoxContainer" parent="Control/Level1/MultiplayerJoin/PanelContainer/MarginContainer"]
layout_mode = 2
theme_override_constants/separation = 15
[node name="HBoxContainer" type="HBoxContainer" parent="Control/Level1/MultiplayerJoin/PanelContainer/MarginContainer/VBoxContainer"]
layout_mode = 2
[node name="LobbyCodeLabel" type="Label" parent="Control/Level1/MultiplayerJoin/PanelContainer/MarginContainer/VBoxContainer/HBoxContainer"]
layout_mode = 2
text = "Lobby-Code: "
[node name="LobbyCodeInput" type="LineEdit" parent="Control/Level1/MultiplayerJoin/PanelContainer/MarginContainer/VBoxContainer/HBoxContainer"]
layout_mode = 2
theme_override_constants/minimum_character_width = 6
max_length = 6
shortcut_keys_enabled = false
[node name="ConnectButton" type="Button" parent="Control/Level1/MultiplayerJoin/PanelContainer/MarginContainer/VBoxContainer"]
layout_mode = 2
text = "Connect"
[node name="BackButton" type="Button" parent="Control/Level1/MultiplayerJoin/PanelContainer/MarginContainer/VBoxContainer"]
layout_mode = 2
text = "Back to menu"