From beda42695cc43c873e75dc42597dcaf9e708cad9 Mon Sep 17 00:00:00 2001 From: Joshua Higgins Date: Thu, 4 Dec 2025 23:25:31 -0500 Subject: [PATCH] feat: more admin controls, new icons, MSAA... - fixed scaling viewport --- assets/sprites/AssetTileset.png.import | 2 +- assets/sprites/BoardTileMap.png.import | 2 +- assets/sprites/RedChip.png.import | 2 +- assets/sprites/YellowChip.png.import | 2 +- assets/sprites/back.png | Bin 0 -> 151 bytes assets/sprites/back.png.import | 40 +++++++++ assets/sprites/bracket.png | Bin 0 -> 167 bytes assets/sprites/bracket.png.import | 40 +++++++++ assets/sprites/button.png | Bin 0 -> 170 bytes assets/sprites/button.png.import | 40 +++++++++ assets/sprites/cancel.png | Bin 0 -> 229 bytes assets/sprites/cancel.png.import | 40 +++++++++ assets/sprites/long_button.png | Bin 0 -> 174 bytes assets/sprites/long_button.png.import | 40 +++++++++ assets/sprites/observe.png | Bin 0 -> 261 bytes assets/sprites/observe.png.import | 40 +++++++++ assets/sprites/player.png | Bin 0 -> 228 bytes assets/sprites/player.png.import | 40 +++++++++ assets/sprites/player_badge.png | Bin 0 -> 262 bytes assets/sprites/player_badge.png.import | 40 +++++++++ export_presets.cfg | 40 ++++----- icon.png | Bin 0 -> 76760 bytes icon.svg.import => icon.png.import | 11 +-- icon.svg | 1 - project.godot | 15 +++- scenes/board_screen.tscn | 9 ++- scenes/bracket_view.tscn | 27 +++++-- scripts/AdminControls.cs | 29 +++++++ scripts/BackButton.cs | 18 +++++ scripts/BackButton.cs.uid | 1 + scripts/BoardScreen.cs | 107 ++++++++++--------------- scripts/BracketScene.cs | 20 ++++- scripts/Connection.cs | 30 +++++-- 33 files changed, 522 insertions(+), 114 deletions(-) create mode 100644 assets/sprites/back.png create mode 100644 assets/sprites/back.png.import create mode 100644 assets/sprites/bracket.png create mode 100644 assets/sprites/bracket.png.import create mode 100644 assets/sprites/button.png create mode 100644 assets/sprites/button.png.import create mode 100644 assets/sprites/cancel.png create mode 100644 assets/sprites/cancel.png.import create mode 100644 assets/sprites/long_button.png create mode 100644 assets/sprites/long_button.png.import create mode 100644 assets/sprites/observe.png create mode 100644 assets/sprites/observe.png.import create mode 100644 assets/sprites/player.png create mode 100644 assets/sprites/player.png.import create mode 100644 assets/sprites/player_badge.png create mode 100644 assets/sprites/player_badge.png.import create mode 100644 icon.png rename icon.svg.import => icon.png.import (69%) delete mode 100644 icon.svg create mode 100644 scripts/BackButton.cs create mode 100644 scripts/BackButton.cs.uid diff --git a/assets/sprites/AssetTileset.png.import b/assets/sprites/AssetTileset.png.import index eec4ab6..7e8cd95 100644 --- a/assets/sprites/AssetTileset.png.import +++ b/assets/sprites/AssetTileset.png.import @@ -23,7 +23,7 @@ compress/rdo_quality_loss=0.0 compress/hdr_compression=1 compress/normal_map=0 compress/channel_pack=0 -mipmaps/generate=false +mipmaps/generate=true mipmaps/limit=-1 roughness/mode=0 roughness/src_normal="" diff --git a/assets/sprites/BoardTileMap.png.import b/assets/sprites/BoardTileMap.png.import index 4354b0a..0ab1624 100644 --- a/assets/sprites/BoardTileMap.png.import +++ b/assets/sprites/BoardTileMap.png.import @@ -23,7 +23,7 @@ compress/rdo_quality_loss=0.0 compress/hdr_compression=1 compress/normal_map=0 compress/channel_pack=0 -mipmaps/generate=false +mipmaps/generate=true mipmaps/limit=-1 roughness/mode=0 roughness/src_normal="" diff --git a/assets/sprites/RedChip.png.import b/assets/sprites/RedChip.png.import index c1b219c..b8b0c5b 100644 --- a/assets/sprites/RedChip.png.import +++ b/assets/sprites/RedChip.png.import @@ -23,7 +23,7 @@ compress/rdo_quality_loss=0.0 compress/hdr_compression=1 compress/normal_map=0 compress/channel_pack=0 -mipmaps/generate=false +mipmaps/generate=true mipmaps/limit=-1 roughness/mode=0 roughness/src_normal="" diff --git a/assets/sprites/YellowChip.png.import b/assets/sprites/YellowChip.png.import index ceaac22..01bec1c 100644 --- a/assets/sprites/YellowChip.png.import +++ b/assets/sprites/YellowChip.png.import @@ -23,7 +23,7 @@ compress/rdo_quality_loss=0.0 compress/hdr_compression=1 compress/normal_map=0 compress/channel_pack=0 -mipmaps/generate=false +mipmaps/generate=true mipmaps/limit=-1 roughness/mode=0 roughness/src_normal="" diff --git a/assets/sprites/back.png b/assets/sprites/back.png new file mode 100644 index 0000000000000000000000000000000000000000..70c5378e4dcdfc28cccddd973dd6c38b96c4a8af GIT binary patch literal 151 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|0zF+ELo9le z6C_w~H12y{pET7d@v_dEJclicJrSnH1_pcfRx)m1*S-7UF99}%Of{B!_x3QDvs~s@ xVd~m@ph@rJv_{5^`-K4r8ItgevgQu&X%Q~loCIHP5FXaFL literal 0 HcmV?d00001 diff --git a/assets/sprites/back.png.import b/assets/sprites/back.png.import new file mode 100644 index 0000000..f6f980e --- /dev/null +++ b/assets/sprites/back.png.import @@ -0,0 +1,40 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://2plbtkcttn7o" +path="res://.godot/imported/back.png-73d0d71f353725c6ba9218045b96399b.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/sprites/back.png" +dest_files=["res://.godot/imported/back.png-73d0d71f353725c6ba9218045b96399b.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=true +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/assets/sprites/bracket.png b/assets/sprites/bracket.png new file mode 100644 index 0000000000000000000000000000000000000000..70fe3a60509238f458c0505572a95b8d00dcab1d GIT binary patch literal 167 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|57K%?09oyqY;3ZJt8cXXxn;3%?v+1^1(q>N7oWYE z6?JykvD5oRw^;u2)R>@^9QA1Ci}Lh<9FLQl?A!yZr;B!`MvL&i|cwzopr0G?<%vj6}9 literal 0 HcmV?d00001 diff --git a/assets/sprites/long_button.png.import b/assets/sprites/long_button.png.import new file mode 100644 index 0000000..b85f8c9 --- /dev/null +++ b/assets/sprites/long_button.png.import @@ -0,0 +1,40 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://bvind4dms08sd" +path="res://.godot/imported/long_button.png-97ae4bec79a5441e5b3d9a75cbdf673f.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/sprites/long_button.png" +dest_files=["res://.godot/imported/long_button.png-97ae4bec79a5441e5b3d9a75cbdf673f.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=true +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/assets/sprites/observe.png b/assets/sprites/observe.png new file mode 100644 index 0000000000000000000000000000000000000000..6651db6139b82e4932990483c2e231cb34597da1 GIT binary patch literal 261 zcmV+g0s8)lP)Px#zez+vR5*>DlT8Z4AQXh>g@8neE7#2d3h60&>Yk#3u1mTrWR*fnR_Veh{K&gb>kC3?GUuKxk)b;8=dvzbp8~@Y5Skg*Jxbk%TVI4 z_tKO}Ami4Qv+f^OyVNa^pOm>y{%P$zACHo=pF`w$ZEPmiZao_%rc(Z4^|!BT3>`VA zeH*43uih?Q&BFUpj5{Pv^~!GV1x!;L_@@@dJj*$4A9pbO_T)D#9aaTiixN)U|HbP0l+XkKEEQJp literal 0 HcmV?d00001 diff --git a/assets/sprites/player.png.import b/assets/sprites/player.png.import new file mode 100644 index 0000000..bbee368 --- /dev/null +++ b/assets/sprites/player.png.import @@ -0,0 +1,40 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://b6iac21s36dku" +path="res://.godot/imported/player.png-e1eaffe0873063c60a0d0b322e4d87d9.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/sprites/player.png" +dest_files=["res://.godot/imported/player.png-e1eaffe0873063c60a0d0b322e4d87d9.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=true +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/assets/sprites/player_badge.png b/assets/sprites/player_badge.png new file mode 100644 index 0000000000000000000000000000000000000000..553448b6b9eb9ce803b6e14584c0ce953c23f0c3 GIT binary patch literal 262 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 Q3i#H%m1}cOXW1S92J(8PEC2ui literal 0 HcmV?d00001 diff --git a/icon.svg.import b/icon.png.import similarity index 69% rename from icon.svg.import rename to icon.png.import index cc975d6..f783bbe 100644 --- a/icon.svg.import +++ b/icon.png.import @@ -2,16 +2,16 @@ importer="texture" type="CompressedTexture2D" -uid="uid://ebf78p6bpq5m" -path="res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex" +uid="uid://dd7lvnidxr5ss" +path="res://.godot/imported/icon.png-487276ed1e3a0c39cad0279d744ee560.ctex" metadata={ "vram_texture": false } [deps] -source_file="res://icon.svg" -dest_files=["res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex"] +source_file="res://icon.png" +dest_files=["res://.godot/imported/icon.png-487276ed1e3a0c39cad0279d744ee560.ctex"] [params] @@ -38,6 +38,3 @@ process/hdr_as_srgb=false process/hdr_clamp_exposure=false process/size_limit=0 detect_3d/compress_to=1 -svg/scale=1.0 -editor/scale_with_editor_scale=false -editor/convert_colors_with_editor_theme=false diff --git a/icon.svg b/icon.svg deleted file mode 100644 index c6bbb7d..0000000 --- a/icon.svg +++ /dev/null @@ -1 +0,0 @@ - diff --git a/project.godot b/project.godot index fe1b39a..c518cd0 100644 --- a/project.godot +++ b/project.godot @@ -10,15 +10,24 @@ config_version=5 [application] -config/name="connect4-moderator-observer" +config/name="Connect4 Moderator - Observer" +config/version="0.1.2" run/main_scene="uid://dcx5nvs0pa7me" config/features=PackedStringArray("4.5", "C#", "Forward Plus") -config/icon="uid://ckmfi0cjgxgyk" +boot_splash/image="uid://dd7lvnidxr5ss" +config/icon="uid://dd7lvnidxr5ss" [autoload] Connection="*res://scripts/Connection.cs" +[display] + +window/size/viewport_width=1280 +window/size/viewport_height=720 +window/stretch/mode="canvas_items" +window/stretch/aspect="expand" + [dotnet] project/assembly_name="connect4-moderator-observer" @@ -28,3 +37,5 @@ project/assembly_name="connect4-moderator-observer" textures/canvas_textures/default_texture_filter=0 textures/vram_compression/import_s3tc_bptc=true textures/vram_compression/import_etc2_astc=true +anti_aliasing/quality/msaa_2d=2 +anti_aliasing/quality/msaa_3d=2 diff --git a/scenes/board_screen.tscn b/scenes/board_screen.tscn index 9aca32c..533765b 100644 --- a/scenes/board_screen.tscn +++ b/scenes/board_screen.tscn @@ -1,13 +1,13 @@ [gd_scene load_steps=14 format=3 uid="uid://m542qwlp7hl7"] [ext_resource type="Script" uid="uid://dg5jt0o0r0v3r" path="res://scripts/BoardScreen.cs" id="1_b3w8x"] -[ext_resource type="PackedScene" uid="uid://rl33x81cxlh0" path="res://scenes/bracket_view.tscn" id="2_u1oi2"] [ext_resource type="Texture2D" uid="uid://dlx02qat7j6lf" path="res://assets/sprites/AssetTileset.png" id="3_1tlhv"] [ext_resource type="FontFile" uid="uid://c3jmev24lo6ci" path="res://assets/fonts/PixelOperator8.ttf" id="3_rjcmr"] [ext_resource type="Texture2D" uid="uid://ckmfi0cjgxgyk" path="res://assets/sprites/RedChip.png" id="4_1hrcj"] [ext_resource type="Texture2D" uid="uid://qy30emdgrk7o" path="res://assets/sprites/YellowChip.png" id="5_i2o8i"] [ext_resource type="Texture2D" uid="uid://8un28mol7qow" path="res://assets/sprites/BoardTileMap.png" id="6_i2o8i"] [ext_resource type="PackedScene" uid="uid://pdean68jjg80" path="res://scenes/button_small.tscn" id="7_glh1q"] +[ext_resource type="Script" uid="uid://b3q4gq63qmx23" path="res://scripts/BackButton.cs" id="8_u1oi2"] [sub_resource type="WorldBoundaryShape2D" id="WorldBoundaryShape2D_b3w8x"] @@ -31,10 +31,8 @@ sources/0 = SubResource("TileSetAtlasSource_i2o8i") atlas = ExtResource("3_1tlhv") region = Rect2(112, 32, 16, 16) -[node name="BoardScreen" type="Node2D" node_paths=PackedStringArray("BackButton")] +[node name="BoardScreen" type="Node2D"] script = ExtResource("1_b3w8x") -BracketScene = ExtResource("2_u1oi2") -BackButton = NodePath("BracketButton") [node name="Floor Collider" type="StaticBody2D" parent="."] position = Vector2(0, 200) @@ -77,6 +75,7 @@ position = Vector2(274, 0) shape = SubResource("SegmentShape2D_i2o8i") [node name="Player1Card" type="Node2D" parent="."] +position = Vector2(0, 8) [node name="Left" type="Sprite2D" parent="Player1Card"] position = Vector2(-556, -300) @@ -123,6 +122,7 @@ theme_override_font_sizes/font_size = 8 text = "NOT READY" [node name="Player2Card" type="Node2D" parent="."] +position = Vector2(989, -64) [node name="Left" type="Sprite2D" parent="Player2Card"] position = Vector2(-556, -228) @@ -181,6 +181,7 @@ offset_left = -566.0 offset_top = 281.0 offset_right = -550.0 offset_bottom = 297.0 +script = ExtResource("8_u1oi2") [node name="Sprite2D" type="Sprite2D" parent="BracketButton"] position = Vector2(8, 8) diff --git a/scenes/bracket_view.tscn b/scenes/bracket_view.tscn index cee29af..e86172e 100644 --- a/scenes/bracket_view.tscn +++ b/scenes/bracket_view.tscn @@ -1,8 +1,8 @@ [gd_scene load_steps=5 format=3 uid="uid://rl33x81cxlh0"] [ext_resource type="Script" uid="uid://dm25u0a2lqk2x" path="res://scripts/BracketScene.cs" id="1_dvj3m"] -[ext_resource type="Texture2D" uid="uid://ckmfi0cjgxgyk" path="res://assets/sprites/RedChip.png" id="2_7c11m"] -[ext_resource type="PackedScene" uid="uid://b4tujjdhmk4h" path="res://scenes/red_chip.tscn" id="3_1511b"] +[ext_resource type="Texture2D" uid="uid://dd7lvnidxr5ss" path="res://icon.png" id="2_mbqc8"] +[ext_resource type="Texture2D" uid="uid://stk7umv2ppss" path="res://assets/sprites/cancel.png" id="3_as653"] [ext_resource type="Script" uid="uid://1y72woiynf31" path="res://scripts/AdminControls.cs" id="4_mbqc8"] [node name="BracketView" type="Control" node_paths=PackedStringArray("Players", "Matches")] @@ -15,8 +15,8 @@ grow_vertical = 2 script = ExtResource("1_dvj3m") Players = NodePath("HBoxContainer/PlayerList") Matches = NodePath("HBoxContainer/MatchList") -JoinButton = ExtResource("2_7c11m") -BoardScene = ExtResource("3_1511b") +WatchButton = ExtResource("2_mbqc8") +TerminateKickButton = ExtResource("3_as653") [node name="ColorRect" type="ColorRect" parent="."] custom_minimum_size = Vector2(0, 36) @@ -26,7 +26,7 @@ anchor_right = 1.0 grow_horizontal = 2 color = Color(0.13319641, 0.13319641, 0.13319638, 1) -[node name="AdminControls" type="HBoxContainer" parent="ColorRect" node_paths=PackedStringArray("BecomeAdmin", "StartTournament")] +[node name="AdminControls" type="HBoxContainer" parent="ColorRect" node_paths=PackedStringArray("BecomeAdmin", "StartTournament", "Label", "Timeout")] custom_minimum_size = Vector2(0, 36) layout_mode = 1 anchors_preset = 10 @@ -36,6 +36,8 @@ grow_horizontal = 2 script = ExtResource("4_mbqc8") BecomeAdmin = NodePath("BecomeAdmin") StartTournament = NodePath("StartTournament") +Label = NodePath("Label") +Timeout = NodePath("HSlider") [node name="BecomeAdmin" type="Button" parent="ColorRect/AdminControls"] layout_mode = 2 @@ -45,6 +47,21 @@ text = "Become Admin" layout_mode = 2 text = "Start Tournament" +[node name="Label" type="Label" parent="ColorRect/AdminControls"] +layout_mode = 2 +text = "Wait To Move: 5.0s " + +[node name="HSlider" type="HSlider" parent="ColorRect/AdminControls"] +custom_minimum_size = Vector2(256, 0) +layout_mode = 2 +size_flags_vertical = 1 +min_value = 0.1 +max_value = 5.0 +step = 0.2 +value = 5.0 +tick_count = 25 +ticks_on_borders = true + [node name="HBoxContainer" type="HBoxContainer" parent="."] layout_mode = 1 anchors_preset = -1 diff --git a/scripts/AdminControls.cs b/scripts/AdminControls.cs index 6091613..7fbd74f 100644 --- a/scripts/AdminControls.cs +++ b/scripts/AdminControls.cs @@ -6,6 +6,8 @@ public partial class AdminControls : HBoxContainer { [Export] public Button BecomeAdmin; [Export] public Button StartTournament; + [Export] public Label Label; + [Export] public Slider Timeout; public override void _Ready() { @@ -17,6 +19,31 @@ public partial class AdminControls : HBoxContainer { StartTournament.Hide(); } + + if (!Connection.Instance.IsAdmin) + { + Label.Hide(); + Timeout.Hide(); + } + + Timeout.Value = Connection.Instance.CurrentWaitTimeout; + var time = Connection.Instance.CurrentWaitTimeout.ToString(); + if (time.Length > 3) + { + time = time.Substring(0, 3); + } + + Label.Text = "Wait To Move: " + time + "s "; + Timeout.ValueChanged += value => + { + Connection.Instance.SetTournamentWait((float)value); + var time = Connection.Instance.CurrentWaitTimeout.ToString(); + if (time.Length > 3) + { + time = time.Substring(0, 3); + } + Label.Text = "Wait To Move: " + time + "s "; + }; BecomeAdmin.Pressed += ShowAuthPopup; } @@ -119,5 +146,7 @@ public partial class AdminControls : HBoxContainer { StartTournament.Show(); } + Label.Show(); + Timeout.Show(); } } diff --git a/scripts/BackButton.cs b/scripts/BackButton.cs new file mode 100644 index 0000000..9b2a958 --- /dev/null +++ b/scripts/BackButton.cs @@ -0,0 +1,18 @@ +using Godot; +using System; + +public partial class BackButton : TextureButton +{ + private const string BRACKET_SCENE_PATH = "res://scenes/bracket_view.tscn"; + + public override void _Pressed() + { + TransitionToBracket(); + base._Pressed(); + } + + private void TransitionToBracket() + { + GetTree().ChangeSceneToFile(BRACKET_SCENE_PATH); + } +} diff --git a/scripts/BackButton.cs.uid b/scripts/BackButton.cs.uid new file mode 100644 index 0000000..a94e54d --- /dev/null +++ b/scripts/BackButton.cs.uid @@ -0,0 +1 @@ +uid://b3q4gq63qmx23 diff --git a/scripts/BoardScreen.cs b/scripts/BoardScreen.cs index 3291316..1120877 100644 --- a/scripts/BoardScreen.cs +++ b/scripts/BoardScreen.cs @@ -4,8 +4,6 @@ using System.Collections.Generic; public partial class BoardScreen : Node2D { - [Export] public BaseButton BackButton; - private const string RED_CHIP_PATH = "res://scenes/red_chip.tscn"; private const string YELLOW_CHIP_PATH = "res://scenes/yellow_chip.tscn"; private const string BRACKET_SCENE_PATH = "res://scenes/bracket_view.tscn"; @@ -15,6 +13,9 @@ public partial class BoardScreen : Node2D { private const int CHIP_X_OFF = -(CHIP_SIZE + CHIP_PADDING) * 7 / 2 + (CHIP_SIZE + CHIP_PADDING) / 2; private const int Y_OFF = 300; private const int CARD_CENTER_X_DEFAULT = -536; + private const double MOVE_TIMEOUT_BEFORE_PLACE = 1.0f; + + private double currentTimeout = 0.0f; private PackedScene redChip; private PackedScene ylwChip; @@ -23,6 +24,8 @@ public partial class BoardScreen : Node2D { private Node2D player2Card; private MatchData matchData; + private List<(string, int)> moves; + private RigidBody2D[,] chips = new RigidBody2D[6, 7]; // 6 rows 7 cols | 0, 0 is top left // Called when the node enters the scene tree for the first time. @@ -40,19 +43,35 @@ public partial class BoardScreen : Node2D { matchData = Connection.Instance.CurrentObservingMatch; player1Card.GetNode