add basic match3 logic
use proper logging everywhere add gamepad and keyboard control on match3 gameplay
This commit is contained in:
@@ -11,13 +11,13 @@ extends Control
|
||||
var match3_scene: Node2D
|
||||
|
||||
func _ready():
|
||||
print("Match3DebugMenu: _ready() called")
|
||||
DebugManager.log_debug("Match3DebugMenu _ready() called", "Match3")
|
||||
DebugManager.debug_toggled.connect(_on_debug_toggled)
|
||||
# Initialize with current debug state
|
||||
var current_debug_state = DebugManager.is_debug_enabled()
|
||||
print("Match3DebugMenu: Current debug state is ", current_debug_state)
|
||||
DebugManager.log_debug("Match3DebugMenu current debug state is " + str(current_debug_state), "Match3")
|
||||
visible = current_debug_state
|
||||
print("Match3DebugMenu: Initial visibility set to ", visible)
|
||||
DebugManager.log_debug("Match3DebugMenu initial visibility set to " + str(visible), "Match3")
|
||||
if current_debug_state:
|
||||
_on_debug_toggled(true)
|
||||
regenerate_button.pressed.connect(_on_regenerate_pressed)
|
||||
@@ -34,17 +34,17 @@ func _find_match3_scene():
|
||||
if match3_scene and match3_scene.get_script():
|
||||
var script_path = match3_scene.get_script().resource_path
|
||||
if script_path == "res://scenes/game/gameplays/match3_gameplay.gd":
|
||||
print("Debug: Found match3 scene: ", match3_scene.name, " at path: ", match3_scene.get_path())
|
||||
DebugManager.log_debug("Found match3 scene: " + match3_scene.name + " at path: " + str(match3_scene.get_path()), "Match3")
|
||||
return
|
||||
|
||||
# If we couldn't find it, clear the reference
|
||||
match3_scene = null
|
||||
print("Debug: Could not find match3_gameplay scene")
|
||||
DebugManager.log_error("Could not find match3_gameplay scene", "Match3")
|
||||
|
||||
func _on_debug_toggled(enabled: bool):
|
||||
print("Match3DebugMenu: Debug toggled to ", enabled)
|
||||
DebugManager.log_debug("Match3DebugMenu debug toggled to " + str(enabled), "Match3")
|
||||
visible = enabled
|
||||
print("Match3DebugMenu: Visibility set to ", visible)
|
||||
DebugManager.log_debug("Match3DebugMenu visibility set to " + str(visible), "Match3")
|
||||
if enabled:
|
||||
# Always refresh match3 scene reference when debug menu opens
|
||||
if not match3_scene:
|
||||
@@ -67,37 +67,37 @@ 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", "Match3")
|
||||
return
|
||||
|
||||
if match3_scene.has_method("regenerate_grid"):
|
||||
print("Debug: Calling regenerate_grid()")
|
||||
DebugManager.log_debug("Calling regenerate_grid()", "Match3")
|
||||
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", "Match3")
|
||||
|
||||
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", "Match3")
|
||||
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), "Match3")
|
||||
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", "Match3")
|
||||
|
||||
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")
|
||||
DebugManager.log_error("Could not find match3 scene for grid width change", "Match3")
|
||||
return
|
||||
|
||||
var new_width = int(value)
|
||||
@@ -107,7 +107,7 @@ 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), "Match3")
|
||||
await match3_scene.set_grid_size(Vector2i(new_width, current_height))
|
||||
|
||||
func _on_grid_height_changed(value: float):
|
||||
@@ -115,7 +115,7 @@ func _on_grid_height_changed(value: float):
|
||||
_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", "Match3")
|
||||
return
|
||||
|
||||
var new_height = int(value)
|
||||
@@ -125,5 +125,5 @@ 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), "Match3")
|
||||
await match3_scene.set_grid_size(Vector2i(current_width, new_height))
|
||||
|
||||
Reference in New Issue
Block a user