feat: Implement initial main game scene with gridmap, environment, and touch control UI elements.
This commit is contained in:
+7
-7
@@ -61,12 +61,8 @@ func _ready():
|
|||||||
# Setup global multiplayer spawners (Stands, etc.)
|
# Setup global multiplayer spawners (Stands, etc.)
|
||||||
_setup_multiplayer_spawners()
|
_setup_multiplayer_spawners()
|
||||||
|
|
||||||
# Connect HUD Settings button to pause menu toggle
|
# HUD Settings connection is now handled internally by TouchControlsManager
|
||||||
var hud_settings = get_node_or_null("TouchControls/TouchControls/SettingsBtn")
|
# which calls _toggle_pause_menu() on this scene.
|
||||||
if hud_settings:
|
|
||||||
if hud_settings.pressed.is_connected(_toggle_pause_menu):
|
|
||||||
hud_settings.pressed.disconnect(_toggle_pause_menu)
|
|
||||||
hud_settings.pressed.connect(_toggle_pause_menu)
|
|
||||||
|
|
||||||
# Programmatically connect Pause Menu Settings button to ensure it works
|
# Programmatically connect Pause Menu Settings button to ensure it works
|
||||||
var pause_settings = get_node_or_null("PauseMenu/Panel/VBox/SettingsBtn")
|
var pause_settings = get_node_or_null("PauseMenu/Panel/VBox/SettingsBtn")
|
||||||
@@ -2305,7 +2301,11 @@ func _toggle_pause_menu():
|
|||||||
var pause_menu = get_node_or_null("PauseMenu")
|
var pause_menu = get_node_or_null("PauseMenu")
|
||||||
if pause_menu:
|
if pause_menu:
|
||||||
pause_menu.visible = not pause_menu.visible
|
pause_menu.visible = not pause_menu.visible
|
||||||
# get_tree().paused = pause_menu.visible # Removed for multiplayer consistency
|
|
||||||
|
# Hide NetworkInfo in pause menu as requested (too technical/unnecessary for local pause)
|
||||||
|
var network_info = pause_menu.get_node_or_null("Panel/NetworkPanel/NetworkInfo")
|
||||||
|
if network_info:
|
||||||
|
network_info.visible = false
|
||||||
|
|
||||||
func _on_resume_pressed():
|
func _on_resume_pressed():
|
||||||
var pause_menu = get_node_or_null("PauseMenu")
|
var pause_menu = get_node_or_null("PauseMenu")
|
||||||
|
|||||||
@@ -9873,6 +9873,7 @@ layout_mode = 2
|
|||||||
theme_override_styles/panel = ExtResource("5_dvx6y")
|
theme_override_styles/panel = ExtResource("5_dvx6y")
|
||||||
|
|
||||||
[node name="NetworkInfo" type="HBoxContainer" parent="PauseMenu/Panel/NetworkPanel" unique_id=1194782604]
|
[node name="NetworkInfo" type="HBoxContainer" parent="PauseMenu/Panel/NetworkPanel" unique_id=1194782604]
|
||||||
|
visible = false
|
||||||
layout_mode = 1
|
layout_mode = 1
|
||||||
anchors_preset = 5
|
anchors_preset = 5
|
||||||
anchor_left = 0.5
|
anchor_left = 0.5
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ var attack_mode_button: Button # Renamed from special_button
|
|||||||
var spawn_boost_button: Button
|
var spawn_boost_button: Button
|
||||||
var settings_button: Button
|
var settings_button: Button
|
||||||
var tekton_grab_button: Button
|
var tekton_grab_button: Button
|
||||||
|
@onready var SettingsManager = get_node_or_null("/root/SettingsManager")
|
||||||
|
|
||||||
# Settings - persisted to config file
|
# Settings - persisted to config file
|
||||||
const CONFIG_PATH = "user://touch_controls_settings.cfg"
|
const CONFIG_PATH = "user://touch_controls_settings.cfg"
|
||||||
@@ -39,6 +40,27 @@ func initialize(p_main: Node3D):
|
|||||||
main_scene = p_main
|
main_scene = p_main
|
||||||
_create_touch_ui()
|
_create_touch_ui()
|
||||||
_load_settings()
|
_load_settings()
|
||||||
|
|
||||||
|
# Connect to remapping signals
|
||||||
|
if SettingsManager and not SettingsManager.control_remapped.is_connected(_on_control_remapped):
|
||||||
|
SettingsManager.control_remapped.connect(_on_control_remapped)
|
||||||
|
|
||||||
|
func _on_control_remapped(_action: String, _key: int):
|
||||||
|
print("[TouchControls] Control remapped: %s. Refreshing labels." % _action)
|
||||||
|
|
||||||
|
# Refresh primary assigned buttons
|
||||||
|
if grab_button: _ensure_shortcut_label(grab_button, "Grab")
|
||||||
|
if put_button: _ensure_shortcut_label(put_button, "Put")
|
||||||
|
if attack_mode_button: _ensure_shortcut_label(attack_mode_button, "AttackMode")
|
||||||
|
if spawn_boost_button: _ensure_shortcut_label(spawn_boost_button, "SpawnBoost")
|
||||||
|
if tekton_grab_button: _ensure_shortcut_label(tekton_grab_button, "TektonGrab")
|
||||||
|
|
||||||
|
# Also check all direct children of actions_container just in case
|
||||||
|
if actions_container:
|
||||||
|
for child in actions_container.get_children():
|
||||||
|
if child is Button:
|
||||||
|
var b_name = child.name.replace("Btn", "")
|
||||||
|
_ensure_shortcut_label(child, b_name)
|
||||||
|
|
||||||
func set_player(p_player: Node3D):
|
func set_player(p_player: Node3D):
|
||||||
local_player = p_player
|
local_player = p_player
|
||||||
@@ -275,16 +297,17 @@ func _style_button(btn: Button, opacity: float):
|
|||||||
|
|
||||||
func _ensure_shortcut_label(btn: Button, button_name: String):
|
func _ensure_shortcut_label(btn: Button, button_name: String):
|
||||||
if btn.has_node("ShortcutLabel"):
|
if btn.has_node("ShortcutLabel"):
|
||||||
# Update Label content if it exists to match potential remapping
|
|
||||||
var existing_lbl = btn.get_node("ShortcutLabel")
|
var existing_lbl = btn.get_node("ShortcutLabel")
|
||||||
var is_sng = LobbyManager.is_game_mode(GameMode.Mode.STOP_N_GO)
|
if not SettingsManager: return
|
||||||
|
|
||||||
match button_name:
|
match button_name:
|
||||||
"Grab": existing_lbl.text = "Space" if is_sng else ""
|
"Grab": existing_lbl.text = SettingsManager.get_control_text("grab")
|
||||||
"Put": existing_lbl.text = ""
|
"Put": existing_lbl.text = ""
|
||||||
"AttackMode": existing_lbl.text = "Q" if is_sng else ""
|
"AttackMode": existing_lbl.text = SettingsManager.get_control_text("attack_mode")
|
||||||
"SpawnBoost": existing_lbl.text = "E" if is_sng else ""
|
"SpawnBoost": existing_lbl.text = SettingsManager.get_control_text("spawn_boost")
|
||||||
"TektonGrab": existing_lbl.text = "G"
|
"TektonGrab": existing_lbl.text = SettingsManager.get_control_text("tekton_grab")
|
||||||
|
|
||||||
|
print("[TouchControls] Updated %s shortcut label to: %s" % [button_name, existing_lbl.text])
|
||||||
|
|
||||||
# Ensure correct placement (Top Right)
|
# Ensure correct placement (Top Right)
|
||||||
existing_lbl.horizontal_alignment = HORIZONTAL_ALIGNMENT_RIGHT
|
existing_lbl.horizontal_alignment = HORIZONTAL_ALIGNMENT_RIGHT
|
||||||
@@ -310,11 +333,11 @@ func _ensure_shortcut_label(btn: Button, button_name: String):
|
|||||||
shortcut_lbl.add_theme_constant_override("outline_size", 4)
|
shortcut_lbl.add_theme_constant_override("outline_size", 4)
|
||||||
|
|
||||||
match button_name:
|
match button_name:
|
||||||
"Grab": shortcut_lbl.text = "Space"
|
"Grab": shortcut_lbl.text = SettingsManager.get_control_text("grab") if SettingsManager else "Space"
|
||||||
"Put": shortcut_lbl.text = "" # Disabled shortcut
|
"Put": shortcut_lbl.text = "" # Disabled shortcut
|
||||||
"AttackMode": shortcut_lbl.text = "Q"
|
"AttackMode": shortcut_lbl.text = SettingsManager.get_control_text("attack_mode") if SettingsManager else "Q"
|
||||||
"SpawnBoost": shortcut_lbl.text = "E"
|
"SpawnBoost": shortcut_lbl.text = SettingsManager.get_control_text("spawn_boost") if SettingsManager else "E"
|
||||||
"TektonGrab": shortcut_lbl.text = "G"
|
"TektonGrab": shortcut_lbl.text = SettingsManager.get_control_text("tekton_grab") if SettingsManager else "G"
|
||||||
|
|
||||||
btn.add_child(shortcut_lbl)
|
btn.add_child(shortcut_lbl)
|
||||||
|
|
||||||
@@ -387,14 +410,12 @@ func _on_button_released(button_name: String):
|
|||||||
tween.tween_property(btn, "scale", Vector2(1.0, 1.0), 0.1)
|
tween.tween_property(btn, "scale", Vector2(1.0, 1.0), 0.1)
|
||||||
|
|
||||||
func _on_settings_pressed():
|
func _on_settings_pressed():
|
||||||
# Open settings panel in main scene
|
# Toggle pause menu on main scene
|
||||||
if main_scene:
|
if main_scene and main_scene.has_method("_toggle_pause_menu"):
|
||||||
var settings_panel = main_scene.get_node_or_null("SettingsPanel")
|
main_scene._toggle_pause_menu()
|
||||||
if settings_panel:
|
print("[TouchControls] Toggling pause menu")
|
||||||
settings_panel.visible = true
|
else:
|
||||||
print("[TouchControls] Opening settings panel")
|
print("[TouchControls] Main scene _toggle_pause_menu method not found")
|
||||||
else:
|
|
||||||
print("[TouchControls] SettingsPanel not found in main scene")
|
|
||||||
|
|
||||||
func _is_touch_device() -> bool:
|
func _is_touch_device() -> bool:
|
||||||
# Check if running on mobile
|
# Check if running on mobile
|
||||||
|
|||||||
Reference in New Issue
Block a user