update network

This commit is contained in:
2026-02-04 16:31:18 +08:00
parent 4ccf789421
commit 08b0493c06
10 changed files with 203 additions and 22 deletions
+37 -5
View File
@@ -7,6 +7,10 @@ extends Control
@onready var browse_rooms_btn = $MainMenuPanel/VBoxContainer/ButtonSection/BrowseRoomsBtn
@onready var main_menu_profile_btn = $MainMenuPanel/VBoxContainer/ButtonSection/ProfileBtn
# UI References - Server Selection
@onready var server_option = $MainMenuPanel/VBoxContainer/ServerSelectionSection/ServerOption
@onready var server_ip_input = $MainMenuPanel/VBoxContainer/ServerSelectionSection/ServerIPInput
# UI References - Room List
@onready var room_list_panel = $RoomListPanel
@onready var room_list = $RoomListPanel/VBoxContainer/RoomList
@@ -68,18 +72,23 @@ var current_match_id: String = ""
var scarcity_option: OptionButton
var scarcity_label: Label
# Server Selection Controls (Now in tscn)
# var server_option: OptionButton
# var server_ip_input: LineEdit
func _ready():
# Check if user is authenticated
if not AuthManager.is_logged_in():
call_deferred("_go_to_login")
return
# Check if user is authenticated (Commented out to allow server config on main menu)
# if not AuthManager.is_logged_in():
# call_deferred("_go_to_login")
# return
# Load character textures
_load_character_textures()
# Inject Scarcity UI
call_deferred("_setup_scarcity_ui")
# Server config UI is now in tscn
# Get player slot references
_setup_player_slots()
@@ -108,6 +117,15 @@ func _ready():
if main_menu_profile_btn:
main_menu_profile_btn.pressed.connect(_on_profile_btn_pressed)
# Connect Server Selection signals
if server_option:
server_option.item_selected.connect(_on_server_option_selected)
# Initialize state
_on_server_option_selected(server_option.selected)
if server_ip_input:
server_ip_input.text_submitted.connect(_on_server_ip_submitted)
server_ip_input.focus_exited.connect(func(): _on_server_ip_submitted(server_ip_input.text))
# Connect button signals - Room List
refresh_btn.pressed.connect(_on_refresh_pressed)
join_btn.pressed.connect(_on_join_pressed)
@@ -166,6 +184,20 @@ func _load_character_textures() -> void:
else:
print("[Lobby] Character texture not found: ", tex_path)
func _on_server_option_selected(index: int) -> void:
if index == 0:
# Localhost
if server_ip_input: server_ip_input.visible = false
NakamaManager.set_server("localhost")
else:
# Remote
if server_ip_input: server_ip_input.visible = true
if server_ip_input: NakamaManager.set_server(server_ip_input.text)
func _on_server_ip_submitted(new_text: String) -> void:
if server_option and server_option.selected == 1:
NakamaManager.set_server(new_text.strip_edges())
func _setup_scarcity_ui() -> void:
"""Inject scarcity controls into SettingsSection."""
if not duration_option: return
+56 -5
View File
@@ -59,7 +59,7 @@ theme_override_constants/separation = 4
[node name="Title" type="Label" parent="MainMenuPanel/VBoxContainer/TitleContainer" unique_id=612210089]
layout_mode = 2
theme_override_colors/font_color = Color(0.647, 0.996, 0.224, 1)
theme_override_colors/font_color = Color(0.52, 0.52, 0.52, 1)
theme_override_font_sizes/font_size = 44
text = "TEKTON DASH"
horizontal_alignment = 1
@@ -67,7 +67,7 @@ vertical_alignment = 1
[node name="Subtitle" type="Label" parent="MainMenuPanel/VBoxContainer/TitleContainer" unique_id=670350843]
layout_mode = 2
theme_override_colors/font_color = Color(0.992, 0.796, 0.047, 1)
theme_override_colors/font_color = Color(0.71, 0.5751, 0.03550001, 1)
theme_override_font_sizes/font_size = 12
text = "ARMAGEDDON VERSION"
horizontal_alignment = 1
@@ -91,6 +91,36 @@ layout_mode = 2
text = "Player"
placeholder_text = "Enter your name..."
[node name="ServerSelectionSection" type="VBoxContainer" parent="MainMenuPanel/VBoxContainer" unique_id=748392101]
layout_mode = 2
theme_override_constants/separation = 10
[node name="ServerLabel" type="Label" parent="MainMenuPanel/VBoxContainer/ServerSelectionSection" unique_id=748392102]
layout_mode = 2
theme_override_colors/font_color = Color(0.69, 0.529, 0.357, 1)
theme_override_font_sizes/font_size = 13
text = "NAKAMA SERVER"
[node name="ServerOption" type="OptionButton" parent="MainMenuPanel/VBoxContainer/ServerSelectionSection" unique_id=748392103]
custom_minimum_size = Vector2(0, 44)
layout_mode = 2
selected = 0
item_count = 2
popup/item_0/text = "Localhost (Testing)"
popup/item_0/id = 0
popup/item_1/text = "Remote Server (Host IP)"
popup/item_1/id = 1
[node name="ServerIPInput" type="LineEdit" parent="MainMenuPanel/VBoxContainer/ServerSelectionSection" unique_id=748392104]
visible = false
custom_minimum_size = Vector2(0, 44)
layout_mode = 2
text = "127.0.0.1"
placeholder_text = "Enter Server IP Address..."
[node name="ServerSeparator" type="HSeparator" parent="MainMenuPanel/VBoxContainer" unique_id=748392105]
layout_mode = 2
[node name="ButtonSection" type="VBoxContainer" parent="MainMenuPanel/VBoxContainer" unique_id=793290187]
layout_mode = 2
theme_override_constants/separation = 12
@@ -134,7 +164,7 @@ theme_override_constants/separation = 14
[node name="Header" type="Label" parent="RoomListPanel/VBoxContainer" unique_id=911540555]
layout_mode = 2
theme_override_colors/font_color = Color(0.647, 0.996, 0.224, 1)
theme_override_colors/font_color = Color(0.52156866, 0.52156866, 0.52156866, 1)
theme_override_font_sizes/font_size = 28
text = "SERVER BROWSER"
horizontal_alignment = 1
@@ -198,14 +228,35 @@ anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
[node name="LobbyBackground" type="ColorRect" parent="LobbyPanel" unique_id=1549298772]
[node name="TextureRect" type="TextureRect" parent="LobbyPanel" unique_id=518450226]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
color = Color(0.06, 0.08, 0.12, 1)
texture = ExtResource("3_q60fs")
expand_mode = 2
[node name="TextureRect2" type="TextureRect" parent="LobbyPanel" unique_id=1500007123]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
texture = ExtResource("4_nqcc7")
expand_mode = 2
[node name="LobbyBackground" type="ColorRect" parent="LobbyPanel" unique_id=1549298772]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
offset_right = 2.0
grow_horizontal = 2
grow_vertical = 2
color = Color(0.06, 0.080000006, 0.12, 0.8666667)
[node name="TopBar" type="HBoxContainer" parent="LobbyPanel" unique_id=1388322915]
layout_mode = 1