feature/match3/move-gems (#7)
Reviewed-on: #7 Co-authored-by: Vladimir nett00n Budylnikov <git@nett00n.org> Co-committed-by: Vladimir nett00n Budylnikov <git@nett00n.org>
This commit is contained in:
@@ -1,71 +1,17 @@
|
||||
extends Control
|
||||
extends DebugMenuBase
|
||||
|
||||
@onready var regenerate_button: Button = $VBoxContainer/RegenerateButton
|
||||
@onready var gem_types_spinbox: SpinBox = $VBoxContainer/GemTypesContainer/GemTypesSpinBox
|
||||
@onready var gem_types_label: Label = $VBoxContainer/GemTypesContainer/GemTypesLabel
|
||||
@onready var grid_width_spinbox: SpinBox = $VBoxContainer/GridSizeContainer/GridWidthContainer/GridWidthSpinBox
|
||||
@onready var grid_height_spinbox: SpinBox = $VBoxContainer/GridSizeContainer/GridHeightContainer/GridHeightSpinBox
|
||||
@onready var grid_width_label: Label = $VBoxContainer/GridSizeContainer/GridWidthContainer/GridWidthLabel
|
||||
@onready var grid_height_label: Label = $VBoxContainer/GridSizeContainer/GridHeightContainer/GridHeightLabel
|
||||
|
||||
var match3_scene: Node2D
|
||||
var search_timer: Timer
|
||||
|
||||
# Fixed: Add cleanup function
|
||||
func _exit_tree():
|
||||
if search_timer:
|
||||
search_timer.queue_free()
|
||||
|
||||
func _ready():
|
||||
DebugManager.debug_toggled.connect(_on_debug_toggled)
|
||||
|
||||
# Initialize with current debug state
|
||||
var current_debug_state = DebugManager.is_debug_enabled()
|
||||
visible = current_debug_state
|
||||
regenerate_button.pressed.connect(_on_regenerate_pressed)
|
||||
gem_types_spinbox.value_changed.connect(_on_gem_types_changed)
|
||||
grid_width_spinbox.value_changed.connect(_on_grid_width_changed)
|
||||
grid_height_spinbox.value_changed.connect(_on_grid_height_changed)
|
||||
|
||||
# Initialize gem types spinbox
|
||||
gem_types_spinbox.min_value = 3
|
||||
gem_types_spinbox.max_value = 8
|
||||
gem_types_spinbox.step = 1
|
||||
gem_types_spinbox.value = 5 # Default value
|
||||
|
||||
# Initialize grid size spinboxes
|
||||
grid_width_spinbox.min_value = 4
|
||||
grid_width_spinbox.max_value = 12
|
||||
grid_width_spinbox.step = 1
|
||||
grid_width_spinbox.value = 8 # Default value
|
||||
|
||||
grid_height_spinbox.min_value = 4
|
||||
grid_height_spinbox.max_value = 12
|
||||
grid_height_spinbox.step = 1
|
||||
grid_height_spinbox.value = 8 # Default value
|
||||
|
||||
# Fixed: Create timer for periodic match3 scene search
|
||||
search_timer = Timer.new()
|
||||
search_timer.wait_time = 0.1
|
||||
search_timer.timeout.connect(_find_match3_scene)
|
||||
add_child(search_timer)
|
||||
|
||||
# Start searching immediately and continue until found
|
||||
_find_match3_scene()
|
||||
|
||||
func _find_match3_scene():
|
||||
func _find_target_scene():
|
||||
# Fixed: Search more thoroughly for match3 scene
|
||||
if match3_scene:
|
||||
# Already found, stop searching
|
||||
if search_timer and search_timer.timeout.is_connected(_find_match3_scene):
|
||||
search_timer.stop()
|
||||
_stop_search_timer()
|
||||
return
|
||||
|
||||
# Search in current scene tree
|
||||
var current_scene = get_tree().current_scene
|
||||
if current_scene:
|
||||
# Try to find match3 by class name first
|
||||
match3_scene = _find_node_by_script(current_scene, "res://scenes/game/gameplays/match3_gameplay.gd")
|
||||
# Try to find match3 by script path first
|
||||
match3_scene = _find_node_by_script(current_scene, target_script_path)
|
||||
|
||||
# Fallback: search by common node names
|
||||
if not match3_scene:
|
||||
@@ -75,132 +21,9 @@ func _find_match3_scene():
|
||||
break
|
||||
|
||||
if match3_scene:
|
||||
print("Debug: Found match3 scene: ", match3_scene.name)
|
||||
# Update UI with current values
|
||||
if match3_scene.has_method("get") and "TILE_TYPES" in match3_scene:
|
||||
gem_types_spinbox.value = match3_scene.TILE_TYPES
|
||||
gem_types_label.text = "Gem Types: " + str(match3_scene.TILE_TYPES)
|
||||
|
||||
# Update grid size values
|
||||
if "GRID_SIZE" in match3_scene:
|
||||
var grid_size = match3_scene.GRID_SIZE
|
||||
grid_width_spinbox.value = grid_size.x
|
||||
grid_height_spinbox.value = grid_size.y
|
||||
grid_width_label.text = "Width: " + str(grid_size.x)
|
||||
grid_height_label.text = "Height: " + str(grid_size.y)
|
||||
|
||||
# Stop the search timer
|
||||
if search_timer and search_timer.timeout.is_connected(_find_match3_scene):
|
||||
search_timer.stop()
|
||||
DebugManager.log_debug("Found match3 scene: " + match3_scene.name, log_category)
|
||||
_update_ui_from_scene()
|
||||
_stop_search_timer()
|
||||
else:
|
||||
# Continue searching if not found
|
||||
if search_timer and not search_timer.timeout.is_connected(_find_match3_scene):
|
||||
search_timer.timeout.connect(_find_match3_scene)
|
||||
search_timer.start()
|
||||
|
||||
func _find_node_by_script(node: Node, script_path: String) -> Node:
|
||||
# Helper function to find node by its script path
|
||||
if node.get_script():
|
||||
var node_script = node.get_script()
|
||||
if node_script.resource_path == script_path:
|
||||
return node
|
||||
|
||||
for child in node.get_children():
|
||||
var result = _find_node_by_script(child, script_path)
|
||||
if result:
|
||||
return result
|
||||
|
||||
return null
|
||||
|
||||
func _on_debug_toggled(enabled: bool):
|
||||
visible = enabled
|
||||
if enabled:
|
||||
# Always refresh match3 scene reference when debug menu opens
|
||||
if not match3_scene:
|
||||
_find_match3_scene()
|
||||
# Update display values
|
||||
if match3_scene and match3_scene.has_method("get") and "TILE_TYPES" in match3_scene:
|
||||
gem_types_spinbox.value = match3_scene.TILE_TYPES
|
||||
gem_types_label.text = "Gem Types: " + str(match3_scene.TILE_TYPES)
|
||||
|
||||
# Update grid size display values
|
||||
if match3_scene and "GRID_SIZE" in match3_scene:
|
||||
var grid_size = match3_scene.GRID_SIZE
|
||||
grid_width_spinbox.value = grid_size.x
|
||||
grid_height_spinbox.value = grid_size.y
|
||||
grid_width_label.text = "Width: " + str(grid_size.x)
|
||||
grid_height_label.text = "Height: " + str(grid_size.y)
|
||||
|
||||
func _on_regenerate_pressed():
|
||||
if not match3_scene:
|
||||
_find_match3_scene()
|
||||
|
||||
if not match3_scene:
|
||||
print("Error: Could not find match3 scene for regeneration")
|
||||
return
|
||||
|
||||
if match3_scene.has_method("regenerate_grid"):
|
||||
print("Debug: Calling regenerate_grid()")
|
||||
await match3_scene.regenerate_grid()
|
||||
else:
|
||||
print("Error: match3_scene does not have regenerate_grid method")
|
||||
|
||||
func _on_gem_types_changed(value: float):
|
||||
if not match3_scene:
|
||||
_find_match3_scene()
|
||||
|
||||
if not match3_scene:
|
||||
print("Error: Could not find match3 scene for gem types change")
|
||||
return
|
||||
|
||||
var new_value = int(value)
|
||||
if match3_scene.has_method("set_tile_types"):
|
||||
print("Debug: Setting tile types to ", new_value)
|
||||
await match3_scene.set_tile_types(new_value)
|
||||
gem_types_label.text = "Gem Types: " + str(new_value)
|
||||
else:
|
||||
print("Error: match3_scene does not have set_tile_types method")
|
||||
# Fallback: try to set TILE_TYPES directly
|
||||
if "TILE_TYPES" in match3_scene:
|
||||
match3_scene.TILE_TYPES = new_value
|
||||
gem_types_label.text = "Gem Types: " + str(new_value)
|
||||
|
||||
func _on_grid_width_changed(value: float):
|
||||
if not match3_scene:
|
||||
_find_match3_scene()
|
||||
|
||||
if not match3_scene:
|
||||
print("Error: Could not find match3 scene for grid width change")
|
||||
return
|
||||
|
||||
var new_width = int(value)
|
||||
grid_width_label.text = "Width: " + str(new_width)
|
||||
|
||||
# Get current height
|
||||
var current_height = int(grid_height_spinbox.value)
|
||||
|
||||
if match3_scene.has_method("set_grid_size"):
|
||||
print("Debug: Setting grid size to ", new_width, "x", current_height)
|
||||
await match3_scene.set_grid_size(Vector2i(new_width, current_height))
|
||||
else:
|
||||
print("Error: match3_scene does not have set_grid_size method")
|
||||
|
||||
func _on_grid_height_changed(value: float):
|
||||
if not match3_scene:
|
||||
_find_match3_scene()
|
||||
|
||||
if not match3_scene:
|
||||
print("Error: Could not find match3 scene for grid height change")
|
||||
return
|
||||
|
||||
var new_height = int(value)
|
||||
grid_height_label.text = "Height: " + str(new_height)
|
||||
|
||||
# Get current width
|
||||
var current_width = int(grid_width_spinbox.value)
|
||||
|
||||
if match3_scene.has_method("set_grid_size"):
|
||||
print("Debug: Setting grid size to ", current_width, "x", new_height)
|
||||
await match3_scene.set_grid_size(Vector2i(current_width, new_height))
|
||||
else:
|
||||
print("Error: match3_scene does not have set_grid_size method")
|
||||
_start_search_timer()
|
||||
|
||||
1
scenes/ui/DebugMenu.gd.uid
Normal file
1
scenes/ui/DebugMenu.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://dlmd8q1avl3i0
|
||||
213
scenes/ui/DebugMenuBase.gd
Normal file
213
scenes/ui/DebugMenuBase.gd
Normal file
@@ -0,0 +1,213 @@
|
||||
class_name DebugMenuBase
|
||||
extends Control
|
||||
|
||||
@onready var regenerate_button: Button = $VBoxContainer/RegenerateButton
|
||||
@onready var gem_types_spinbox: SpinBox = $VBoxContainer/GemTypesContainer/GemTypesSpinBox
|
||||
@onready var gem_types_label: Label = $VBoxContainer/GemTypesContainer/GemTypesLabel
|
||||
@onready var grid_width_spinbox: SpinBox = $VBoxContainer/GridSizeContainer/GridWidthContainer/GridWidthSpinBox
|
||||
@onready var grid_height_spinbox: SpinBox = $VBoxContainer/GridSizeContainer/GridHeightContainer/GridHeightSpinBox
|
||||
@onready var grid_width_label: Label = $VBoxContainer/GridSizeContainer/GridWidthContainer/GridWidthLabel
|
||||
@onready var grid_height_label: Label = $VBoxContainer/GridSizeContainer/GridHeightContainer/GridHeightLabel
|
||||
|
||||
@export var target_script_path: String = "res://scenes/game/gameplays/match3_gameplay.gd"
|
||||
@export var log_category: String = "DebugMenu"
|
||||
|
||||
var match3_scene: Node2D
|
||||
var search_timer: Timer
|
||||
|
||||
func _exit_tree():
|
||||
if search_timer:
|
||||
search_timer.queue_free()
|
||||
|
||||
func _ready():
|
||||
DebugManager.log_debug("DebugMenuBase _ready() called", log_category)
|
||||
DebugManager.debug_toggled.connect(_on_debug_toggled)
|
||||
|
||||
# Initialize with current debug state
|
||||
var current_debug_state = DebugManager.is_debug_enabled()
|
||||
visible = current_debug_state
|
||||
|
||||
# Connect signals
|
||||
regenerate_button.pressed.connect(_on_regenerate_pressed)
|
||||
gem_types_spinbox.value_changed.connect(_on_gem_types_changed)
|
||||
grid_width_spinbox.value_changed.connect(_on_grid_width_changed)
|
||||
grid_height_spinbox.value_changed.connect(_on_grid_height_changed)
|
||||
|
||||
# Initialize spinbox values with validation
|
||||
_initialize_spinboxes()
|
||||
|
||||
# Set up scene finding
|
||||
_setup_scene_finding()
|
||||
|
||||
# Start searching for target scene
|
||||
_find_target_scene()
|
||||
|
||||
func _initialize_spinboxes():
|
||||
# Initialize gem types spinbox
|
||||
gem_types_spinbox.min_value = 3
|
||||
gem_types_spinbox.max_value = 8
|
||||
gem_types_spinbox.step = 1
|
||||
gem_types_spinbox.value = 5 # Default value
|
||||
|
||||
# Initialize grid size spinboxes
|
||||
grid_width_spinbox.min_value = 4
|
||||
grid_width_spinbox.max_value = 12
|
||||
grid_width_spinbox.step = 1
|
||||
grid_width_spinbox.value = 8 # Default value
|
||||
|
||||
grid_height_spinbox.min_value = 4
|
||||
grid_height_spinbox.max_value = 12
|
||||
grid_height_spinbox.step = 1
|
||||
grid_height_spinbox.value = 8 # Default value
|
||||
|
||||
func _setup_scene_finding():
|
||||
# Create timer for periodic scene search
|
||||
search_timer = Timer.new()
|
||||
search_timer.wait_time = 0.1
|
||||
search_timer.timeout.connect(_find_target_scene)
|
||||
add_child(search_timer)
|
||||
|
||||
# Virtual method - override in derived classes for specific finding logic
|
||||
func _find_target_scene():
|
||||
DebugManager.log_error("_find_target_scene() not implemented in derived class", log_category)
|
||||
|
||||
func _find_node_by_script(node: Node, script_path: String) -> Node:
|
||||
# Helper function to find node by its script path
|
||||
if not node:
|
||||
return null
|
||||
|
||||
if node.get_script():
|
||||
var node_script = node.get_script()
|
||||
if node_script.resource_path == script_path:
|
||||
return node
|
||||
|
||||
for child in node.get_children():
|
||||
var result = _find_node_by_script(child, script_path)
|
||||
if result:
|
||||
return result
|
||||
|
||||
return null
|
||||
|
||||
func _update_ui_from_scene():
|
||||
if not match3_scene:
|
||||
return
|
||||
|
||||
# Update gem types display
|
||||
if match3_scene.has_method("get") and "TILE_TYPES" in match3_scene:
|
||||
gem_types_spinbox.value = match3_scene.TILE_TYPES
|
||||
gem_types_label.text = "Gem Types: " + str(match3_scene.TILE_TYPES)
|
||||
|
||||
# Update grid size display
|
||||
if "GRID_SIZE" in match3_scene:
|
||||
var grid_size = match3_scene.GRID_SIZE
|
||||
grid_width_spinbox.value = grid_size.x
|
||||
grid_height_spinbox.value = grid_size.y
|
||||
grid_width_label.text = "Width: " + str(grid_size.x)
|
||||
grid_height_label.text = "Height: " + str(grid_size.y)
|
||||
|
||||
func _stop_search_timer():
|
||||
if search_timer and search_timer.timeout.is_connected(_find_target_scene):
|
||||
search_timer.stop()
|
||||
|
||||
func _start_search_timer():
|
||||
if search_timer and not search_timer.timeout.is_connected(_find_target_scene):
|
||||
search_timer.timeout.connect(_find_target_scene)
|
||||
search_timer.start()
|
||||
|
||||
func _on_debug_toggled(enabled: bool):
|
||||
DebugManager.log_debug("Debug toggled to " + str(enabled), log_category)
|
||||
visible = enabled
|
||||
if enabled:
|
||||
# Always refresh scene reference when debug menu opens
|
||||
if not match3_scene:
|
||||
_find_target_scene()
|
||||
_update_ui_from_scene()
|
||||
|
||||
func _on_regenerate_pressed():
|
||||
if not match3_scene:
|
||||
_find_target_scene()
|
||||
|
||||
if not match3_scene:
|
||||
DebugManager.log_error("Could not find target scene for regeneration", log_category)
|
||||
return
|
||||
|
||||
if match3_scene.has_method("regenerate_grid"):
|
||||
DebugManager.log_debug("Calling regenerate_grid()", log_category)
|
||||
await match3_scene.regenerate_grid()
|
||||
else:
|
||||
DebugManager.log_error("Target scene does not have regenerate_grid method", log_category)
|
||||
|
||||
func _on_gem_types_changed(value: float):
|
||||
if not match3_scene:
|
||||
_find_target_scene()
|
||||
|
||||
if not match3_scene:
|
||||
DebugManager.log_error("Could not find target scene for gem types change", log_category)
|
||||
return
|
||||
|
||||
var new_value = int(value)
|
||||
# Input validation
|
||||
if new_value < gem_types_spinbox.min_value or new_value > gem_types_spinbox.max_value:
|
||||
DebugManager.log_error("Invalid gem types value: %d (range: %d-%d)" % [new_value, gem_types_spinbox.min_value, gem_types_spinbox.max_value], log_category)
|
||||
return
|
||||
|
||||
if match3_scene.has_method("set_tile_types"):
|
||||
DebugManager.log_debug("Setting tile types to " + str(new_value), log_category)
|
||||
await match3_scene.set_tile_types(new_value)
|
||||
gem_types_label.text = "Gem Types: " + str(new_value)
|
||||
else:
|
||||
DebugManager.log_error("Target scene does not have set_tile_types method", log_category)
|
||||
# Fallback: try to set TILE_TYPES directly
|
||||
if "TILE_TYPES" in match3_scene:
|
||||
match3_scene.TILE_TYPES = new_value
|
||||
gem_types_label.text = "Gem Types: " + str(new_value)
|
||||
|
||||
func _on_grid_width_changed(value: float):
|
||||
if not match3_scene:
|
||||
_find_target_scene()
|
||||
|
||||
if not match3_scene:
|
||||
DebugManager.log_error("Could not find target scene for grid width change", log_category)
|
||||
return
|
||||
|
||||
var new_width = int(value)
|
||||
# Input validation
|
||||
if new_width < grid_width_spinbox.min_value or new_width > grid_width_spinbox.max_value:
|
||||
DebugManager.log_error("Invalid grid width value: %d (range: %d-%d)" % [new_width, grid_width_spinbox.min_value, grid_width_spinbox.max_value], log_category)
|
||||
return
|
||||
|
||||
grid_width_label.text = "Width: " + str(new_width)
|
||||
|
||||
# Get current height
|
||||
var current_height = int(grid_height_spinbox.value)
|
||||
|
||||
if match3_scene.has_method("set_grid_size"):
|
||||
DebugManager.log_debug("Setting grid size to " + str(new_width) + "x" + str(current_height), log_category)
|
||||
await match3_scene.set_grid_size(Vector2i(new_width, current_height))
|
||||
else:
|
||||
DebugManager.log_error("Target scene does not have set_grid_size method", log_category)
|
||||
|
||||
func _on_grid_height_changed(value: float):
|
||||
if not match3_scene:
|
||||
_find_target_scene()
|
||||
|
||||
if not match3_scene:
|
||||
DebugManager.log_error("Could not find target scene for grid height change", log_category)
|
||||
return
|
||||
|
||||
var new_height = int(value)
|
||||
# Input validation
|
||||
if new_height < grid_height_spinbox.min_value or new_height > grid_height_spinbox.max_value:
|
||||
DebugManager.log_error("Invalid grid height value: %d (range: %d-%d)" % [new_height, grid_height_spinbox.min_value, grid_height_spinbox.max_value], log_category)
|
||||
return
|
||||
|
||||
grid_height_label.text = "Height: " + str(new_height)
|
||||
|
||||
# Get current width
|
||||
var current_width = int(grid_width_spinbox.value)
|
||||
|
||||
if match3_scene.has_method("set_grid_size"):
|
||||
DebugManager.log_debug("Setting grid size to " + str(current_width) + "x" + str(new_height), log_category)
|
||||
await match3_scene.set_grid_size(Vector2i(current_width, new_height))
|
||||
else:
|
||||
DebugManager.log_error("Target scene does not have set_grid_size method", log_category)
|
||||
1
scenes/ui/DebugMenuBase.gd.uid
Normal file
1
scenes/ui/DebugMenuBase.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://caijijnegkqsq
|
||||
1
scenes/ui/DebugToggle.gd.uid
Normal file
1
scenes/ui/DebugToggle.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://cvnkl25wmj811
|
||||
@@ -2,20 +2,78 @@ extends Control
|
||||
|
||||
signal open_settings
|
||||
|
||||
@onready var menu_buttons: Array[Button] = []
|
||||
var current_menu_index: int = 0
|
||||
var original_button_scales: Array[Vector2] = []
|
||||
|
||||
func _ready():
|
||||
print("MainMenu ready")
|
||||
DebugManager.log_info("MainMenu ready", "MainMenu")
|
||||
_setup_menu_navigation()
|
||||
|
||||
func _on_new_game_button_pressed():
|
||||
AudioManager.play_ui_click()
|
||||
print("New Game pressed")
|
||||
DebugManager.log_info("New Game pressed", "MainMenu")
|
||||
GameManager.start_new_game()
|
||||
|
||||
func _on_settings_button_pressed():
|
||||
AudioManager.play_ui_click()
|
||||
print("Settings pressed")
|
||||
DebugManager.log_info("Settings pressed", "MainMenu")
|
||||
open_settings.emit()
|
||||
|
||||
func _on_exit_button_pressed():
|
||||
AudioManager.play_ui_click()
|
||||
print("Exit pressed")
|
||||
DebugManager.log_info("Exit pressed", "MainMenu")
|
||||
get_tree().quit()
|
||||
|
||||
func _setup_menu_navigation():
|
||||
menu_buttons.clear()
|
||||
original_button_scales.clear()
|
||||
|
||||
menu_buttons.append($MenuContainer/NewGameButton)
|
||||
menu_buttons.append($MenuContainer/SettingsButton)
|
||||
menu_buttons.append($MenuContainer/ExitButton)
|
||||
|
||||
for button in menu_buttons:
|
||||
original_button_scales.append(button.scale)
|
||||
|
||||
_update_visual_selection()
|
||||
|
||||
func _input(event: InputEvent) -> void:
|
||||
if event.is_action_pressed("move_up"):
|
||||
_navigate_menu(-1)
|
||||
elif event.is_action_pressed("move_down"):
|
||||
_navigate_menu(1)
|
||||
elif event.is_action_pressed("action_south"):
|
||||
_activate_current_button()
|
||||
elif event.is_action_pressed("options_menu"):
|
||||
AudioManager.play_ui_click()
|
||||
DebugManager.log_info("Options menu shortcut pressed", "MainMenu")
|
||||
open_settings.emit()
|
||||
elif event.is_action_pressed("quit_game"):
|
||||
AudioManager.play_ui_click()
|
||||
DebugManager.log_info("Quit game shortcut pressed", "MainMenu")
|
||||
get_tree().quit()
|
||||
|
||||
func _navigate_menu(direction: int):
|
||||
AudioManager.play_ui_click()
|
||||
current_menu_index = (current_menu_index + direction) % menu_buttons.size()
|
||||
if current_menu_index < 0:
|
||||
current_menu_index = menu_buttons.size() - 1
|
||||
_update_visual_selection()
|
||||
DebugManager.log_info("Menu navigation: index " + str(current_menu_index), "MainMenu")
|
||||
|
||||
func _activate_current_button():
|
||||
if current_menu_index >= 0 and current_menu_index < menu_buttons.size():
|
||||
var button = menu_buttons[current_menu_index]
|
||||
DebugManager.log_info("Activating button via keyboard/gamepad: " + button.text, "MainMenu")
|
||||
button.pressed.emit()
|
||||
|
||||
func _update_visual_selection():
|
||||
for i in range(menu_buttons.size()):
|
||||
var button = menu_buttons[i]
|
||||
if i == current_menu_index:
|
||||
button.scale = original_button_scales[i] * 1.1
|
||||
button.modulate = Color(1.2, 1.2, 1.0)
|
||||
else:
|
||||
button.scale = original_button_scales[i]
|
||||
button.modulate = Color.WHITE
|
||||
|
||||
1
scenes/ui/MainMenu.gd.uid
Normal file
1
scenes/ui/MainMenu.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://b2x0kw8f70s8q
|
||||
@@ -1,7 +1,7 @@
|
||||
[gd_scene load_steps=3 format=3 uid="uid://m8lf3eh3al5j"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://b2c35v0f6rymd" path="res://scenes/ui/MainMenu.gd" id="1_b00nv"]
|
||||
[ext_resource type="PackedScene" path="res://scenes/ui/DebugToggle.tscn" id="2_debug"]
|
||||
[ext_resource type="Script" uid="uid://b2x0kw8f70s8q" path="res://scenes/ui/MainMenu.gd" id="1_b00nv"]
|
||||
[ext_resource type="PackedScene" uid="uid://df2b4wn8j6cxl" path="res://scenes/ui/DebugToggle.tscn" id="2_debug"]
|
||||
|
||||
[node name="MainMenu" type="Control"]
|
||||
layout_mode = 3
|
||||
|
||||
@@ -5,17 +5,22 @@ signal back_to_main_menu
|
||||
@onready var master_slider = $SettingsContainer/MasterVolumeContainer/MasterVolumeSlider
|
||||
@onready var music_slider = $SettingsContainer/MusicVolumeContainer/MusicVolumeSlider
|
||||
@onready var sfx_slider = $SettingsContainer/SFXVolumeContainer/SFXVolumeSlider
|
||||
@onready var language_selector = $SettingsContainer/LanguageContainer/LanguageSelector
|
||||
@onready var language_stepper = $SettingsContainer/LanguageContainer/LanguageStepper
|
||||
|
||||
@export var settings_manager: Node = SettingsManager
|
||||
@export var localization_manager: Node = LocalizationManager
|
||||
|
||||
var language_codes = []
|
||||
|
||||
# Navigation system variables
|
||||
var navigable_controls: Array[Control] = []
|
||||
var current_control_index: int = 0
|
||||
var original_control_scales: Array[Vector2] = []
|
||||
var original_control_modulates: Array[Color] = []
|
||||
|
||||
func _ready():
|
||||
add_to_group("localizable")
|
||||
print("SettingsMenu ready")
|
||||
setup_language_selector()
|
||||
DebugManager.log_info("SettingsMenu ready", "Settings")
|
||||
# Language selector is initialized automatically
|
||||
|
||||
var master_callback = _on_volume_slider_changed.bind("master_volume")
|
||||
if not master_slider.value_changed.is_connected(master_callback):
|
||||
@@ -29,63 +34,76 @@ func _ready():
|
||||
if not sfx_slider.value_changed.is_connected(sfx_callback):
|
||||
sfx_slider.value_changed.connect(sfx_callback)
|
||||
|
||||
if not language_selector.item_selected.is_connected(Callable(self, "_on_language_selector_item_selected")):
|
||||
language_selector.item_selected.connect(_on_language_selector_item_selected)
|
||||
# Language stepper connections are handled in the .tscn file
|
||||
|
||||
_update_controls_from_settings()
|
||||
update_text()
|
||||
_setup_navigation_system()
|
||||
|
||||
func _update_controls_from_settings():
|
||||
master_slider.value = settings_manager.get_setting("master_volume")
|
||||
music_slider.value = settings_manager.get_setting("music_volume")
|
||||
sfx_slider.value = settings_manager.get_setting("sfx_volume")
|
||||
|
||||
var current_lang = settings_manager.get_setting("language")
|
||||
var lang_index = language_codes.find(current_lang)
|
||||
if lang_index >= 0:
|
||||
language_selector.selected = lang_index
|
||||
# Language display is handled by the ValueStepper component
|
||||
|
||||
func _on_volume_slider_changed(value, setting_key):
|
||||
settings_manager.set_setting(setting_key, value)
|
||||
# Input validation for volume settings
|
||||
if not setting_key in ["master_volume", "music_volume", "sfx_volume"]:
|
||||
DebugManager.log_error("Invalid volume setting key: " + str(setting_key), "Settings")
|
||||
return
|
||||
|
||||
if not (value is float or value is int):
|
||||
DebugManager.log_error("Invalid volume value type: " + str(typeof(value)), "Settings")
|
||||
return
|
||||
|
||||
# Clamp value to valid range
|
||||
var clamped_value = clamp(float(value), 0.0, 1.0)
|
||||
if clamped_value != value:
|
||||
DebugManager.log_warn("Volume value %f clamped to %f" % [value, clamped_value], "Settings")
|
||||
|
||||
if not settings_manager.set_setting(setting_key, clamped_value):
|
||||
DebugManager.log_error("Failed to set volume setting: " + setting_key, "Settings")
|
||||
|
||||
func _exit_settings():
|
||||
print("Exiting settings")
|
||||
DebugManager.log_info("Exiting settings", "Settings")
|
||||
settings_manager.save_settings()
|
||||
back_to_main_menu.emit()
|
||||
|
||||
func _input(event):
|
||||
if event.is_action_pressed("ui_cancel") or event.is_action_pressed("ui_menu_toggle"):
|
||||
print("ESC pressed in settings")
|
||||
if event.is_action_pressed("action_east") or event.is_action_pressed("pause_menu"):
|
||||
DebugManager.log_debug("Cancel/back action pressed in settings", "Settings")
|
||||
_exit_settings()
|
||||
get_viewport().set_input_as_handled()
|
||||
return
|
||||
|
||||
# Vertical navigation between controls
|
||||
if event.is_action_pressed("move_up"):
|
||||
_navigate_controls(-1)
|
||||
get_viewport().set_input_as_handled()
|
||||
elif event.is_action_pressed("move_down"):
|
||||
_navigate_controls(1)
|
||||
get_viewport().set_input_as_handled()
|
||||
|
||||
# Horizontal navigation for current control
|
||||
elif event.is_action_pressed("move_left"):
|
||||
_adjust_current_control(-1)
|
||||
get_viewport().set_input_as_handled()
|
||||
elif event.is_action_pressed("move_right"):
|
||||
_adjust_current_control(1)
|
||||
get_viewport().set_input_as_handled()
|
||||
|
||||
# Activate current control
|
||||
elif event.is_action_pressed("action_south"):
|
||||
_activate_current_control()
|
||||
get_viewport().set_input_as_handled()
|
||||
|
||||
func _on_back_button_pressed():
|
||||
AudioManager.play_ui_click()
|
||||
print("Back button pressed")
|
||||
DebugManager.log_info("Back button pressed", "Settings")
|
||||
_exit_settings()
|
||||
|
||||
func setup_language_selector():
|
||||
var languages_data = settings_manager.get_languages_data()
|
||||
if languages_data.has("languages"):
|
||||
language_selector.clear()
|
||||
language_codes.clear()
|
||||
|
||||
for lang_code in languages_data.languages.keys():
|
||||
language_codes.append(lang_code)
|
||||
var display_name = languages_data.languages[lang_code]["display_name"]
|
||||
language_selector.add_item(display_name)
|
||||
|
||||
var current_lang = settings_manager.get_setting("language")
|
||||
var lang_index = language_codes.find(current_lang)
|
||||
if lang_index >= 0:
|
||||
language_selector.selected = lang_index
|
||||
|
||||
func _on_language_selector_item_selected(index: int):
|
||||
if index < language_codes.size():
|
||||
var selected_lang = language_codes[index]
|
||||
settings_manager.set_setting("language", selected_lang)
|
||||
print("Language changed to: ", selected_lang)
|
||||
localization_manager.change_language(selected_lang)
|
||||
|
||||
func update_text():
|
||||
$SettingsContainer/SettingsTitle.text = tr("settings_title")
|
||||
@@ -98,7 +116,105 @@ func update_text():
|
||||
|
||||
func _on_reset_setting_button_pressed() -> void:
|
||||
AudioManager.play_ui_click()
|
||||
print("Resetting settings")
|
||||
DebugManager.log_info("Resetting settings", "Settings")
|
||||
settings_manager.reset_settings_to_defaults()
|
||||
_update_controls_from_settings()
|
||||
localization_manager.change_language(settings_manager.get_setting("language"))
|
||||
|
||||
func _setup_navigation_system():
|
||||
navigable_controls.clear()
|
||||
original_control_scales.clear()
|
||||
original_control_modulates.clear()
|
||||
|
||||
# Add controls in navigation order
|
||||
navigable_controls.append(master_slider)
|
||||
navigable_controls.append(music_slider)
|
||||
navigable_controls.append(sfx_slider)
|
||||
navigable_controls.append(language_stepper) # Use the ValueStepper component
|
||||
navigable_controls.append($BackButtonContainer/BackButton)
|
||||
navigable_controls.append($ResetSettingsContainer/ResetSettingButton)
|
||||
|
||||
# Store original visual properties
|
||||
for control in navigable_controls:
|
||||
original_control_scales.append(control.scale)
|
||||
original_control_modulates.append(control.modulate)
|
||||
|
||||
_update_visual_selection()
|
||||
|
||||
func _navigate_controls(direction: int):
|
||||
AudioManager.play_ui_click()
|
||||
current_control_index = (current_control_index + direction) % navigable_controls.size()
|
||||
if current_control_index < 0:
|
||||
current_control_index = navigable_controls.size() - 1
|
||||
_update_visual_selection()
|
||||
DebugManager.log_info("Settings navigation: index " + str(current_control_index), "Settings")
|
||||
|
||||
func _adjust_current_control(direction: int):
|
||||
if current_control_index < 0 or current_control_index >= navigable_controls.size():
|
||||
return
|
||||
|
||||
var control = navigable_controls[current_control_index]
|
||||
|
||||
# Handle sliders
|
||||
if control is HSlider:
|
||||
var slider = control as HSlider
|
||||
var step = slider.step if slider.step > 0 else 0.1
|
||||
var new_value = slider.value + (direction * step)
|
||||
new_value = clamp(new_value, slider.min_value, slider.max_value)
|
||||
slider.value = new_value
|
||||
AudioManager.play_ui_click()
|
||||
DebugManager.log_info("Slider adjusted: %s = %f" % [_get_control_name(control), new_value], "Settings")
|
||||
|
||||
# Handle language stepper with left/right
|
||||
elif control == language_stepper:
|
||||
if language_stepper.handle_input_action("move_left" if direction == -1 else "move_right"):
|
||||
AudioManager.play_ui_click()
|
||||
|
||||
func _activate_current_control():
|
||||
if current_control_index < 0 or current_control_index >= navigable_controls.size():
|
||||
return
|
||||
|
||||
var control = navigable_controls[current_control_index]
|
||||
|
||||
# Handle buttons
|
||||
if control is Button:
|
||||
AudioManager.play_ui_click()
|
||||
DebugManager.log_info("Activating button via keyboard/gamepad: " + control.text, "Settings")
|
||||
control.pressed.emit()
|
||||
|
||||
# Handle language stepper (no action needed on activation, left/right handles it)
|
||||
elif control == language_stepper:
|
||||
DebugManager.log_info("Language stepper selected - use left/right to change", "Settings")
|
||||
|
||||
func _update_visual_selection():
|
||||
for i in range(navigable_controls.size()):
|
||||
var control = navigable_controls[i]
|
||||
if i == current_control_index:
|
||||
# Use the ValueStepper's built-in highlighting
|
||||
if control == language_stepper:
|
||||
language_stepper.set_highlighted(true)
|
||||
else:
|
||||
control.scale = original_control_scales[i] * 1.05
|
||||
control.modulate = Color(1.1, 1.1, 0.9)
|
||||
else:
|
||||
# Reset highlighting
|
||||
if control == language_stepper:
|
||||
language_stepper.set_highlighted(false)
|
||||
else:
|
||||
control.scale = original_control_scales[i]
|
||||
control.modulate = original_control_modulates[i]
|
||||
|
||||
func _get_control_name(control: Control) -> String:
|
||||
if control == master_slider:
|
||||
return "master_volume"
|
||||
elif control == music_slider:
|
||||
return "music_volume"
|
||||
elif control == sfx_slider:
|
||||
return "sfx_volume"
|
||||
elif control == language_stepper:
|
||||
return language_stepper.get_control_name()
|
||||
else:
|
||||
return "button"
|
||||
|
||||
func _on_language_stepper_value_changed(new_value: String, new_index: int):
|
||||
DebugManager.log_info("Language changed via ValueStepper: " + new_value + " (index: " + str(new_index) + ")", "Settings")
|
||||
|
||||
1
scenes/ui/SettingsMenu.gd.uid
Normal file
1
scenes/ui/SettingsMenu.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://dftenhuhwskqa
|
||||
@@ -1,7 +1,8 @@
|
||||
[gd_scene load_steps=3 format=3 uid="uid://57obmcwyos2g"]
|
||||
[gd_scene load_steps=4 format=3 uid="uid://57obmcwyos2g"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://bv56qwni68qo" path="res://scenes/ui/SettingsMenu.gd" id="1_oqkcn"]
|
||||
[ext_resource type="PackedScene" path="res://scenes/ui/DebugToggle.tscn" id="2_debug"]
|
||||
[ext_resource type="Script" uid="uid://dftenhuhwskqa" path="res://scenes/ui/SettingsMenu.gd" id="1_oqkcn"]
|
||||
[ext_resource type="PackedScene" uid="uid://df2b4wn8j6cxl" path="res://scenes/ui/DebugToggle.tscn" id="2_debug"]
|
||||
[ext_resource type="PackedScene" path="res://scenes/ui/components/ValueStepper.tscn" id="3_value_stepper"]
|
||||
|
||||
[node name="SettingsMenu" type="Control" groups=["localizable"]]
|
||||
layout_mode = 3
|
||||
@@ -85,21 +86,7 @@ custom_minimum_size = Vector2(150, 0)
|
||||
layout_mode = 2
|
||||
text = "Language"
|
||||
|
||||
[node name="LanguageSelector" type="OptionButton" parent="SettingsContainer/LanguageContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 4
|
||||
selected = 0
|
||||
item_count = 5
|
||||
popup/item_0/text = "English"
|
||||
popup/item_0/id = 0
|
||||
popup/item_1/text = "Español"
|
||||
popup/item_1/id = 1
|
||||
popup/item_2/text = "Français"
|
||||
popup/item_2/id = 2
|
||||
popup/item_3/text = "Deutsch"
|
||||
popup/item_3/id = 3
|
||||
popup/item_4/text = "Русский"
|
||||
popup/item_4/id = 2
|
||||
[node name="LanguageStepper" parent="SettingsContainer/LanguageContainer" instance=ExtResource("3_value_stepper")]
|
||||
|
||||
[node name="BackButtonContainer" type="Control" parent="."]
|
||||
layout_mode = 1
|
||||
@@ -148,6 +135,6 @@ layout_mode = 1
|
||||
[connection signal="value_changed" from="SettingsContainer/MasterVolumeContainer/MasterVolumeSlider" to="." method="_on_master_volume_changed"]
|
||||
[connection signal="value_changed" from="SettingsContainer/MusicVolumeContainer/MusicVolumeSlider" to="." method="_on_music_volume_changed"]
|
||||
[connection signal="value_changed" from="SettingsContainer/SFXVolumeContainer/SFXVolumeSlider" to="." method="_on_sfx_volume_changed"]
|
||||
[connection signal="item_selected" from="SettingsContainer/LanguageContainer/LanguageSelector" to="." method="_on_language_selector_item_selected"]
|
||||
[connection signal="value_changed" from="SettingsContainer/LanguageContainer/LanguageStepper" to="." method="_on_language_stepper_value_changed"]
|
||||
[connection signal="pressed" from="BackButtonContainer/BackButton" to="." method="_on_back_button_pressed"]
|
||||
[connection signal="pressed" from="ResetSettingsContainer/ResetSettingButton" to="." method="_on_reset_setting_button_pressed"]
|
||||
|
||||
190
scenes/ui/components/ValueStepper.gd
Normal file
190
scenes/ui/components/ValueStepper.gd
Normal file
@@ -0,0 +1,190 @@
|
||||
@tool
|
||||
extends Control
|
||||
class_name ValueStepper
|
||||
|
||||
## A reusable UI control for stepping through discrete values with arrow buttons
|
||||
##
|
||||
## ValueStepper provides left/right arrow navigation for cycling through predefined options.
|
||||
## Perfect for settings like language, resolution, difficulty, graphics quality, etc.
|
||||
## Supports both mouse clicks and keyboard/gamepad navigation.
|
||||
##
|
||||
## @tutorial(ValueStepper Usage): See docs/UI_COMPONENTS.md
|
||||
|
||||
signal value_changed(new_value: String, new_index: int)
|
||||
|
||||
@onready var left_button: Button = $LeftButton
|
||||
@onready var right_button: Button = $RightButton
|
||||
@onready var value_display: Label = $ValueDisplay
|
||||
|
||||
## The data source for values. Override this for custom implementations.
|
||||
@export var data_source: String = "language"
|
||||
## Custom display format function. Leave empty to use default.
|
||||
@export var custom_format_function: String = ""
|
||||
|
||||
var values: Array[String] = []
|
||||
var display_names: Array[String] = []
|
||||
var current_index: int = 0
|
||||
|
||||
var original_scale: Vector2
|
||||
var original_modulate: Color
|
||||
var is_highlighted: bool = false
|
||||
|
||||
func _ready():
|
||||
DebugManager.log_info("ValueStepper ready for: " + data_source, "ValueStepper")
|
||||
|
||||
# Store original visual properties
|
||||
original_scale = scale
|
||||
original_modulate = modulate
|
||||
|
||||
# Connect button signals
|
||||
if left_button and not left_button.pressed.is_connected(_on_left_button_pressed):
|
||||
left_button.pressed.connect(_on_left_button_pressed)
|
||||
|
||||
if right_button and not right_button.pressed.is_connected(_on_right_button_pressed):
|
||||
right_button.pressed.connect(_on_right_button_pressed)
|
||||
|
||||
# Initialize data
|
||||
_load_data()
|
||||
_update_display()
|
||||
|
||||
## Loads data based on the data_source type
|
||||
func _load_data():
|
||||
match data_source:
|
||||
"language":
|
||||
_load_language_data()
|
||||
"resolution":
|
||||
_load_resolution_data()
|
||||
"difficulty":
|
||||
_load_difficulty_data()
|
||||
_:
|
||||
DebugManager.log_warn("Unknown data_source: " + data_source, "ValueStepper")
|
||||
|
||||
func _load_language_data():
|
||||
var languages_data = SettingsManager.get_languages_data()
|
||||
if languages_data.has("languages"):
|
||||
values.clear()
|
||||
display_names.clear()
|
||||
for lang_code in languages_data.languages.keys():
|
||||
values.append(lang_code)
|
||||
display_names.append(languages_data.languages[lang_code]["display_name"])
|
||||
|
||||
# Set current index based on current language
|
||||
var current_lang = SettingsManager.get_setting("language")
|
||||
var index = values.find(current_lang)
|
||||
current_index = max(0, index)
|
||||
|
||||
DebugManager.log_info("Loaded %d languages" % values.size(), "ValueStepper")
|
||||
|
||||
func _load_resolution_data():
|
||||
# Example resolution data - customize as needed
|
||||
values = ["1920x1080", "1366x768", "1280x720", "1024x768"]
|
||||
display_names = ["1920×1080 (Full HD)", "1366×768", "1280×720 (HD)", "1024×768"]
|
||||
current_index = 0
|
||||
DebugManager.log_info("Loaded %d resolutions" % values.size(), "ValueStepper")
|
||||
|
||||
func _load_difficulty_data():
|
||||
# Example difficulty data - customize as needed
|
||||
values = ["easy", "normal", "hard", "nightmare"]
|
||||
display_names = ["Easy", "Normal", "Hard", "Nightmare"]
|
||||
current_index = 1 # Default to "normal"
|
||||
DebugManager.log_info("Loaded %d difficulty levels" % values.size(), "ValueStepper")
|
||||
|
||||
## Updates the display text based on current selection
|
||||
func _update_display():
|
||||
if values.size() == 0 or current_index < 0 or current_index >= values.size():
|
||||
value_display.text = "N/A"
|
||||
return
|
||||
|
||||
if display_names.size() > current_index:
|
||||
value_display.text = display_names[current_index]
|
||||
else:
|
||||
value_display.text = values[current_index]
|
||||
|
||||
## Changes the current value by the specified direction (-1 for previous, +1 for next)
|
||||
func change_value(direction: int):
|
||||
if values.size() == 0:
|
||||
DebugManager.log_warn("No values available for: " + data_source, "ValueStepper")
|
||||
return
|
||||
|
||||
var new_index = (current_index + direction) % values.size()
|
||||
if new_index < 0:
|
||||
new_index = values.size() - 1
|
||||
|
||||
current_index = new_index
|
||||
var new_value = values[current_index]
|
||||
|
||||
_update_display()
|
||||
_apply_value_change(new_value, current_index)
|
||||
value_changed.emit(new_value, current_index)
|
||||
DebugManager.log_info("Value changed to: " + new_value + " (index: " + str(current_index) + ")", "ValueStepper")
|
||||
|
||||
## Override this method for custom value application logic
|
||||
func _apply_value_change(new_value: String, index: int):
|
||||
match data_source:
|
||||
"language":
|
||||
SettingsManager.set_setting("language", new_value)
|
||||
if LocalizationManager:
|
||||
LocalizationManager.change_language(new_value)
|
||||
"resolution":
|
||||
# Apply resolution change logic here
|
||||
DebugManager.log_info("Resolution would change to: " + new_value, "ValueStepper")
|
||||
"difficulty":
|
||||
# Apply difficulty change logic here
|
||||
DebugManager.log_info("Difficulty would change to: " + new_value, "ValueStepper")
|
||||
|
||||
## Sets up custom values for the stepper
|
||||
func setup_custom_values(custom_values: Array[String], custom_display_names: Array[String] = []):
|
||||
values = custom_values.duplicate()
|
||||
display_names = custom_display_names.duplicate() if custom_display_names.size() > 0 else values.duplicate()
|
||||
current_index = 0
|
||||
_update_display()
|
||||
DebugManager.log_info("Setup custom values: " + str(values.size()) + " items", "ValueStepper")
|
||||
|
||||
## Gets the current value
|
||||
func get_current_value() -> String:
|
||||
if values.size() > 0 and current_index >= 0 and current_index < values.size():
|
||||
return values[current_index]
|
||||
return ""
|
||||
|
||||
## Sets the current value by string
|
||||
func set_current_value(value: String):
|
||||
var index = values.find(value)
|
||||
if index >= 0:
|
||||
current_index = index
|
||||
_update_display()
|
||||
|
||||
## Visual highlighting for navigation systems
|
||||
func set_highlighted(highlighted: bool):
|
||||
is_highlighted = highlighted
|
||||
if highlighted:
|
||||
scale = original_scale * 1.05
|
||||
modulate = Color(1.1, 1.1, 0.9)
|
||||
else:
|
||||
scale = original_scale
|
||||
modulate = original_modulate
|
||||
|
||||
## Handle input actions for navigation integration
|
||||
func handle_input_action(action: String) -> bool:
|
||||
match action:
|
||||
"move_left":
|
||||
change_value(-1)
|
||||
return true
|
||||
"move_right":
|
||||
change_value(1)
|
||||
return true
|
||||
_:
|
||||
return false
|
||||
|
||||
func _on_left_button_pressed():
|
||||
AudioManager.play_ui_click()
|
||||
DebugManager.log_info("Left button clicked", "ValueStepper")
|
||||
change_value(-1)
|
||||
|
||||
func _on_right_button_pressed():
|
||||
AudioManager.play_ui_click()
|
||||
DebugManager.log_info("Right button clicked", "ValueStepper")
|
||||
change_value(1)
|
||||
|
||||
## For navigation system integration
|
||||
func get_control_name() -> String:
|
||||
return data_source + "_stepper"
|
||||
1
scenes/ui/components/ValueStepper.gd.uid
Normal file
1
scenes/ui/components/ValueStepper.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://7qrls88h24o3
|
||||
26
scenes/ui/components/ValueStepper.tscn
Normal file
26
scenes/ui/components/ValueStepper.tscn
Normal file
@@ -0,0 +1,26 @@
|
||||
[gd_scene load_steps=2 format=3 uid="uid://cb6k05r8t7l4l"]
|
||||
|
||||
[ext_resource type="Script" path="res://scenes/ui/components/ValueStepper.gd" id="1_value_stepper"]
|
||||
|
||||
[node name="ValueStepper" type="HBoxContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 4
|
||||
script = ExtResource("1_value_stepper")
|
||||
|
||||
[node name="LeftButton" type="Button" parent="."]
|
||||
layout_mode = 2
|
||||
text = "<"
|
||||
|
||||
[node name="ValueDisplay" type="Label" parent="."]
|
||||
custom_minimum_size = Vector2(100, 0)
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 4
|
||||
text = "Value"
|
||||
horizontal_alignment = 1
|
||||
|
||||
[node name="RightButton" type="Button" parent="."]
|
||||
layout_mode = 2
|
||||
text = ">"
|
||||
|
||||
[connection signal="pressed" from="LeftButton" to="." method="_on_left_button_pressed"]
|
||||
[connection signal="pressed" from="RightButton" to="." method="_on_right_button_pressed"]
|
||||
Reference in New Issue
Block a user