add basic match3 logic

use proper logging everywhere
add gamepad and keyboard control on match3 gameplay
This commit is contained in:
2025-09-24 16:58:08 +04:00
parent e76297b3f3
commit bbf512b675
14 changed files with 466 additions and 63 deletions

View File

@@ -75,7 +75,7 @@ func _find_match3_scene():
break
if match3_scene:
print("Debug: Found match3 scene: ", match3_scene.name)
DebugManager.log_debug("Found match3 scene: " + match3_scene.name, "DebugMenu")
# 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
@@ -136,30 +136,30 @@ func _on_regenerate_pressed():
_find_match3_scene()
if not match3_scene:
print("Error: Could not find match3 scene for regeneration")
DebugManager.log_error("Could not find match3 scene for regeneration", "DebugMenu")
return
if match3_scene.has_method("regenerate_grid"):
print("Debug: Calling regenerate_grid()")
DebugManager.log_debug("Calling regenerate_grid()", "DebugMenu")
await match3_scene.regenerate_grid()
else:
print("Error: match3_scene does not have regenerate_grid method")
DebugManager.log_error("match3_scene does not have regenerate_grid method", "DebugMenu")
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")
DebugManager.log_error("Could not find match3 scene for gem types change", "DebugMenu")
return
var new_value = int(value)
if match3_scene.has_method("set_tile_types"):
print("Debug: Setting tile types to ", new_value)
DebugManager.log_debug("Setting tile types to " + str(new_value), "DebugMenu")
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")
DebugManager.log_error("match3_scene does not have set_tile_types method", "DebugMenu")
# Fallback: try to set TILE_TYPES directly
if "TILE_TYPES" in match3_scene:
match3_scene.TILE_TYPES = new_value
@@ -170,7 +170,7 @@ func _on_grid_width_changed(value: float):
_find_match3_scene()
if not match3_scene:
print("Error: Could not find match3 scene for grid width change")
DebugManager.log_error("Could not find match3 scene for grid width change", "DebugMenu")
return
var new_width = int(value)
@@ -180,17 +180,17 @@ func _on_grid_width_changed(value: float):
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)
DebugManager.log_debug("Setting grid size to " + str(new_width) + "x" + str(current_height), "DebugMenu")
await match3_scene.set_grid_size(Vector2i(new_width, current_height))
else:
print("Error: match3_scene does not have set_grid_size method")
DebugManager.log_error("match3_scene does not have set_grid_size method", "DebugMenu")
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")
DebugManager.log_error("Could not find match3 scene for grid height change", "DebugMenu")
return
var new_height = int(value)
@@ -200,7 +200,7 @@ func _on_grid_height_changed(value: float):
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)
DebugManager.log_debug("Setting grid size to " + str(current_width) + "x" + str(new_height), "DebugMenu")
await match3_scene.set_grid_size(Vector2i(current_width, new_height))
else:
print("Error: match3_scene does not have set_grid_size method")
DebugManager.log_error("match3_scene does not have set_grid_size method", "DebugMenu")