diff options
| author | Anson Bridges <bridges.anson@gmail.com> | 2025-08-19 12:38:02 -0700 |
|---|---|---|
| committer | Anson Bridges <bridges.anson@gmail.com> | 2025-08-19 12:38:02 -0700 |
| commit | 255fbf19cc9499ef384d41f68515da5e49e8a3ce (patch) | |
| tree | 13c838229198383b24644f613787e34842ea7ab2 /pages | |
| parent | f087c6a98b1da55525a6e3c1d7c82477f82eb5cd (diff) | |
added menus, reworking GC client architecture
Diffstat (limited to 'pages')
| -rw-r--r-- | pages/GameTable.tscn | 60 | ||||
| -rw-r--r-- | pages/MainMenu.tscn | 299 | ||||
| -rw-r--r-- | pages/MainScene.tscn | 15 | ||||
| -rw-r--r-- | pages/ServerBrowser.tscn | 8 |
4 files changed, 369 insertions, 13 deletions
diff --git a/pages/GameTable.tscn b/pages/GameTable.tscn index 25a4c16..efd6540 100644 --- a/pages/GameTable.tscn +++ b/pages/GameTable.tscn @@ -1,8 +1,8 @@ -[gd_scene load_steps=7 format=2] +[gd_scene load_steps=8 format=2] [ext_resource path="res://scripts/GameTable.gd" type="Script" id=1] [ext_resource path="res://textures/wood_board_knotty.png" type="Texture" id=2] -[ext_resource path="res://objects/Plane.tscn" type="PackedScene" id=3] +[ext_resource path="res://scripts/Board.gd" type="Script" id=3] [sub_resource type="Environment" id=1] background_mode = 1 @@ -22,10 +22,52 @@ albedo_texture = ExtResource( 2 ) material = SubResource( 2 ) size = Vector2( 30, 30 ) +[sub_resource type="GDScript" id=4] +resource_name = "testing_camera" +script/source = "extends Camera + +const max_scroll_distance : float = 10.0 +const min_scroll_distance : float = 2.0 +onready var scroll_distance : float = transform.origin.z +const scroll_step : float = 0.2 + +var mouse_clicked : bool = false +const max_pitch : float = -15.0 # deg +const min_pitch : float = -90.0 +const pan_factor : float = 0.5 + +onready var yaw = get_node(\"../..\") +onready var pitch = get_node(\"..\") + +func _ready(): + pass + +func _input(event): + if event is InputEventMouseButton: + if event.button_index == BUTTON_LEFT: + mouse_clicked = event.pressed + if event.button_index == BUTTON_WHEEL_UP and event.pressed: + if scroll_distance > min_scroll_distance: + scroll_distance -= scroll_step + if event.button_index == BUTTON_WHEEL_DOWN and event.pressed: + if scroll_distance < max_scroll_distance: + scroll_distance += scroll_step + transform.origin.z = scroll_distance + if event is InputEventMouseMotion and mouse_clicked: + var mouse_dir : Vector2 = event.get_relative() + yaw.rotation_degrees.y -= mouse_dir.x * pan_factor + + var new_pitch = pitch.rotation_degrees.x - mouse_dir.y * pan_factor*2 + if new_pitch < max_pitch and new_pitch > min_pitch: + transform.origin.y = -2 * (1 - (new_pitch - max_pitch) / (min_pitch - max_pitch)) + pitch.rotation_degrees.x = new_pitch +" + [node name="GameTable" type="Spatial"] script = ExtResource( 1 ) [node name="Board" type="Spatial" parent="."] +script = ExtResource( 3 ) [node name="ActivePieces" type="Spatial" parent="."] @@ -40,15 +82,15 @@ spot_range = 45.4139 [node name="WorldEnvironment" type="WorldEnvironment" parent="."] environment = SubResource( 1 ) -[node name="Camera" type="Camera" parent="."] -transform = Transform( 1, 0, 0, 0, 0.965939, 0.258768, 0, -0.258768, 0.965939, 0, 3.30213, 10.1497 ) - [node name="Tabletop" type="MeshInstance" parent="."] transform = Transform( 1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, 0, 0, 0 ) mesh = SubResource( 3 ) -[node name="Plane" parent="." instance=ExtResource( 3 )] -transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0.625405, 1.50965, -2.27158 ) +[node name="CameraHingeYaw" type="Spatial" parent="."] + +[node name="CameraHingePitch" type="Spatial" parent="CameraHingeYaw"] +transform = Transform( 1, 0, 0, 0, 0.965926, 0.258819, 0, -0.258819, 0.965926, 0, 0, 0 ) -[node name="Plane2" parent="." instance=ExtResource( 3 )] -transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -0.92594, 0.711815, -1.28117 ) +[node name="Camera" type="Camera" parent="CameraHingeYaw/CameraHingePitch"] +transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 7 ) +script = SubResource( 4 ) diff --git a/pages/MainMenu.tscn b/pages/MainMenu.tscn new file mode 100644 index 0000000..d216836 --- /dev/null +++ b/pages/MainMenu.tscn @@ -0,0 +1,299 @@ +[gd_scene load_steps=17 format=2] + +[ext_resource path="res://scripts/MainMenu.gd" type="Script" id=1] +[ext_resource path="res://resources/fonts/Cochineal-Bold.otf" type="DynamicFontData" id=2] +[ext_resource path="res://resources/fonts/Cochineal-Roman.otf" type="DynamicFontData" id=3] +[ext_resource path="res://resources/MenuOptions.theme" type="Theme" id=4] + +[sub_resource type="DynamicFont" id=29] +size = 72 +font_data = ExtResource( 2 ) + +[sub_resource type="DynamicFont" id=1] +size = 72 +font_data = ExtResource( 2 ) + +[sub_resource type="Theme" id=2] +default_font = SubResource( 1 ) +Button/fonts/font = SubResource( 29 ) + +[sub_resource type="DynamicFont" id=30] +size = 45 +font_data = ExtResource( 2 ) + +[sub_resource type="Theme" id=31] +default_font = SubResource( 1 ) +Button/fonts/font = SubResource( 30 ) + +[sub_resource type="Gradient" id=15] +offsets = PoolRealArray( 0 ) +colors = PoolColorArray( 0, 0, 0, 1 ) + +[sub_resource type="GradientTexture2D" id=22] +gradient = SubResource( 15 ) +width = 32 +height = 32 + +[sub_resource type="Gradient" id=23] +offsets = PoolRealArray( 0 ) +colors = PoolColorArray( 0, 0, 0, 1 ) + +[sub_resource type="GradientTexture2D" id=21] +gradient = SubResource( 23 ) +width = 32 +height = 32 + +[sub_resource type="GDScript" id=24] +resource_name = "set_colors_builtin" +script/source = "extends OptionButton + + +func _ready(): + for i in range(get_item_count()): + set_item_icon(i, get_item_icon(i).duplicate()) + var icon = get_item_icon(i) + icon.gradient = icon.gradient.duplicate() + icon.gradient.set_color(0, Globals.colors[i]) + icon.gradient.colors.remove(0) + + +" + +[sub_resource type="DynamicFont" id=27] +size = 95 +font_data = ExtResource( 3 ) + +[sub_resource type="Theme" id=28] +default_font = SubResource( 27 ) + +[node name="MainMenu" type="Control"] +anchor_right = 1.0 +anchor_bottom = 1.0 +rect_pivot_offset = Vector2( 560, -158 ) +script = ExtResource( 1 ) + +[node name="HostMenuButton" type="Button" parent="."] +anchor_left = 0.1 +anchor_top = 0.25 +anchor_right = 0.25 +anchor_bottom = 0.35 +theme = SubResource( 2 ) +text = "HOST" + +[node name="JoinMenuButton" type="Button" parent="."] +anchor_left = 0.1 +anchor_top = 0.4 +anchor_right = 0.25 +anchor_bottom = 0.5 +theme = SubResource( 2 ) +text = "JOIN" + +[node name="SettingsButton" type="Button" parent="."] +anchor_left = 0.1 +anchor_top = 0.55 +anchor_right = 0.35 +anchor_bottom = 0.65 +theme = SubResource( 2 ) +text = "SETTINGS" + +[node name="BackButton" type="Button" parent="."] +visible = false +anchor_left = 0.1 +anchor_top = 0.88 +anchor_right = 0.212 +anchor_bottom = 0.963 +theme = SubResource( 31 ) +text = "BACK" + +[node name="PlayerInfo" type="GridContainer" parent="."] +visible = false +anchor_left = 0.1 +anchor_top = 0.257 +anchor_right = 0.358 +anchor_bottom = 0.9 +columns = 2 + +[node name="UsernameLabel" type="Label" parent="PlayerInfo"] +margin_top = 5.0 +margin_right = 138.0 +margin_bottom = 38.0 +theme = ExtResource( 4 ) +text = "Username:" +align = 2 + +[node name="Username" type="LineEdit" parent="PlayerInfo"] +margin_left = 142.0 +margin_right = 342.0 +margin_bottom = 43.0 +rect_min_size = Vector2( 200, 0 ) +theme = ExtResource( 4 ) +text = "Player" +max_length = 32 + +[node name="ColorLabel" type="Label" parent="PlayerInfo"] +margin_top = 50.0 +margin_right = 138.0 +margin_bottom = 83.0 +theme = ExtResource( 4 ) +text = "Color:" +align = 2 + +[node name="PlayerColor" type="OptionButton" parent="PlayerInfo"] +margin_left = 142.0 +margin_top = 47.0 +margin_right = 202.0 +margin_bottom = 87.0 +rect_min_size = Vector2( 60, 40 ) +size_flags_horizontal = 0 +icon = SubResource( 22 ) +expand_icon = true +items = [ "", SubResource( 21 ), false, 0, null, "", SubResource( 21 ), false, 1, null, "", SubResource( 21 ), false, 2, null, "", SubResource( 21 ), false, 3, null, "", SubResource( 21 ), false, 4, null, "", SubResource( 21 ), false, 5, null, "", SubResource( 21 ), false, 6, null, "", SubResource( 21 ), false, 7, null, "", SubResource( 21 ), false, 8, null, "", SubResource( 21 ), false, 9, null ] +selected = 0 +script = SubResource( 24 ) + +[node name="AltColorLabel" type="Label" parent="PlayerInfo"] +margin_top = 94.0 +margin_right = 138.0 +margin_bottom = 127.0 +theme = ExtResource( 4 ) +text = "Alt color:" +align = 2 + +[node name="AltPlayerColor" type="OptionButton" parent="PlayerInfo"] +margin_left = 142.0 +margin_top = 91.0 +margin_right = 202.0 +margin_bottom = 131.0 +rect_min_size = Vector2( 60, 40 ) +size_flags_horizontal = 0 +icon = SubResource( 21 ) +expand_icon = true +items = [ "", SubResource( 21 ), false, 0, null, "", SubResource( 21 ), false, 1, null, "", SubResource( 21 ), false, 2, null, "", SubResource( 21 ), false, 3, null, "", SubResource( 21 ), false, 4, null, "", SubResource( 21 ), false, 5, null, "", SubResource( 21 ), false, 6, null, "", SubResource( 21 ), false, 7, null, "", SubResource( 21 ), false, 8, null, "", SubResource( 21 ), false, 9, null ] +selected = 1 +script = SubResource( 24 ) + +[node name="Title" type="Label" parent="."] +anchor_left = 0.075 +anchor_top = 0.067 +anchor_right = 0.75 +anchor_bottom = 0.069 +margin_right = 40.0 +margin_bottom = 14.0 +theme = SubResource( 28 ) +text = "ATC: AIR TRAFFIC CHAOS" + +[node name="HostMenu" type="Control" parent="."] +visible = false +anchor_left = 0.1 +anchor_top = 0.45 +anchor_right = 1.0 +anchor_bottom = 0.8 +margin_right = 40.0 +margin_bottom = 40.0 + +[node name="GameName" type="LineEdit" parent="HostMenu"] +anchor_right = 0.229 +theme = ExtResource( 4 ) +text = "Player's Game" +max_length = 39 + +[node name="HostButton" type="Button" parent="HostMenu"] +anchor_top = 0.597 +anchor_right = 0.229 +anchor_bottom = 0.698 +theme = SubResource( 2 ) +text = "Host" + +[node name="PlayerCountLabel" type="Label" parent="HostMenu"] +anchor_top = 0.17 +anchor_bottom = 0.17 +theme = ExtResource( 4 ) +text = "Players:" + +[node name="PlayerCount" type="OptionButton" parent="HostMenu"] +anchor_left = 0.083 +anchor_top = 0.165 +anchor_right = 0.229 +anchor_bottom = 0.196 +theme = ExtResource( 4 ) +text = "2" +items = [ "2", null, false, 2, null, "3", null, false, 3, null, "4", null, false, 4, null, "5", null, false, 5, null, "6", null, false, 6, null ] +selected = 0 + +[node name="PrivateToggle" type="CheckButton" parent="HostMenu"] +anchor_top = 0.3 +anchor_bottom = 0.3 +size_flags_horizontal = 0 +size_flags_vertical = 0 +theme = ExtResource( 4 ) +text = "Password Protected" + +[node name="Password" type="LineEdit" parent="HostMenu"] +visible = false +anchor_top = 0.428 +anchor_right = 0.23 +anchor_bottom = 0.465 +theme = ExtResource( 4 ) +max_length = 16 +placeholder_text = "Password" +placeholder_alpha = 0.587 + +[node name="JoinMenu" type="Control" parent="."] +visible = false +anchor_left = 0.1 +anchor_top = 0.45 +anchor_right = 1.0 +anchor_bottom = 0.8 +margin_right = 40.0 +margin_bottom = 40.0 + +[node name="LobbyID" type="LineEdit" parent="JoinMenu"] +anchor_right = 0.229 +theme = ExtResource( 4 ) +max_length = 39 +placeholder_text = "Lobby ID" +placeholder_alpha = 0.389 + +[node name="Password" type="LineEdit" parent="JoinMenu"] +anchor_top = 0.165 +anchor_right = 0.229 +anchor_bottom = 0.165 +theme = ExtResource( 4 ) +max_length = 39 +placeholder_text = "Password (if private)" +placeholder_alpha = 0.389 + +[node name="JoinButton" type="Button" parent="JoinMenu"] +anchor_top = 0.321 +anchor_right = 0.229 +anchor_bottom = 0.465 +theme = SubResource( 2 ) +text = "JOIN " + +[node name="SettingsMenu" type="GridContainer" parent="."] +visible = false +anchor_left = 0.1 +anchor_top = 0.267 +anchor_right = 1.0 +anchor_bottom = 0.8 +margin_right = 40.0 +margin_bottom = 40.0 +columns = 2 + +[node name="GCURLLabel" type="Label" parent="SettingsMenu"] +margin_top = 5.0 +margin_right = 322.0 +margin_bottom = 38.0 +theme = ExtResource( 4 ) +text = "Game Coordinator URL: " +align = 2 + +[node name="GameCoordinatorURL" type="LineEdit" parent="SettingsMenu"] +margin_left = 326.0 +margin_right = 676.0 +margin_bottom = 43.0 +rect_min_size = Vector2( 350, 0 ) +theme = ExtResource( 4 ) +max_length = 39 +placeholder_text = "Game Coordinator URL" +placeholder_alpha = 0.389 diff --git a/pages/MainScene.tscn b/pages/MainScene.tscn new file mode 100644 index 0000000..da9bdcd --- /dev/null +++ b/pages/MainScene.tscn @@ -0,0 +1,15 @@ +[gd_scene load_steps=4 format=2] + +[ext_resource path="res://network/websocket_client_basic.gd" type="Script" id=1] +[ext_resource path="res://pages/MainMenu.tscn" type="PackedScene" id=2] +[ext_resource path="res://scripts/MainScene.gd" type="Script" id=3] + +[node name="MainScene" type="Control"] +anchor_right = 1.0 +anchor_bottom = 1.0 +script = ExtResource( 3 ) + +[node name="GameCoordinator" type="Node" parent="."] +script = ExtResource( 1 ) + +[node name="MainMenu" parent="." instance=ExtResource( 2 )] diff --git a/pages/ServerBrowser.tscn b/pages/ServerBrowser.tscn index c4fcc61..c5d2ef4 100644 --- a/pages/ServerBrowser.tscn +++ b/pages/ServerBrowser.tscn @@ -1,14 +1,14 @@ [gd_scene load_steps=6 format=2] -[ext_resource path="res://network/websocket_client.gd" type="Script" id=1] +[ext_resource path="res://network/websocket_client_basic.gd" type="Script" id=1] [ext_resource path="res://scripts/ServerBrowser.gd" type="Script" id=2] -[sub_resource type="Gradient" id=15] +[sub_resource type="Gradient" id=23] offsets = PoolRealArray( 0 ) colors = PoolColorArray( 0, 0, 0, 1 ) [sub_resource type="GradientTexture2D" id=21] -gradient = SubResource( 15 ) +gradient = SubResource( 23 ) width = 32 height = 32 @@ -23,7 +23,6 @@ func _ready(): var icon = get_item_icon(i) icon.gradient = icon.gradient.duplicate() icon.gradient.set_color(0, Globals.colors[i]) - print(icon.gradient.colors) icon.gradient.colors.remove(0) @@ -92,6 +91,7 @@ text = "Player" max_length = 32 [node name="HostPopup" type="PopupPanel" parent="."] +visible = true margin_left = 383.0 margin_top = 129.0 margin_right = 633.0 |
