refactor structure

This commit is contained in:
2025-09-22 11:43:09 +04:00
committed by nett00n
parent 4e0b5fe3d2
commit 9b3a20cdf1
149 changed files with 518 additions and 214 deletions

27
scenes/game/game.gd Normal file
View File

@@ -0,0 +1,27 @@
extends Node
@onready var back_button: Button = $BackButtonContainer/BackButton
const MATCH3_SCENE_PATH := "res://scenes/match3/match3.tscn"
var match3_instance: Node
func _ready() -> void:
if not back_button.pressed.is_connected(_on_back_button_pressed):
back_button.pressed.connect(_on_back_button_pressed)
_load_match3_scene()
func _on_back_button_pressed() -> void:
AudioManager.play_ui_click()
GameManager.save_game()
if match3_instance and is_instance_valid(match3_instance):
match3_instance.queue_free()
GameManager.exit_to_main_menu()
func _load_match3_scene() -> void:
var match3_scene := load(MATCH3_SCENE_PATH)
if not match3_scene or not match3_scene is PackedScene:
push_error("Failed to load Match3 scene at: %s" % MATCH3_SCENE_PATH)
return
match3_instance = match3_scene.instantiate()
add_child(match3_instance)

21
scenes/game/game.tscn Normal file
View File

@@ -0,0 +1,21 @@
[gd_scene load_steps=3 format=3 uid="uid://dmwkyeq2l7u04"]
[ext_resource type="Script" uid="uid://bvtr6yhlyuv4v" path="res://scenes/game/game.gd" id="1_uwrxv"]
[ext_resource type="PackedScene" uid="uid://b4kv7g7kllwgb" path="res://scenes/match3/match3.tscn" id="2_yqjtg"]
[node name="Game" type="Node"]
script = ExtResource("1_uwrxv")
[node name="BackButtonContainer" type="Control" parent="."]
layout_mode = 3
anchors_preset = 0
offset_right = 40.0
offset_bottom = 40.0
[node name="BackButton" type="Button" parent="BackButtonContainer"]
layout_mode = 0
offset_right = 45.0
offset_bottom = 31.0
text = "back"
[node name="Match3" parent="." instance=ExtResource("2_yqjtg")]