added more tomes

This commit is contained in:
2026-01-25 00:59:34 +01:00
parent 9ab4a13244
commit a95e22d2fa
79 changed files with 2429 additions and 337 deletions

View File

@@ -26,6 +26,7 @@ var is_hosting: bool = false # Track if we're hosting (don't fetch rooms when h
var room_list_container: VBoxContainer = null # Container for displaying available rooms
var refresh_button: Button = null # Refresh button for manually reloading rooms
var refresh_cooldown_timer: Timer = null # Timer for refresh button cooldown
var active_room_join_button: Button = null # Join button we're currently using (reset on fail)
func _ready():
# Wait for nodes to be ready
@@ -513,19 +514,47 @@ func _add_room_item(room_code: String, players: int, level: int):
# Join button
var room_join_button = Button.new()
room_join_button.name = "JoinButton"
room_join_button.text = "Join"
room_join_button.custom_minimum_size = Vector2(80, 0)
# Connect button to join function
room_join_button.pressed.connect(func(): _join_room(room_code))
room_join_button.pressed.connect(func(): _join_room(room_code, room_join_button))
room_row.add_child(room_join_button)
room_list_container.add_child(room_row)
func _join_room(room_code: String):
func _disable_all_room_join_buttons():
"""Disable all room Join buttons to prevent multiple clicks"""
if not room_list_container:
return
for row in room_list_container.get_children():
if row.name.begins_with("RoomRow_"):
var btn = row.get_node_or_null("JoinButton")
if btn and is_instance_valid(btn):
btn.disabled = true
func _reset_room_join_buttons():
"""Re-enable all room Join buttons and restore 'Join' text"""
if not room_list_container:
return
for row in room_list_container.get_children():
if row.name.begins_with("RoomRow_"):
var btn = row.get_node_or_null("JoinButton")
if btn and is_instance_valid(btn):
btn.disabled = false
btn.text = "Join"
active_room_join_button = null
func _join_room(room_code: String, room_join_button: Button = null):
"""Join a room by setting the address and clicking join"""
if room_code.is_empty():
return
# Prevent multiple clicks: disable all join buttons and show loader state
_disable_all_room_join_buttons()
if room_join_button and is_instance_valid(room_join_button):
room_join_button.text = "Joining..."
active_room_join_button = room_join_button
# Set the address input
if address_input:
address_input.text = room_code
@@ -534,9 +563,15 @@ func _join_room(room_code: String):
var local_count = int(local_players_spinbox.value)
network_manager.set_local_player_count(local_count)
is_joining_attempt = true
last_join_address = room_code
# Join the game
if network_manager.join_game(room_code):
LogManager.log("Joining room: " + room_code, LogManager.CATEGORY_UI)
if not network_manager.join_game(room_code):
_reset_room_join_buttons()
is_joining_attempt = false
return
LogManager.log("Joining room: " + room_code, LogManager.CATEGORY_UI)
func _on_network_mode_changed(index: int):
# On web builds, index 0 = WebRTC, index 1 = WebSocket
@@ -648,6 +683,9 @@ func _on_connection_succeeded():
func _on_connection_failed():
LogManager.log("Connection failed", LogManager.CATEGORY_UI)
# Always reset room Join buttons on failure (they may be stuck on "Joining...")
if is_joining_attempt:
_reset_room_join_buttons()
if connection_error_shown:
# Already shown, don't spam
return