feat: add tutorial section
This commit is contained in:
@@ -121,6 +121,18 @@ func _ready():
|
||||
# Initial UI update
|
||||
_on_profile_updated()
|
||||
|
||||
# Inject Tutorial button
|
||||
var tutorial_btn = Button.new()
|
||||
tutorial_btn.name = "TutorialBtn"
|
||||
tutorial_btn.text = "PLAY TUTORIAL"
|
||||
tutorial_btn.theme_type_variation = "FlatButton"
|
||||
tutorial_btn.add_theme_font_size_override("font_size", 24)
|
||||
tutorial_btn.pressed.connect(_on_tutorial_pressed)
|
||||
var btn_section = main_menu_panel.get_node_or_null("VBoxContainer/ButtonSection")
|
||||
if btn_section:
|
||||
btn_section.add_child(tutorial_btn)
|
||||
btn_section.move_child(tutorial_btn, 0)
|
||||
|
||||
# Connect button signals - Main Menu
|
||||
create_room_btn.pressed.connect(_on_create_room_pressed)
|
||||
browse_rooms_btn.pressed.connect(_on_browse_rooms_pressed)
|
||||
@@ -333,6 +345,21 @@ func _show_panel(panel_name: String) -> void:
|
||||
# Main Menu Button Handlers
|
||||
# =============================================================================
|
||||
|
||||
func _on_tutorial_pressed() -> void:
|
||||
if AuthManager.is_guest:
|
||||
if LobbyManager.local_player_name.is_empty() or LobbyManager.local_player_name == "Player":
|
||||
LobbyManager.local_player_name = NameGenerator.generate_guest_name()
|
||||
else:
|
||||
LobbyManager.local_player_name = UserProfileManager.get_display_name()
|
||||
connection_status.text = "Starting Tutorial Scenario..."
|
||||
_apply_loadout_character()
|
||||
LobbyManager.start_tutorial("Freemode")
|
||||
# Give the engine two frames for room_joined signal to settle,
|
||||
# then immediately force-start the game — bypassing the lobby wait screen.
|
||||
await get_tree().process_frame
|
||||
await get_tree().process_frame
|
||||
LobbyManager.start_game(true)
|
||||
|
||||
func _on_create_room_pressed() -> void:
|
||||
# Use profile name for logged-in users, or guest for others
|
||||
if AuthManager.is_guest:
|
||||
|
||||
Reference in New Issue
Block a user