feat: Implement powerup inventory UI, settings menu, and foundational managers for input and game settings.
This commit is contained in:
@@ -8,11 +8,16 @@ var icon_containers: Dictionary = {} # { EffectEnum: Button }
|
||||
# Local State
|
||||
var selected_effect: int = -1
|
||||
var special_manager_ref: Node = null # Reference to SpecialTilesManager
|
||||
@onready var SettingsManager = get_node_or_null("/root/SettingsManager")
|
||||
|
||||
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)
|
||||
# Map Effect Enum to UI Nodes (Assumes specific names in main.tscn)
|
||||
# We try to get them immediately. If they are children, they should be accessible.
|
||||
var container = get_node_or_null("Container")
|
||||
@@ -54,8 +59,13 @@ func _ready():
|
||||
if freeze_btn: freeze_btn.visible = true
|
||||
_update_shortcuts_for_mode(false)
|
||||
|
||||
|
||||
print("[PowerUpUI] UI Initialization Complete. Mapped %d buttons." % icon_containers.size())
|
||||
|
||||
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 _setup_btn(effect_id: int, btn: Button):
|
||||
if not btn:
|
||||
print("[PowerUpUI] Warning: Button for effect %d is null" % effect_id)
|
||||
@@ -138,15 +148,15 @@ func _update_btn_shortcut(effect_id: int, btn: Button):
|
||||
var key_text = ""
|
||||
if is_sng:
|
||||
match effect_id:
|
||||
0: key_text = "1" # Speed
|
||||
3: key_text = "2" # Ghost
|
||||
_: key_text = "" # Others hidden/disabled
|
||||
0: key_text = SettingsManager.get_control_text("powerup_1")
|
||||
3: key_text = SettingsManager.get_control_text("powerup_2") # Map P2 to Slot 3 (Ghost) in SNG
|
||||
_: key_text = ""
|
||||
else:
|
||||
match effect_id:
|
||||
0: key_text = "1" # Speed
|
||||
2: key_text = "2" # Wall
|
||||
1: key_text = "3" # Freeze
|
||||
3: key_text = "4" # Ghost
|
||||
0: key_text = SettingsManager.get_control_text("powerup_1")
|
||||
2: key_text = SettingsManager.get_control_text("powerup_2")
|
||||
1: key_text = SettingsManager.get_control_text("powerup_3")
|
||||
3: key_text = SettingsManager.get_control_text("powerup_4")
|
||||
|
||||
sc_lbl.text = key_text
|
||||
|
||||
|
||||
Reference in New Issue
Block a user