feat : mobile input controller
This commit is contained in:
@@ -24,15 +24,18 @@ signal effect_selected(effect: int)
|
||||
func _ready():
|
||||
print("[PowerUpUI] _ready called")
|
||||
|
||||
# Connect to SettingsManager to update labels
|
||||
if SettingsManager and not SettingsManager.control_remapped.is_connected(_on_control_remapped):
|
||||
SettingsManager.control_remapped.connect(_on_control_remapped)
|
||||
# Connect to SettingsManager to update labels on rebind OR controller toggle
|
||||
if SettingsManager:
|
||||
if not SettingsManager.control_remapped.is_connected(_on_control_remapped):
|
||||
SettingsManager.control_remapped.connect(_on_control_remapped)
|
||||
if not SettingsManager.settings_applied.is_connected(_on_control_remapped_refresh):
|
||||
SettingsManager.settings_applied.connect(_on_control_remapped_refresh)
|
||||
|
||||
# New Single Button UI
|
||||
power_up_button = get_node_or_null("PowerUpBtn")
|
||||
# New Single Button UI (moved to InteractionBtn)
|
||||
power_up_button = get_node_or_null("../InteractionBtn/PowerUpBtn")
|
||||
if not power_up_button:
|
||||
# Fallback to Container/PowerUpBtn just in case
|
||||
power_up_button = get_node_or_null("Container/PowerUpBtn")
|
||||
# Fallback just in case
|
||||
power_up_button = get_node_or_null("PowerUpBtn")
|
||||
|
||||
if not power_up_button:
|
||||
print("[PowerUpUI] ERROR: PowerUpBtn not found")
|
||||
@@ -51,6 +54,10 @@ func _on_control_remapped(_action: String, _key: int):
|
||||
# Refresh all labels
|
||||
_update_shortcuts_for_mode(LobbyManager.is_game_mode(GameMode.Mode.STOP_N_GO))
|
||||
|
||||
func _on_control_remapped_refresh():
|
||||
"""Called when settings_applied fires (e.g. use_controller toggled)."""
|
||||
_update_shortcuts_for_mode(LobbyManager.is_game_mode(GameMode.Mode.STOP_N_GO))
|
||||
|
||||
func _setup_powerup_btn(btn: Button):
|
||||
# Start DISABLED
|
||||
btn.disabled = true
|
||||
@@ -105,7 +112,7 @@ func _update_btn_shortcut(btn: Button):
|
||||
return
|
||||
|
||||
# Show universal powerup shortcut
|
||||
sc_lbl.text = " %s " % SettingsManager.get_control_text("use_powerup")
|
||||
sc_lbl.text = " %s " % SettingsManager.get_action_display("use_powerup")
|
||||
|
||||
func _on_btn_pressed(effect_id: int = -1):
|
||||
var target_effect = effect_id if effect_id != -1 else current_effect
|
||||
|
||||
Reference in New Issue
Block a user