feat: button to bring back to bracket

This commit is contained in:
Multiplyster
2025-12-04 01:30:10 -05:00
Unverified
parent e921eb253d
commit a16a44ba7a
9 changed files with 81 additions and 37 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

@@ -11,7 +11,7 @@ config_version=5
[application]
config/name="connect4-moderator-observer"
run/main_scene="uid://dcx5nvs0pa7me"
run/main_scene="uid://cr8fi0e4r88s8"
config/features=PackedStringArray("4.5", "C#", "Forward Plus")
config/icon="uid://ckmfi0cjgxgyk"

View File

@@ -1,4 +1,4 @@
[gd_scene load_steps=11 format=3 uid="uid://m542qwlp7hl7"]
[gd_scene load_steps=13 format=3 uid="uid://m542qwlp7hl7"]
[ext_resource type="Script" uid="uid://dg5jt0o0r0v3r" path="res://scripts/BoardScreen.cs" id="1_b3w8x"]
[ext_resource type="Texture2D" uid="uid://dlx02qat7j6lf" path="res://assets/sprites/AssetTileset.png" id="3_1tlhv"]
@@ -6,6 +6,7 @@
[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"]
[sub_resource type="WorldBoundaryShape2D" id="WorldBoundaryShape2D_b3w8x"]
@@ -25,6 +26,10 @@ texture_region_size = Vector2i(26, 26)
tile_size = Vector2i(26, 26)
sources/0 = SubResource("TileSetAtlasSource_i2o8i")
[sub_resource type="AtlasTexture" id="AtlasTexture_glh1q"]
atlas = ExtResource("3_1tlhv")
region = Rect2(112, 32, 16, 16)
[node name="BoardScreen" type="Node2D"]
script = ExtResource("1_b3w8x")
@@ -167,3 +172,13 @@ tile_set = SubResource("TileSet_glh1q")
format = 2
layer_0/z_index = 100
layer_0/tile_data = PackedInt32Array(-3, 0, 0, -2, 0, 0, -1, 0, 0, -65536, 0, 0, -65535, 0, 0, -65534, 0, 0, -4, 0, 0, -65540, 0, 0, -131076, 0, 0, -196612, 0, 0, -262148, 0, 0, -327684, 0, 0, -327683, 0, 0, -327682, 0, 0, -327681, 0, 0, -393216, 0, 0, -393215, 0, 0, -393214, 0, 0, -327678, 0, 0, -262142, 0, 0, -196606, 0, 0, -131070, 0, 0, -131071, 0, 0, -131072, 0, 0, -65537, 0, 0, -65538, 0, 0, -65539, 0, 0, -131075, 0, 0, -131074, 0, 0, -131073, 0, 0, -196608, 0, 0, -196607, 0, 0, -262143, 0, 0, -262144, 0, 0, -196609, 0, 0, -196610, 0, 0, -196611, 0, 0, -262147, 0, 0, -262146, 0, 0, -262145, 0, 0, -327680, 0, 0, -327679, 0, 0, -5, 196608, 536870912, -65541, 65536, 0, -131077, 65536, 0, -196613, 65536, 0, -262149, 65536, 0, -327685, 196608, 0, 65532, 196608, 1610612736, 2, 196608, 1879048192, -65533, 196608, 805306368, -393213, 196608, 268435456, -458750, 196608, 1342177280, -393219, 65536, 1073741824, -393218, 65536, 1073741824, -393217, 65536, 1073741824, -458752, 65536, 1073741824, -458751, 65536, 1073741824, -393220, 196608, 1073741824, -327677, 65536, 268435456, -262141, 65536, 268435456, -196605, 65536, 268435456, -131069, 65536, 268435456, 65533, 65536, 1879048192, 65534, 65536, 1879048192, 65535, 65536, 1879048192, 0, 65536, 1879048192, 1, 65536, 1879048192)
[node name="BracketButton" parent="." instance=ExtResource("7_glh1q")]
offset_left = -566.0
offset_top = 281.0
offset_right = -550.0
offset_bottom = 297.0
[node name="Sprite2D" type="Sprite2D" parent="BracketButton"]
position = Vector2(8, 8)
texture = SubResource("AtlasTexture_glh1q")

44
scenes/button_medium.tscn Normal file
View File

@@ -0,0 +1,44 @@
[gd_scene load_steps=7 format=3 uid="uid://d1wr0v5ht8vqb"]
[ext_resource type="Script" uid="uid://frisgjvf17ym" path="res://scripts/button_medium.gd" id="2_06p6p"]
[ext_resource type="Texture2D" uid="uid://dlx02qat7j6lf" path="res://assets/sprites/AssetTileset.png" id="2_q2stu"]
[ext_resource type="FontFile" uid="uid://c3jmev24lo6ci" path="res://assets/fonts/PixelOperator8.ttf" id="3_dxjfy"]
[sub_resource type="AtlasTexture" id="AtlasTexture_6ptbq"]
atlas = ExtResource("2_q2stu")
region = Rect2(8, 16, 32, 16)
[sub_resource type="AtlasTexture" id="AtlasTexture_06p6p"]
atlas = ExtResource("2_q2stu")
region = Rect2(8, 32, 32, 16)
[sub_resource type="AtlasTexture" id="AtlasTexture_q2stu"]
atlas = ExtResource("2_q2stu")
region = Rect2(8, 0, 32, 16)
[node name="ButtonSmall" type="TextureButton"]
offset_left = -32.0
offset_top = -32.0
offset_right = 32.0
texture_normal = SubResource("AtlasTexture_6ptbq")
texture_pressed = SubResource("AtlasTexture_06p6p")
texture_hover = SubResource("AtlasTexture_q2stu")
stretch_mode = 4
script = ExtResource("2_06p6p")
[node name="Label" type="Label" parent="."]
layout_mode = 0
offset_left = 2.0
offset_top = 9.0
offset_right = 62.0
offset_bottom = 25.0
theme_override_colors/font_color = Color(2.7723312e-05, 0.60865843, 0.9772685, 1)
theme_override_fonts/font = ExtResource("3_dxjfy")
theme_override_font_sizes/font_size = 16
text = "TEMP"
horizontal_alignment = 1
[connection signal="button_down" from="." to="." method="onButtonDown"]
[connection signal="button_up" from="." to="." method="onButtonUp"]
[connection signal="mouse_entered" from="." to="." method="onMouseEnter"]
[connection signal="mouse_exited" from="." to="." method="onMouseExit"]

View File

@@ -1,44 +1,24 @@
[gd_scene load_steps=7 format=3 uid="uid://d1wr0v5ht8vqb"]
[gd_scene load_steps=5 format=3 uid="uid://pdean68jjg80"]
[ext_resource type="Script" uid="uid://frisgjvf17ym" path="res://scripts/button_small.gd" id="2_06p6p"]
[ext_resource type="Texture2D" uid="uid://dlx02qat7j6lf" path="res://assets/sprites/AssetTileset.png" id="2_q2stu"]
[ext_resource type="FontFile" uid="uid://c3jmev24lo6ci" path="res://assets/fonts/PixelOperator8.ttf" id="3_dxjfy"]
[sub_resource type="AtlasTexture" id="AtlasTexture_qlcsu"]
atlas = ExtResource("2_q2stu")
region = Rect2(0, 64, 16, 16)
[sub_resource type="AtlasTexture" id="AtlasTexture_6ptbq"]
atlas = ExtResource("2_q2stu")
region = Rect2(8, 16, 32, 16)
region = Rect2(0, 80, 16, 16)
[sub_resource type="AtlasTexture" id="AtlasTexture_06p6p"]
atlas = ExtResource("2_q2stu")
region = Rect2(8, 32, 32, 16)
[sub_resource type="AtlasTexture" id="AtlasTexture_q2stu"]
atlas = ExtResource("2_q2stu")
region = Rect2(8, 0, 32, 16)
region = Rect2(0, 48, 16, 16)
[node name="ButtonSmall" type="TextureButton"]
offset_left = -32.0
offset_left = -16.0
offset_top = -32.0
offset_right = 32.0
texture_normal = SubResource("AtlasTexture_6ptbq")
texture_pressed = SubResource("AtlasTexture_06p6p")
texture_hover = SubResource("AtlasTexture_q2stu")
stretch_mode = 4
script = ExtResource("2_06p6p")
[node name="Label" type="Label" parent="."]
layout_mode = 0
offset_left = 2.0
offset_top = 9.0
offset_right = 62.0
offset_bottom = 25.0
theme_override_colors/font_color = Color(2.7723312e-05, 0.60865843, 0.9772685, 1)
theme_override_fonts/font = ExtResource("3_dxjfy")
theme_override_font_sizes/font_size = 16
text = "TEMP"
horizontal_alignment = 1
[connection signal="button_down" from="." to="." method="onButtonDown"]
[connection signal="button_up" from="." to="." method="onButtonUp"]
[connection signal="mouse_entered" from="." to="." method="onMouseEnter"]
[connection signal="mouse_exited" from="." to="." method="onMouseExit"]
offset_bottom = -16.0
scale = Vector2(2, 2)
texture_normal = SubResource("AtlasTexture_qlcsu")
texture_pressed = SubResource("AtlasTexture_6ptbq")
texture_hover = SubResource("AtlasTexture_06p6p")

View File

@@ -1,6 +1,6 @@
[gd_scene load_steps=3 format=3 uid="uid://cct663hb47yka"]
[ext_resource type="PackedScene" uid="uid://d1wr0v5ht8vqb" path="res://scenes/button_small.tscn" id="1_4km6l"]
[ext_resource type="PackedScene" uid="uid://d1wr0v5ht8vqb" path="res://scenes/button_medium.tscn" id="1_4km6l"]
[ext_resource type="Script" uid="uid://b1ogflafdte71" path="res://scripts/create_join_room.gd" id="1_k6yuv"]
[node name="CreateJoinRoom" type="Node2D"]

View File

@@ -39,6 +39,8 @@ public partial class BoardScreen : Node2D {
player1Card.GetNode<Label>("Name").Text = matchData.player1;
player2Card.GetNode<Label>("Name").Text = matchData.player2;
GetNode<TextureButton>("BracketButton").Pressed += TransitionToBracket;
Connection.Instance.OnObserveWin += ObserveWin;
Connection.Instance.OnObserveDraw += ObserveDraw;
Connection.Instance.OnObserveTerminated += ObserveTerminated;

View File

@@ -10,7 +10,10 @@ func onMouseEnter() -> void:
label.add_theme_color_override("font_color", HOVERED_COLOR);
func onMouseExit() -> void:
label.add_theme_color_override("font_color", DEFAULT_COLOR);
if button_down:
label.add_theme_color_override("font_color", CLICKED_COLOR);
else:
label.add_theme_color_override("font_color", DEFAULT_COLOR);
func onButtonDown() -> void:
label.add_theme_color_override("font_color", CLICKED_COLOR);