Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions autoload/SceneManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ public partial class SceneManager : Node
public const string GameUI = "res://scenes/ui/game_ui/GameUI.tscn";
public const string PausePopup = "res://scenes/ui/pause/PausePopup.tscn";
public const string GameOver = "res://scenes/ui/game_over/GameOver.tscn";
public const string GameGuide = "res://scenes/ui/game_guide/PlayGuide.tscn";

private Node _currentScene;

Expand Down
2 changes: 1 addition & 1 deletion project.godot
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ config_version=5

[application]

config/name="PatternShift"
config/name="PatternShiftV7"
run/main_scene="uid://bllyklhjrkoao"
config/features=PackedStringArray("4.7", "C#", "GL Compatibility")
config/icon="uid://dse0xvs2tbsqe"
Expand Down
26 changes: 19 additions & 7 deletions scenes/game/cards/Card.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

public partial class Card : Control
{
private AudioStreamPlayer _sound;
private AudioStreamPlayer _sound2;
private Panel _background;
private VBoxContainer _shapesContainer;
private TextureRect _shapeTemplate;
Expand All @@ -11,6 +13,7 @@ public partial class Card : Control
private GpuParticles2D _selectionParticles;
private Vector2 _baseScale = Vector2.One;
private int _originalZIndex = 0;
public int CCount = 0;

public enum ShapeType { Rectangle, Triangle, Hexagon }
public enum FillType { Empty, Striped, Solid }
Expand Down Expand Up @@ -40,11 +43,11 @@ public CardStyleParams(float width, float height, int separation)
{ ColorType.Purple, new Color("#9C27B0") }
};

private ShapeType _shape = ShapeType.Rectangle;
private ColorType _color = ColorType.Blue;
private FillType _fill = FillType.Empty;
private int _count = 1;
private bool _isSelected = false;
public ShapeType _shape = ShapeType.Rectangle;
public ColorType _color = ColorType.Blue;
public FillType _fill = FillType.Empty;
public int _count = 1;
public bool _isSelected = false;
private float _currentScale = 1.0f;

public override void _Ready()
Expand All @@ -55,6 +58,10 @@ public override void _Ready()
_highlight = GetNode<Panel>("Highlight");
_clickArea = GetNode<Button>("ClickArea");
_selectionParticles = GetNode<GpuParticles2D>("SelectionParticles");
_sound = GetNode<AudioStreamPlayer>("AudioStreamPlayer");
_sound.Stream = ResourceLoader.Load<AudioStream>("res://sounds/наведение на карточку 1.mp3");
_sound2 = GetNode<AudioStreamPlayer>("AudioStreamPlayer2");
_sound2.Stream = ResourceLoader.Load<AudioStream>("res://sounds/клик 1.mp3");

if (_clickArea != null)
{
Expand Down Expand Up @@ -86,6 +93,7 @@ private void OnHover()
shakeTween.TweenProperty(this, "rotation", 0.02f, 0.05f);
shakeTween.TweenProperty(this, "rotation", -0.02f, 0.05f);
shakeTween.TweenProperty(this, "rotation", 0.0f, 0.05f);
_sound.Play();
}

private void OnUnhover()
Expand Down Expand Up @@ -128,7 +136,7 @@ private string GetShapePath(ShapeType shape, FillType fill)
return $"res://assets/images/cards/shapes/{styleFolder}/{shapeName}_{fillName}.png";
}

private void UpdateCard()
public void UpdateCard()
{
if (_shapeTemplate == null) return;

Expand Down Expand Up @@ -189,9 +197,13 @@ public void SetSelected(bool selected)
}
}

private void OnCardPressed()
public void OnCardPressed()
{
_sound2.Play();
SetSelected(!_isSelected);
GD.Print($"Card clicked: {_shape}, {_color}, {_fill}, {_count}");
CCount += 1;
if (CCount < 2) GameUI.CardSelected();
else { CCount = 0; GameUI.CardDeselected(); }
}
}
4 changes: 4 additions & 0 deletions scenes/game/cards/Card.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -124,3 +124,7 @@ preprocess = 1.2
explosiveness = 1.0
draw_order = 0
process_material = SubResource("ParticleProcessMaterial_3hlpf")

