attempt to make stop n go gamemode

This commit is contained in:
2026-02-19 03:42:59 +08:00
parent 4ce917db0f
commit a7a8106b7e
11 changed files with 516 additions and 28 deletions
+25
View File
@@ -40,6 +40,8 @@ extends Control
@onready var enable_timer_label = $LobbyPanel/TopBar/SettingsSection/EnableTimerLabel
@onready var scarcity_option = $LobbyPanel/TopBar/SettingsSection/ScarcityOption
@onready var scarcity_label = $LobbyPanel/TopBar/SettingsSection/ScarcityLabel
@onready var game_mode_option = $LobbyPanel/TopBar/SettingsSection/GameModeOption
@onready var game_mode_text_label = $LobbyPanel/TopBar/SettingsSection/GameModeTextLabel
# UI References - Player Slots
@onready var players_container = $LobbyPanel/PlayersContainer
@@ -145,6 +147,9 @@ func _ready():
if scarcity_option:
scarcity_option.item_selected.connect(_on_scarcity_selected)
if game_mode_option:
game_mode_option.item_selected.connect(_on_game_mode_selected)
# Connect LobbyManager signals
LobbyManager.room_list_updated.connect(_on_room_list_updated)
LobbyManager.room_joined.connect(_on_room_joined)
@@ -160,6 +165,7 @@ func _ready():
LobbyManager.character_changed.connect(_on_character_changed)
LobbyManager.area_changed.connect(_on_area_changed)
LobbyManager.scarcity_mode_changed.connect(_on_scarcity_mode_changed)
LobbyManager.game_mode_changed.connect(_on_game_mode_changed)
LobbyManager.player_list_changed.connect(_update_player_slots)
# Connect NakamaManager signals
@@ -354,6 +360,20 @@ func _on_scarcity_mode_changed(mode: String) -> void:
if scarcity_label:
scarcity_label.text = mode
func _on_game_mode_selected(index: int) -> void:
if not LobbyManager.is_host: return
var mode = game_mode_option.get_item_text(index)
LobbyManager.set_game_mode(mode)
func _on_game_mode_changed(mode: String) -> void:
if game_mode_option:
for i in range(game_mode_option.item_count):
if game_mode_option.get_item_text(i) == mode:
game_mode_option.selected = i
break
if game_mode_text_label:
game_mode_text_label.text = mode
func _update_random_spawn_label(enabled: bool) -> void:
if random_spawn_label:
@@ -430,6 +450,11 @@ func _on_room_joined(room_data: Dictionary) -> void:
area_right_btn.disabled = not is_host
area_name_label.text = LobbyManager.get_selected_area()
# Game Mode Update
if game_mode_option: game_mode_option.visible = is_host
if game_mode_text_label: game_mode_text_label.visible = not is_host
_on_game_mode_changed(LobbyManager.game_mode)
_update_player_slots()
connection_status.text = "Connected to room"