feat: Implement powerup inventory UI, settings menu, and foundational managers for input and game settings.

This commit is contained in:
Yogi Wiguna
2026-03-10 12:52:53 +08:00
parent da7192ac07
commit e1e928389c
12 changed files with 723 additions and 98 deletions
+56 -31
View File
@@ -142,11 +142,26 @@ func _create_touch_ui():
tekton_grab_button = _find_or_create_action_button(actions_container, "TektonGrab", "👋", Vector2(-280, -80))
# Order: AttackMode, SpawnBoost, Grab
if attack_mode_button: actions_container.move_child(attack_mode_button, 0)
if spawn_boost_button: actions_container.move_child(spawn_boost_button, 1)
if grab_button: actions_container.move_child(grab_button, 2)
if tekton_grab_button: actions_container.move_child(tekton_grab_button, 3)
# Order: AttackMode, SpawnBoost, Grab, TektonGrab
if attack_mode_button:
actions_container.move_child(attack_mode_button, 0)
attack_mode_button.icon = load("res://assets/graphics/touch_control/attack_mode.png")
attack_mode_button.expand_icon = true
if spawn_boost_button:
actions_container.move_child(spawn_boost_button, 1)
spawn_boost_button.icon = load("res://assets/graphics/touch_control/spawn_tile.png")
spawn_boost_button.expand_icon = true
if grab_button:
actions_container.move_child(grab_button, 2)
grab_button.icon = load("res://assets/graphics/touch_control/take_tile.png")
grab_button.expand_icon = true
if tekton_grab_button:
actions_container.move_child(tekton_grab_button, 3)
tekton_grab_button.icon = load("res://assets/graphics/touch_control/grab_tekton.png")
tekton_grab_button.expand_icon = true
# Hide Put Button
if put_button:
@@ -391,6 +406,7 @@ func _load_settings():
var err = config.load(CONFIG_PATH)
if err != OK:
print("[TouchControls] No saved settings found, using defaults")
_apply_settings() # Apply default settings immediately
return
# Load settings values
@@ -439,46 +455,55 @@ func _apply_settings():
# Apply joystick visibility
if virtual_joystick:
virtual_joystick.visible = joystick_enabled
# Apply touch buttons visibility - FORCED ON per request to "just show them"
if actions_container:
actions_container.visible = true
actions_container.set_anchors_preset(Control.PRESET_FULL_RECT)
actions_container.mouse_filter = Control.MOUSE_FILTER_PASS
# Apply touch buttons visibility - dependent on master joystick_enabled switch
# If joystick is disabled, ALL touch controls are hidden
# Note: We ignore touch_buttons_enabled here to ensure "Enable Virtual Joystick" shows EVERYTHING as requested
var buttons_visible = joystick_enabled
var buttons_visible = true
print("[TouchControls] Applying settings: JoystickEnabled=", joystick_enabled, " ButtonsVisible=", buttons_visible)
print("[TouchControls] Applying settings: ButtonsVisible=", buttons_visible)
if grab_button:
grab_button.visible = buttons_visible
grab_button.visible = false
grab_button.scale = Vector2(button_scale, button_scale)
# Use offsets for anchored controls, not position
# grab_button.offset_left = button_positions.grab.x
# grab_button.offset_top = button_positions.grab.y
# grab_button.offset_right = button_positions.grab.x + button_size
# grab_button.offset_bottom = button_positions.grab.y + button_size
grab_button.set_anchors_preset(Control.PRESET_BOTTOM_RIGHT)
grab_button.offset_left = button_positions.grab.x
grab_button.offset_top = button_positions.grab.y
grab_button.offset_right = button_positions.grab.x + button_size
grab_button.offset_bottom = button_positions.grab.y + button_size
if put_button:
put_button.visible = false # Always INTENTIONALLY HIDDEN per request
# put_button.scale = Vector2(button_scale, button_scale)
# put_button.offset_left = button_positions.put.x
# put_button.offset_top = button_positions.put.y
# put_button.offset_right = button_positions.put.x + button_size
# put_button.offset_bottom = button_positions.put.y + button_size
if attack_mode_button:
attack_mode_button.visible = buttons_visible
attack_mode_button.visible = true
attack_mode_button.scale = Vector2(button_scale, button_scale)
# attack_mode_button.offset_left = button_positions.attack_mode.x
# attack_mode_button.offset_top = button_positions.attack_mode.y
# attack_mode_button.offset_right = button_positions.attack_mode.x + button_size
# attack_mode_button.offset_bottom = button_positions.attack_mode.y + button_size
attack_mode_button.set_anchors_preset(Control.PRESET_BOTTOM_RIGHT)
attack_mode_button.offset_left = button_positions.attack_mode.x
attack_mode_button.offset_top = button_positions.attack_mode.y
attack_mode_button.offset_right = button_positions.attack_mode.x + button_size
attack_mode_button.offset_bottom = button_positions.attack_mode.y + button_size
if spawn_boost_button:
spawn_boost_button.visible = buttons_visible
spawn_boost_button.visible = true
spawn_boost_button.scale = Vector2(button_scale, button_scale)
# spawn_boost_button.offset_left = button_positions.spawn_boost.x
# spawn_boost_button.offset_top = button_positions.spawn_boost.y
# spawn_boost_button.offset_right = button_positions.spawn_boost.x + button_size
# spawn_boost_button.offset_bottom = button_positions.spawn_boost.y + button_size
spawn_boost_button.set_anchors_preset(Control.PRESET_BOTTOM_RIGHT)
spawn_boost_button.offset_left = button_positions.spawn_boost.x
spawn_boost_button.offset_top = button_positions.spawn_boost.y
spawn_boost_button.offset_right = button_positions.spawn_boost.x + button_size
spawn_boost_button.offset_bottom = button_positions.spawn_boost.y + button_size
if tekton_grab_button:
tekton_grab_button.visible = true
tekton_grab_button.scale = Vector2(button_scale, button_scale)
tekton_grab_button.set_anchors_preset(Control.PRESET_BOTTOM_RIGHT)
tekton_grab_button.offset_left = -280
tekton_grab_button.offset_top = -80
tekton_grab_button.offset_right = -280 + button_size
tekton_grab_button.offset_bottom = -80 + button_size
# Force layer update
visible = true