[node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="." unique_id=1338773915]

[node name="AudioStreamPlayer2" type="AudioStreamPlayer" parent="." unique_id=1587900092]
16 changes: 16 additions & 0 deletions scenes/ui/game_guide/PlayGuide.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using Godot;
using System;

public partial class PlayGuide : Control
{
[Export] private Button _closeButton;
public override void _Ready()
{
_closeButton.Pressed += OnCloseButtonPressed;
}

private void OnCloseButtonPressed()
{
QueueFree();
}
}
1 change: 1 addition & 0 deletions scenes/ui/game_guide/PlayGuide.cs.uid
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
uid://d1boowncn1bui
87 changes: 87 additions & 0 deletions scenes/ui/game_guide/PlayGuide.tscn
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
[gd_scene format=3 uid="uid://bu6gkanf3ij0d"]

[ext_resource type="StyleBox" uid="uid://xmn7xcqiwlsh" path="res://assets/themes/panelcontrol.tres" id="1_p2ob1"]
[ext_resource type="Script" uid="uid://d1boowncn1bui" path="res://scenes/ui/game_guide/PlayGuide.cs" id="1_x3wil"]
[ext_resource type="Theme" uid="uid://g0en87gf7qtb" path="res://assets/themes/ModeSelect_font_variation.tres" id="2_x3wil"]
[ext_resource type="Theme" uid="uid://vm3qx3vxv0sr" path="res://assets/themes/UI_theme.tres" id="3_7w8hc"]

[node name="PlayGuide" type="Control" unique_id=1751048793 node_paths=PackedStringArray("_closeButton")]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
offset_left = 966.0
offset_top = 518.0
offset_right = 966.0
offset_bottom = 518.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("1_x3wil")
_closeButton = NodePath("PlayGuide/VBoxContainer/HBoxContainer/CloseButton")

[node name="ColorRect" type="ColorRect" parent="." unique_id=686243145]
modulate = Color(0, 0, 0, 0.59607846)
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
color = Color(0, 0, 0, 1)

[node name="PlayGuide" type="PanelContainer" parent="." unique_id=302381817]
custom_minimum_size = Vector2(1500, 850)
layout_mode = 1
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -750.0
offset_top = -425.0
offset_right = 750.0
offset_bottom = 425.0
grow_horizontal = 2
grow_vertical = 2
theme_override_styles/panel = ExtResource("1_p2ob1")

[node name="VBoxContainer" type="VBoxContainer" parent="PlayGuide" unique_id=957766217]
layout_mode = 2
alignment = 1

[node name="PlayGuide" type="Label" parent="PlayGuide/VBoxContainer" unique_id=1338117602]
layout_mode = 2
size_flags_vertical = 2
size_flags_stretch_ratio = 0.55
theme = ExtResource("2_x3wil")
theme_override_font_sizes/font_size = 60
text = "ОБУЧЕНИЕ"
horizontal_alignment = 1

[node name="HBoxContainer" type="HBoxContainer" parent="PlayGuide/VBoxContainer" unique_id=1618677177]
layout_mode = 2
size_flags_horizontal = 5
size_flags_vertical = 3
size_flags_stretch_ratio = 3.95

[node name="CloseButton" type="Button" parent="PlayGuide/VBoxContainer/HBoxContainer" unique_id=1269978490]
custom_minimum_size = Vector2(400, 100)
layout_mode = 2
size_flags_horizontal = 2
size_flags_vertical = 10
size_flags_stretch_ratio = 0.9
theme = ExtResource("3_7w8hc")
theme_type_variation = &"FlatButton"
theme_override_font_sizes/font_size = 50
text = "Назад"

[node name="Label" type="Label" parent="PlayGuide/VBoxContainer/HBoxContainer" unique_id=53931437]
custom_minimum_size = Vector2(1000, 500)
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 1
theme = ExtResource("2_x3wil")
theme_override_font_sizes/font_size = 40
text = "Выберите три карты на поле, если их отдельные свойства полностью одинаковы или полностью различны - сет есть"
vertical_alignment = 1
autowrap_mode = 3
Loading